Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from djocker/php7
Browse files Browse the repository at this point in the history
Php7, replace sudo with runuser
  • Loading branch information
sergeycherepanov authored Jan 3, 2017
2 parents 1dbedc2 + 02771e6 commit d3e304c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
19 changes: 10 additions & 9 deletions bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ 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"
composer-map-env.php ${APP_ROOT}/composer.json

# 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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion conf/nginx-bap.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions conf/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d3e304c

Please sign in to comment.