Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ports to be configured via environment variables #199

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ Passbolt docker image provides several environment variables to configure differ
| PASSBOLT_REGISTRATION_PUBLIC | Defines if users can register | false
| PASSBOLT_SSL_FORCE | Redirects http to https | true
| PASSBOLT_SECURITY_SET_HEADERS | Send CSP Headers | true
| PASSBOLT_WWW_PORT | Nginx HTTP port | 80
| PASSBOLT_WWW_SSL_PORT | Nginx HTTPS port | 443
| PASSBOLT_PHP_FPM_PORT | PHP-FPM port | 9000
| SECURITY_SALT | CakePHP security salt | __SALT__

For more env variables supported please check [default.php](https://github.com/passbolt/passbolt_api/blob/master/config/default.php)
Expand Down
19 changes: 19 additions & 0 deletions dev/bin/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,23 @@ fi

install

## replace nginx config
PASSBOLT_WWW_PORT="${PASSBOLT_WWW_PORT:-80}"
PASSBOLT_WWW_SSL_PORT="${PASSBOLT_WWW_SSL_PORT:-443}"
NGINX_SOURCEFILE=/etc/nginx/conf.d/default.conf
sed -i 's/listen[ \t]*80[^0-9]*$/listen 80; #www/g' "$NGINX_SOURCEFILE"
sed -i 's/listen[ \t]*443[^0-9]*$/listen 443; #ssl/g' "$NGINX_SOURCEFILE"
sed -i 's/listen.*#www$/listen '"$PASSBOLT_WWW_PORT"'; #www/g' "$NGINX_SOURCEFILE"
sed -i 's/listen.*#ssl$/listen '"$PASSBOLT_WWW_SSL_PORT"'; #ssl/g' "$NGINX_SOURCEFILE"
echo "ready - changed port from 80 to $PASSBOLT_WWW_PORT"
echo "ready - changed port from 443 to $PASSBOLT_WWW_SSL_PORT"

## replace php-fpm config
PASSBOLT_PHP_FPM_PORT="${PASSBOLT_PHP_FPM_PORT:-9000}"
PHPFPM_SOURCEFILE=/usr/local/etc/php-fpm.d/
for i in ${PHPFPM_SOURCEFILE}/*; do sed -i 's/listen .*$/listen = 127.0.0.1:'"$PASSBOLT_PHP_FPM_PORT"'/g' "$i"; done
sed -i 's/fastcgi_pass.*$/fastcgi_pass 127.0.0.1:'"$PASSBOLT_PHP_FPM_PORT"';/g' "$NGINX_SOURCEFILE"
echo "ready - changed php-fpm port from 9000 to $PASSBOLT_WWW_PORT"
## //

exec /usr/bin/supervisord -n