+ nodejs applications support with pm2 manager
* use dockerhost in xdebug3 config for php8 in workspace * set local docker resolver for nginx * refactored base configs (join in one base config) and better separate examples for third party services * set default web port for inbucket to 82 instead of 9090, because last use for cockpit
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,6 +1,8 @@
|
|||||||
/.idea
|
/.idea
|
||||||
/dockerfiles/ypt-encoder
|
/dockerfiles/ypt-encoder
|
||||||
/docker-compose.yml
|
/docker-compose*
|
||||||
/docker-compose.elastic.yml
|
!/docker-compose.base.yml
|
||||||
|
!/docker-compose*.example
|
||||||
|
/docker-compose.nodejs.yml
|
||||||
/.env
|
/.env
|
||||||
/*.komodoproject
|
/*.komodoproject
|
22
bash/pm2-restart.sh
Executable file
22
bash/pm2-restart.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)"
|
||||||
|
|
||||||
|
. $DIR/bash/_docker-cmd.sh || {
|
||||||
|
echo "no docker cmd is presented" && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
PM2_SERVICE=$1
|
||||||
|
|
||||||
|
if [[ -z "${PM2_SERVICE}" ]]; then
|
||||||
|
echo "Usage: $(basename $0) NODEJS_PROJECT_NAME"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONTAINER=$(docker ps | grep "pm2-${PM2_SERVICE}" | awk '{print $1}')
|
||||||
|
|
||||||
|
if [[ -z "${CONTAINER}" ]]; then
|
||||||
|
echo "Unable to find container: db"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
$DOCKER_CMD restart ${CONTAINER}
|
9
bash/tail-nginx-access-log.sh
Executable file
9
bash/tail-nginx-access-log.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Not working on windows symlinks
|
||||||
|
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)"
|
||||||
|
|
||||||
|
LOG_FILE_PATH="${DIR}/log/nginx/access.log"
|
||||||
|
|
||||||
|
clear
|
||||||
|
|
||||||
|
tail -f $LOG_FILE_PATH
|
9
bash/tail-nginx-error-log.sh
Executable file
9
bash/tail-nginx-error-log.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Not working on windows symlinks
|
||||||
|
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)"
|
||||||
|
|
||||||
|
LOG_FILE_PATH="${DIR}/log/nginx/error.log"
|
||||||
|
|
||||||
|
clear
|
||||||
|
|
||||||
|
tail -f $LOG_FILE_PATH
|
@ -21,7 +21,7 @@ map $http_accept $webp_suffix {
|
|||||||
"~*webp" ".webp";
|
"~*webp" ".webp";
|
||||||
}
|
}
|
||||||
|
|
||||||
resolver 8.8.8.8;
|
resolver 127.0.0.11;
|
||||||
|
|
||||||
map $http_host $uploads_upstream {
|
map $http_host $uploads_upstream {
|
||||||
wordpress.local.wpstudio.ru "https://somewp.site";
|
wordpress.local.wpstudio.ru "https://somewp.site";
|
||||||
|
20
config/nginx/conf.d/z-nodejs.conf.example
Normal file
20
config/nginx/conf.d/z-nodejs.conf.example
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
map $http_host $pm2 {
|
||||||
|
someprojectone.build.local.wpstudio.ru pm2-someprojectone;
|
||||||
|
someprojecttwo.build.local.wpstudio.ru pm2-someprojecttwo;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name
|
||||||
|
someprojectone.build.local.wpstudio.ru
|
||||||
|
someprojecttwo.build.local.wpstudio.ru
|
||||||
|
;
|
||||||
|
location / {
|
||||||
|
resolver 127.0.0.11;
|
||||||
|
proxy_pass http://$pm2:3000;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
}
|
||||||
|
}
|
@ -71,10 +71,37 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "2500:2500"
|
- "2500:2500"
|
||||||
- "9090:9000"
|
- "82:9000"
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
restart: always
|
restart: always
|
||||||
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
|
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/redis/redis.conf:/usr/local/etc/redis/redis.conf
|
- ./config/redis/redis.conf:/usr/local/etc/redis/redis.conf
|
||||||
|
elastic:
|
||||||
|
build:
|
||||||
|
context: ./dockerfiles/elastic
|
||||||
|
restart: on-failure
|
||||||
|
environment:
|
||||||
|
- discovery.type=single-node
|
||||||
|
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||||
|
ulimits:
|
||||||
|
memlock:
|
||||||
|
soft: -1
|
||||||
|
hard: -1
|
||||||
|
expose:
|
||||||
|
- "9200"
|
||||||
|
- "9300"
|
||||||
|
minio:
|
||||||
|
image: minio/minio:RELEASE.2020-06-12T00-06-19Z
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
|
||||||
|
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
|
||||||
|
command: server /minio
|
||||||
|
pm2:
|
||||||
|
build:
|
||||||
|
context: ./dockerfiles/pm2
|
||||||
|
restart: always
|
||||||
|
expose:
|
||||||
|
- 3000
|
@ -1,18 +0,0 @@
|
|||||||
version: '3.6'
|
|
||||||
|
|
||||||
services:
|
|
||||||
elastic:
|
|
||||||
build:
|
|
||||||
context: ./dockerfiles/elastic
|
|
||||||
restart: on-failure
|
|
||||||
environment:
|
|
||||||
- discovery.type=single-node
|
|
||||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
|
||||||
ulimits:
|
|
||||||
memlock:
|
|
||||||
soft: -1
|
|
||||||
hard: -1
|
|
||||||
mem_limit: 2g
|
|
||||||
expose:
|
|
||||||
- "9200"
|
|
||||||
- "9300"
|
|
@ -3,7 +3,7 @@ version: '3.6'
|
|||||||
services:
|
services:
|
||||||
elastic:
|
elastic:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose.elastic.base.yml
|
file: docker-compose.base.yml
|
||||||
service: elastic
|
service: elastic
|
||||||
restart: always
|
restart: always
|
||||||
build:
|
build:
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
version: '3.6'
|
|
||||||
|
|
||||||
services:
|
|
||||||
minio:
|
|
||||||
image: minio/minio:RELEASE.2020-06-12T00-06-19Z
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
|
|
||||||
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
|
|
||||||
command: server /minio
|
|
@ -3,7 +3,7 @@ version: '3.6'
|
|||||||
services:
|
services:
|
||||||
minio:
|
minio:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose.minio.base.yml
|
file: docker-compose.base.yml
|
||||||
service: minio
|
service: minio
|
||||||
volumes:
|
volumes:
|
||||||
- minio:/minio
|
- minio:/minio
|
||||||
|
12
docker-compose.minio.yml.example
Executable file
12
docker-compose.minio.yml.example
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
version: '3.6'
|
||||||
|
|
||||||
|
services:
|
||||||
|
minio:
|
||||||
|
extends:
|
||||||
|
file: docker-compose.base.yml
|
||||||
|
service: minio
|
||||||
|
volumes:
|
||||||
|
- minio:/minio
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
minio:
|
15
docker-compose.nodejs.yml.example
Executable file
15
docker-compose.nodejs.yml.example
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
version: '3.6'
|
||||||
|
|
||||||
|
services:
|
||||||
|
pm2-someprojectone:
|
||||||
|
extends:
|
||||||
|
file: docker-compose.base.yml
|
||||||
|
service: pm2
|
||||||
|
volumes:
|
||||||
|
- ${PROJECTS_DIR}/someprojectone/.output:/.output
|
||||||
|
pm2-someprojecttwo:
|
||||||
|
extends:
|
||||||
|
file: docker-compose.base.yml
|
||||||
|
service: pm2
|
||||||
|
volumes:
|
||||||
|
- ${PROJECTS_DIR}/someprojecttwo/.output:/.output
|
11
docker-compose.redis.yml.example
Executable file
11
docker-compose.redis.yml.example
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
version: '3.6'
|
||||||
|
|
||||||
|
services:
|
||||||
|
redis-someprojectone:
|
||||||
|
extends:
|
||||||
|
file: docker-compose.base.yml
|
||||||
|
service: redis
|
||||||
|
redis-someprojecttwo:
|
||||||
|
extends:
|
||||||
|
file: docker-compose.base.yml
|
||||||
|
service: redis
|
@ -8,7 +8,10 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
aliases:
|
aliases:
|
||||||
- loc.yoursite.ru
|
- someproject.local.wpstudio.ru
|
||||||
|
depends_on:
|
||||||
|
- php74
|
||||||
|
- php81
|
||||||
php74:
|
php74:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose.base.yml
|
file: docker-compose.base.yml
|
||||||
@ -45,14 +48,6 @@ services:
|
|||||||
extends:
|
extends:
|
||||||
file: docker-compose.base.yml
|
file: docker-compose.base.yml
|
||||||
service: inbucket
|
service: inbucket
|
||||||
redis:
|
|
||||||
extends:
|
|
||||||
file: docker-compose.base.yml
|
|
||||||
service: redis
|
|
||||||
redis-some:
|
|
||||||
extends:
|
|
||||||
file: docker-compose.base.yml
|
|
||||||
service: redis
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
database:
|
database:
|
||||||
|
5
dockerfiles/pm2/Dockerfile
Normal file
5
dockerfiles/pm2/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
FROM keymetrics/pm2:18-buster
|
||||||
|
|
||||||
|
COPY ./ecosystem.config.js /ecosystem.config.js
|
||||||
|
|
||||||
|
CMD ["pm2-runtime", "start", "ecosystem.config.js"]
|
11
dockerfiles/pm2/ecosystem.config.js
Normal file
11
dockerfiles/pm2/ecosystem.config.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module.exports = {
|
||||||
|
apps: [
|
||||||
|
{
|
||||||
|
name: 'NuxtAppName',
|
||||||
|
port: '3000',
|
||||||
|
exec_mode: 'cluster',
|
||||||
|
instances: '2',
|
||||||
|
script: './.output/server/index.mjs',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
@ -70,13 +70,6 @@ ENV COMPOSER_VERSION ${COMPOSER_VERSION}
|
|||||||
RUN composer self-update --${COMPOSER_VERSION}
|
RUN composer self-update --${COMPOSER_VERSION}
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# xDebug (termporary):
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
# Copy xdebug configuration for remote debugging
|
|
||||||
COPY ./xdebug3.ini /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# Laradock Aliases
|
# Laradock Aliases
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
xdebug.mode=debug
|
|
||||||
xdebug.client_host=172.18.0.1
|
|
||||||
xdebug.start_with_request=yes
|
|
@ -1,2 +1,3 @@
|
|||||||
xdebug.mode=debug
|
xdebug.mode=debug
|
||||||
|
xdebug.client_host=dockerhost
|
||||||
xdebug.start_with_request=yes
|
xdebug.start_with_request=yes
|
||||||
|
Reference in New Issue
Block a user