From 4455a6f1c1d0295d51c56f1c54d51c69c513717d Mon Sep 17 00:00:00 2001 From: Leonardo Custodio Date: Mon, 25 Mar 2024 14:05:53 -0300 Subject: [PATCH] changes --- docker-compose.yml | 23 +++++------------------ docker/start.sh | 22 +++++++++++++++++----- docker/supervisor/supervisord.conf | 5 ++--- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0535d13..55e592c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -40,14 +40,12 @@ services: - "${DECODER_EXTERNAL_PORT}:8090" app: - image: enjin/platform:latest + image: enjin/platform:local build: context: . restart: unless-stopped environment: CONTAINER_ROLE: app - WWWUSER: '${WWWUSER}' - WWWGROUP: '${WWWGROUP}' volumes: - '.:/var/www/html' networks: @@ -59,14 +57,10 @@ services: - redis ingest: - image: enjin/platform:latest - build: - context: . + image: enjin/platform:local restart: unless-stopped environment: CONTAINER_ROLE: ingest - WWWUSER: '${WWWUSER}' - WWWGROUP: '${WWWGROUP}' volumes: - '.:/var/www/html' networks: @@ -74,16 +68,13 @@ services: depends_on: - database - redis + - app websocket: - image: enjin/platform:latest - build: - context: . + image: enjin/platform:local restart: unless-stopped environment: CONTAINER_ROLE: websocket - WWWUSER: '${WWWUSER}' - WWWGROUP: '${WWWGROUP}' volumes: - '.:/var/www/html' networks: @@ -95,14 +86,10 @@ services: - redis beam: - image: enjin/platform:latest - build: - context: . + image: enjin/platform:local restart: unless-stopped environment: CONTAINER_ROLE: beam - WWWUSER: '${WWWUSER}' - WWWGROUP: '${WWWGROUP}' volumes: - '.:/var/www/html' networks: diff --git a/docker/start.sh b/docker/start.sh index 8617a53..19d0821 100755 --- a/docker/start.sh +++ b/docker/start.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -set -e +set -o allexport +source .env set ++o allexport export WWWUSER=${WWWUSER:-$UID} export WWWGROUP=${WWWGROUP:-$(id -g)} @@ -8,6 +10,13 @@ export DB_HOST=${DOCKER_DB_HOST:-database} export REDIS_HOST=${DOCKER_REDIS_HOST:-redis} export DECODER_CONTAINER=${DECODER_CONTAINER:-"decoder:8090"} +echo $WWWUSER +echo $WWWGROUP +echo $ROLE +echo $DB_HOST +echo $REDIS_HOST +echo $DECODER_CONTAINER + if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER www-data groupmod -g $WWWGROUP www-data @@ -47,14 +56,17 @@ if [ "$ROLE" = "app" ]; then exec apache2-foreground elif [ "$ROLE" = "ingest" ]; then echo "Running platform ingest..." - php artisan migrate && php artisan platform:sync && php artisan platform:ingest + gosu www-data:www-data php artisan migrate + gosu www-data:www-data php artisan platform:sync + gosu www-data:www-data php artisan platform:ingest elif [ "$ROLE" = "websocket" ]; then echo "Running queue and websocket..." - supervisord && supervisorctl start horizon - php artisan websockets:serve + supervisord -c /etc/supervisor/supervisord.conf + supervisorctl start horizon + gosu www-data:www-data php artisan websockets:serve elif [ "$ROLE" = "beam" ]; then echo "Running beams..." - php artisan platform:process-beam-claims + gosu www-data:www-data php artisan platform:process-beam-claims else echo "Could not match the container role \"$ROLE\"" exit 1 diff --git a/docker/supervisor/supervisord.conf b/docker/supervisor/supervisord.conf index 5fd81bc..83d475c 100644 --- a/docker/supervisor/supervisord.conf +++ b/docker/supervisor/supervisord.conf @@ -1,15 +1,14 @@ ; supervisor config file - [unix_http_server] file=/tmp/supervisor.sock ; (the path to the socket file) chmod=0700 ; sockef file mode (default 0700) [supervisord] +nodaemon=true +user=root logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) -user=www-data -chown=www-data:www-data ; the below section must remain in the config file for RPC ; (supervisorctl/web interface) to work, additional interfaces may be