From cb373a658bb05243fa02785e5b814044310d5d32 Mon Sep 17 00:00:00 2001 From: SergeyCherepanov Date: Tue, 3 Jan 2017 16:08:13 +0400 Subject: [PATCH 1/2] php7 support --- README.md | 2 +- bin/run.sh | 19 ++++++++++--------- conf/nginx-bap.conf | 2 +- conf/supervisord.conf | 4 ++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 71f4f01..33200a0 100644 --- a/README.md +++ b/README.md @@ -29,5 +29,5 @@ For local usage [see](./local/README.md). `CMD_INIT_BEFORE` - Command will be executed before initialization (or installation) `CMD_INIT_CLEAN` - Command will be used if application not installed (here you can initiate installation via cli) -`CMD_INIT_INSTALLED` - Command will be used for initialization of already installed application for example: `sudo -u www-data /var/www/app/console --env=prod oro:platform:update --force` +`CMD_INIT_INSTALLED` - Command will be used for initialization of already installed application for example: `runuser -s /bin/sh -c "/var/www/app/console --env=prod oro:platform:update --force" www-data` `CMD_INIT_AFTER` - Command will be executed after initialization (or installation) diff --git a/bin/run.sh b/bin/run.sh index 0e92914..e1529da 100644 --- a/bin/run.sh +++ b/bin/run.sh @@ -17,13 +17,13 @@ fi if [[ -z ${IS_LOCAL} ]]; then # Prepare folders for persistent data info "Verify directory ${DATA_ROOT}/cache" - [[ -d ${DATA_ROOT}/cache ]] || sudo -u www-data mkdir -p ${DATA_ROOT}/cache + [[ -d ${DATA_ROOT}/cache ]] || runuser -s /bin/sh -c "mkdir -p ${DATA_ROOT}/cache" www-data info "Verify directory ${DATA_ROOT}/media" - [[ -d ${DATA_ROOT}/media ]] || sudo -u www-data mkdir -p ${DATA_ROOT}/media + [[ -d ${DATA_ROOT}/media ]] || runuser -s /bin/sh -c "mkdir -p ${DATA_ROOT}/media" www-data info "Verify directory ${DATA_ROOT}/uploads" - [[ -d ${DATA_ROOT}/uploads ]] || sudo -u www-data mkdir -p ${DATA_ROOT}/uploads + [[ -d ${DATA_ROOT}/uploads ]] || runuser -s /bin/sh -c "mkdir -p ${DATA_ROOT}/uploads" www-data info "Verify directory ${DATA_ROOT}/attachment" - [[ -d ${DATA_ROOT}/attachment ]] || sudo -u www-data mkdir -p ${DATA_ROOT}/attachment + [[ -d ${DATA_ROOT}/attachment ]] || runuser -s /bin/sh -c "mkdir -p ${DATA_ROOT}/attachment" www-data # Map environment variables info "Map parameters.yml to environment variables" @@ -31,7 +31,7 @@ if [[ -z ${IS_LOCAL} ]]; then # Generate parameters.yml info "Run composer script 'post-install-cmd'" - sudo -H -u www-data -E composer --no-interaction run-script post-install-cmd -n -d ${APP_ROOT}; + runuser -s /bin/sh -c "composer --no-interaction run-script post-install-cmd -n -d ${APP_ROOT}" www-data # Clean exists folders [[ -d ${APP_ROOT}/app/cache ]] && rm -r ${APP_ROOT}/app/cache @@ -41,10 +41,11 @@ if [[ -z ${IS_LOCAL} ]]; then # Linking persistent data info "Linking persistent data folders to volumes" - sudo -u www-data ln -s ${DATA_ROOT}/cache ${APP_ROOT}/app/cache - sudo -u www-data ln -s ${DATA_ROOT}/media ${APP_ROOT}/web/media - sudo -u www-data ln -s ${DATA_ROOT}/uploads ${APP_ROOT}/web/uploads - sudo -u www-data ln -s ${DATA_ROOT}/attachment ${APP_ROOT}/app/attachment + + runuser -s /bin/sh -c "ln -s ${DATA_ROOT}/cache ${APP_ROOT}/app/cache" www-data + runuser -s /bin/sh -c "ln -s ${DATA_ROOT}/media ${APP_ROOT}/web/media" www-data + runuser -s /bin/sh -c "ln -s ${DATA_ROOT}/uploads ${APP_ROOT}/web/uploads" www-data + runuser -s /bin/sh -c "ln -s ${DATA_ROOT}/attachment ${APP_ROOT}/app/attachment" www-data fi info "Checking if application is already installed" diff --git a/conf/nginx-bap.conf b/conf/nginx-bap.conf index 4f91fc4..90251de 100644 --- a/conf/nginx-bap.conf +++ b/conf/nginx-bap.conf @@ -34,7 +34,7 @@ server { if (!-f $document_root$fastcgi_script_name) { return 404; } - fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index app.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; diff --git a/conf/supervisord.conf b/conf/supervisord.conf index 0d2ba68..82f8862 100644 --- a/conf/supervisord.conf +++ b/conf/supervisord.conf @@ -22,8 +22,8 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [supervisorctl] serverurl=http://127.0.0.1:9001 ; use a unix:// URL for a unix socket -[program:php5-fpm] -command=/usr/sbin/php-fpm5.6 -c /etc/php/5.6/fpm +[program:php-fpm] +command=/usr/sbin/php-fpm -c /etc/php/7.0/fpm stdout_events_enabled=true stderr_events_enabled=true stdout_logfile=/dev/stdout From 02771e622a2ebbc136af0e31696a21c760641b2e Mon Sep 17 00:00:00 2001 From: SergeyCherepanov Date: Tue, 3 Jan 2017 16:56:44 +0400 Subject: [PATCH 2/2] fix orobase version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index dce6b7a..11f3c9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM djocker/orobase +FROM djocker/orobase:1.2 COPY bin/run.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/run.sh