diff --git a/docker/apache/Dockerfile b/docker/apache/Dockerfile index d4979f7..14c3d02 100644 --- a/docker/apache/Dockerfile +++ b/docker/apache/Dockerfile @@ -41,14 +41,11 @@ RUN usermod -u ${USER_ID} www-data && groupmod -g ${GROUP_ID} www-data RUN mkdir -p /var/www/.composer/cache /var/www/.npm && \ chown -R www-data:www-data /var/www/.composer /var/www/.npm -# Copy supervisord config -COPY docker/apache/supervisord/supervisord.conf /etc/supervisor/supervisord.conf - # Copy supervisord program configs -COPY docker/apache/supervisord/conf.d/apache2.conf /etc/supervisor/conf.d/apache2.conf +COPY docker/supervisord/conf.d/apache2.conf /etc/supervisor/conf.d/apache2.conf # Copy queue worker config uncommented for use with yii2-queue -#COPY docker/apache/supervisord/conf.d/queue.conf /etc/supervisor/conf.d/queue.conf +#COPY docker/supervisord/conf.d/queue.conf /etc/supervisor/conf.d/queue.conf # Copy scripts COPY docker/init.sh /usr/local/bin/init.sh diff --git a/docker/apache/supervisord/conf.d/queue.conf b/docker/apache/supervisord/conf.d/queue.conf deleted file mode 100644 index 5ee7012..0000000 --- a/docker/apache/supervisord/conf.d/queue.conf +++ /dev/null @@ -1,9 +0,0 @@ -[program:yii-queue-worker] -process_name=%(program_name)s_%(process_num)02d -command=/usr/local/bin/php /app/yii queue/listen --verbose=1 --color=0 -autostart=true -autorestart=true -user=www-data -numprocs=4 -redirect_stderr=true -stdout_logfile=/app/docker/apache/supervisord/log/yii-queue-worker.log diff --git a/docker/apache/supervisord/log/.gitignore b/docker/apache/supervisord/log/.gitignore deleted file mode 100644 index c96a04f..0000000 --- a/docker/apache/supervisord/log/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/docker/apache/supervisord/supervisord.conf b/docker/apache/supervisord/supervisord.conf deleted file mode 100644 index f2bbee4..0000000 --- a/docker/apache/supervisord/supervisord.conf +++ /dev/null @@ -1,14 +0,0 @@ -[supervisord] -logfile = /proc/self/fd/1 -logfile_maxbytes = 0 -loglevel = info -pidfile = /var/run/supervisord.pid -nodaemon = true -user = root -silent = true - -[include] -files = /etc/supervisor/conf.d/*.conf - -[supervisorctl] -serverurl = unix:///var/run/supervisor.sock diff --git a/docker/frankenphp/Dockerfile b/docker/frankenphp/Dockerfile index 8a59f2b..e2fd102 100644 --- a/docker/frankenphp/Dockerfile +++ b/docker/frankenphp/Dockerfile @@ -51,14 +51,11 @@ RUN usermod -u ${USER_ID} www-data && groupmod -g ${GROUP_ID} www-data RUN mkdir -p /var/www/.composer/cache /var/www/.npm && \ chown -R www-data:www-data /var/www/.composer /var/www/.npm -# Copy supervisord config -COPY docker/frankenphp/supervisord/supervisord.conf /etc/supervisor/supervisord.conf - # Copy supervisord program configs -COPY docker/frankenphp/supervisord/conf.d/frankenphp.conf /etc/supervisor/conf.d/frankenphp.conf +COPY docker/supervisord/conf.d/frankenphp.conf /etc/supervisor/conf.d/frankenphp.conf # Copy queue worker config uncommented for use with yii2-queue -#COPY docker/frankenphp/supervisord/conf.d/queue.conf /etc/supervisor/conf.d/queue.conf +#COPY docker/supervisord/conf.d/queue.conf /etc/supervisor/conf.d/queue.conf # Copy scripts COPY docker/init.sh /usr/local/bin/init.sh diff --git a/docker/frankenphp/supervisord/log/.gitignore b/docker/frankenphp/supervisord/log/.gitignore deleted file mode 100644 index c96a04f..0000000 --- a/docker/frankenphp/supervisord/log/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/docker/frankenphp/supervisord/supervisord.conf b/docker/frankenphp/supervisord/supervisord.conf deleted file mode 100644 index 694dd21..0000000 --- a/docker/frankenphp/supervisord/supervisord.conf +++ /dev/null @@ -1,15 +0,0 @@ -[supervisord] -nodaemon=true -logfile=/dev/stdout -logfile_maxbytes=0 -pidfile=/var/run/supervisord.pid - -[include] -files = /etc/supervisor/conf.d/*.conf - -[supervisorctl] -serverurl=unix:///var/run/supervisor.sock - -[unix_http_server] -file=/var/run/supervisor.sock -chmod=0700 diff --git a/docker/init.sh b/docker/init.sh index b51c625..743ba97 100644 --- a/docker/init.sh +++ b/docker/init.sh @@ -84,6 +84,17 @@ if [ -f "/app/composer.json" ] && [ ! -d "/app/vendor" ]; then echo -e "${GREEN}✓ Composer dependencies installed successfully${NC}" fi +# Copy supervisord configuration +echo -e "${YELLOW}Configuring supervisord...${NC}" + +if [ -f "/app/docker/supervisord/supervisord.conf" ]; then + cp /app/docker/supervisord/supervisord.conf /etc/supervisor/supervisord.conf + echo -e "${GREEN}✓ Supervisord configuration copied successfully${NC}" +else + echo -e "${RED}✗ Error: Supervisord configuration file not found${NC}" + exit 1 +fi + echo -e "${GREEN}Starting supervisord...${NC}" # Start supervisord diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile index 03bf54f..01a449d 100644 --- a/docker/nginx/Dockerfile +++ b/docker/nginx/Dockerfile @@ -36,15 +36,12 @@ RUN usermod -u ${USER_ID} www-data && groupmod -g ${GROUP_ID} www-data RUN mkdir -p /var/www/.composer/cache /var/www/.npm && \ chown -R www-data:www-data /var/www/.composer /var/www/.npm -# Copy supervisord config -COPY docker/nginx/supervisord/supervisord.conf /etc/supervisor/supervisord.conf - # Copy supervisord program configs -COPY docker/nginx/supervisord/conf.d/nginx.conf /etc/supervisor/conf.d/nginx.conf -COPY docker/nginx/supervisord/conf.d/php-fpm.conf /etc/supervisor/conf.d/php-fpm.conf +COPY docker/supervisord/conf.d/nginx.conf /etc/supervisor/conf.d/nginx.conf +COPY docker/supervisord/conf.d/php-fpm.conf /etc/supervisor/conf.d/php-fpm.conf # Copy queue worker config uncommented for use with yii2-queue -#COPY docker/nginx/supervisord/conf.d/queue.conf /etc/supervisor/conf.d/queue.conf +#COPY docker/supervisord/conf.d/queue.conf /etc/supervisor/conf.d/queue.conf # Copy scripts COPY docker/init.sh /usr/local/bin/init.sh diff --git a/docker/nginx/supervisord/conf.d/queue.conf b/docker/nginx/supervisord/conf.d/queue.conf deleted file mode 100644 index b27b6bb..0000000 --- a/docker/nginx/supervisord/conf.d/queue.conf +++ /dev/null @@ -1,14 +0,0 @@ -[program:yii-queue-worker] -process_name=%(program_name)s_%(process_num)02d -command=/usr/local/bin/php /app/yii queue/listen --verbose=1 --color=0 -autorestart=true -autostart=true -killasgroup=true -numprocs=4 -redirect_stderr=true -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stopasgroup=true -user=www-data diff --git a/docker/nginx/supervisord/log/.gitignore b/docker/nginx/supervisord/log/.gitignore deleted file mode 100644 index c96a04f..0000000 --- a/docker/nginx/supervisord/log/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/docker/apache/supervisord/conf.d/apache2.conf b/docker/supervisord/conf.d/apache2.conf similarity index 50% rename from docker/apache/supervisord/conf.d/apache2.conf rename to docker/supervisord/conf.d/apache2.conf index 0d42f1e..780bf67 100644 --- a/docker/apache/supervisord/conf.d/apache2.conf +++ b/docker/supervisord/conf.d/apache2.conf @@ -1,4 +1,8 @@ [program:apache2] command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND" +autorestart=true autostart=true -autorestart=true \ No newline at end of file +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 diff --git a/docker/frankenphp/supervisord/conf.d/frankenphp.conf b/docker/supervisord/conf.d/frankenphp.conf similarity index 100% rename from docker/frankenphp/supervisord/conf.d/frankenphp.conf rename to docker/supervisord/conf.d/frankenphp.conf diff --git a/docker/nginx/supervisord/conf.d/nginx.conf b/docker/supervisord/conf.d/nginx.conf similarity index 100% rename from docker/nginx/supervisord/conf.d/nginx.conf rename to docker/supervisord/conf.d/nginx.conf diff --git a/docker/nginx/supervisord/conf.d/php-fpm.conf b/docker/supervisord/conf.d/php-fpm.conf similarity index 100% rename from docker/nginx/supervisord/conf.d/php-fpm.conf rename to docker/supervisord/conf.d/php-fpm.conf diff --git a/docker/frankenphp/supervisord/conf.d/queue.conf b/docker/supervisord/conf.d/queue.conf similarity index 84% rename from docker/frankenphp/supervisord/conf.d/queue.conf rename to docker/supervisord/conf.d/queue.conf index b27b6bb..b8eba53 100644 --- a/docker/frankenphp/supervisord/conf.d/queue.conf +++ b/docker/supervisord/conf.d/queue.conf @@ -3,12 +3,9 @@ process_name=%(program_name)s_%(process_num)02d command=/usr/local/bin/php /app/yii queue/listen --verbose=1 --color=0 autorestart=true autostart=true -killasgroup=true numprocs=4 -redirect_stderr=true stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 -stopasgroup=true user=www-data diff --git a/docker/nginx/supervisord/supervisord.conf b/docker/supervisord/supervisord.conf similarity index 100% rename from docker/nginx/supervisord/supervisord.conf rename to docker/supervisord/supervisord.conf index f2bbee4..d209121 100644 --- a/docker/nginx/supervisord/supervisord.conf +++ b/docker/supervisord/supervisord.conf @@ -2,10 +2,10 @@ logfile = /proc/self/fd/1 logfile_maxbytes = 0 loglevel = info -pidfile = /var/run/supervisord.pid nodaemon = true -user = root +pidfile = /var/run/supervisord.pid silent = true +user = root [include] files = /etc/supervisor/conf.d/*.conf