Skip to content

Commit 2852b2f

Browse files
author
Sameer Naik
committed
added NGINX_ENABLED parameter to disable the Nginx server
Closes #148
1 parent f1debf6 commit 2852b2f

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- expose `REDMINE_SECRET_TOKEN` parameter
1313
- expose `REDMINE_SUDO_MODE_ENABLED` and `REDMINE_SUDO_MODE_TIMEOUT` parameters
1414
- expose `REDMINE_CONCURRENT_UPLOADS` parameter
15+
- added `NGINX_ENABLED` parameter to disable the Nginx server
1516

1617
**3.2.0**
1718
- redmine: upgrade to v.3.2.0

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ Below is the complete list of parameters that can be set using environment varia
577577
- **DB_USER**: The database user. Defaults to `root`
578578
- **DB_PASS**: The database password. Defaults to no password
579579
- **DB_POOL**: The database connection pool count. Defaults to `5`.
580+
- **NGINX_ENABLED**: Enable/disable the nginx server. Disabling Nginx is not recommended (see #148), use at your discretion. Defaults to `true`. When disabled publish port `8080` instead of the usual port `80` or `443`.
580581
- **NGINX_WORKERS**: The number of nginx workers to start. Defaults to `1`.
581582
- **NGINX_MAX_UPLOAD_SIZE**: Maximum acceptable upload size. Defaults to `20m`.
582583
- **NGINX_X_FORWARDED_PROTO**: Advanced configuration option for the `proxy_set_header X-Forwarded-Proto` setting in the redmine nginx vHost configuration. Defaults to `https` when `REDMINE_HTTPS` is `true`, else defaults to `$scheme`.

assets/build/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ priority=20
147147
directory=/tmp
148148
command=/usr/sbin/nginx -g "daemon off;"
149149
user=root
150-
autostart=true
150+
autostart={{NGINX_ENABLED}}
151151
autorestart=true
152152
stdout_logfile=${REDMINE_LOG_DIR}/supervisor/%(program_name)s.log
153153
stderr_logfile=${REDMINE_LOG_DIR}/supervisor/%(program_name)s.log

assets/runtime/env-defaults

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ INCOMING_EMAIL_PRIVATE=${INCOMING_EMAIL_PRIVATE:-}
9898
INCOMING_EMAIL_ALLOW_OVERRIDE=${INCOMING_EMAIL_ALLOW_OVERRIDE:-}
9999

100100
## NGINX
101+
NGINX_ENABLED=${NGINX_ENABLED:-true}
101102
NGINX_WORKERS=${NGINX_WORKERS:-1}
102103
NGINX_MAX_UPLOAD_SIZE=${NGINX_MAX_UPLOAD_SIZE:-20m}
103104

assets/runtime/functions

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ redmine_configure_unicorn() {
220220
exec_as_redmine sed -i '/{{REDMINE_RELATIVE_URL_ROOT}}/d' ${REDMINE_UNICORN_CONFIG}
221221
fi
222222

223+
if [[ ${NGINX_ENABLED} != true ]]; then
224+
# nginx has been disabled, configure unicorn to listen on all interfaces
225+
exec_as_redmine sed -i "s|127.0.0.1:8080|0.0.0.0:8080|" ${REDMINE_UNICORN_CONFIG}
226+
fi
227+
223228
update_template ${REDMINE_UNICORN_CONFIG} \
224229
REDMINE_INSTALL_DIR \
225230
REDMINE_USER \
@@ -582,9 +587,14 @@ configure_redmine() {
582587
}
583588

584589
configure_nginx() {
585-
echo "Configuring nginx..."
586-
sed -i "s|worker_processes .*|worker_processes ${NGINX_WORKERS};|" /etc/nginx/nginx.conf
587-
nginx_configure_redmine
590+
if [[ ${NGINX_ENABLED} == true ]]; then
591+
echo "Configuring nginx..."
592+
sed -i "s|worker_processes .*|worker_processes ${NGINX_WORKERS};|" /etc/nginx/nginx.conf
593+
nginx_configure_redmine
594+
else
595+
echo "Nginx has been disabled..."
596+
fi
597+
update_template /etc/supervisor/conf.d/nginx.conf NGINX_ENABLED
588598
}
589599

590600
migrate_database() {

0 commit comments

Comments
 (0)