Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio committed Mar 25, 2024
1 parent e7ab479 commit 4455a6f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 26 deletions.
23 changes: 5 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -59,31 +57,24 @@ 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:
- platform
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:
Expand All @@ -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:
Expand Down
22 changes: 17 additions & 5 deletions docker/start.sh
Original file line number Diff line number Diff line change
@@ -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)}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions docker/supervisor/supervisord.conf
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 4455a6f

Please sign in to comment.