feat(nginx): Use builtin envsubst mechanics of nginx container
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2541>
This commit is contained in:
parent
d714c721b4
commit
1808cf6cf7
|
@ -0,0 +1 @@
|
||||||
|
Merge nginx configs for docker production and development setups (#1939)
|
4
dev.yml
4
dev.yml
|
@ -115,7 +115,6 @@ services:
|
||||||
- "node3.funkwhale.test:172.17.0.1"
|
- "node3.funkwhale.test:172.17.0.1"
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
command: /entrypoint.sh
|
|
||||||
env_file:
|
env_file:
|
||||||
- .env.dev
|
- .env.dev
|
||||||
- .env
|
- .env
|
||||||
|
@ -134,8 +133,7 @@ services:
|
||||||
- api
|
- api
|
||||||
- front
|
- front
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker/nginx/conf.dev:/etc/nginx/nginx.conf.template:ro
|
- ./docker/nginx/conf.dev:/etc/nginx/templates/default.conf.template:ro
|
||||||
- ./docker/nginx/entrypoint.sh:/entrypoint.sh:ro
|
|
||||||
- "${MUSIC_DIRECTORY_SERVE_PATH-./data/music}:/music:ro"
|
- "${MUSIC_DIRECTORY_SERVE_PATH-./data/music}:/music:ro"
|
||||||
- ./deploy/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro
|
- ./deploy/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro
|
||||||
- "./front:/frontend:ro"
|
- "./front:/frontend:ro"
|
||||||
|
|
|
@ -1,43 +1,17 @@
|
||||||
user nginx;
|
upstream funkwhale-api {
|
||||||
worker_processes 1;
|
server ${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT};
|
||||||
|
}
|
||||||
error_log /var/log/nginx/error.log warn;
|
upstream funkwhale-front {
|
||||||
pid /var/run/nginx.pid;
|
server ${FUNKWHALE_FRONT_IP}:${FUNKWHALE_FRONT_PORT};
|
||||||
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Required for websocket support.
|
||||||
http {
|
map $http_upgrade $connection_upgrade {
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
||||||
'$status $body_bytes_sent "$http_referer" '
|
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
||||||
|
|
||||||
access_log /var/log/nginx/access.log main;
|
|
||||||
|
|
||||||
sendfile on;
|
|
||||||
|
|
||||||
keepalive_timeout 65;
|
|
||||||
|
|
||||||
upstream funkwhale-api {
|
|
||||||
server ${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT};
|
|
||||||
}
|
|
||||||
upstream funkwhale-front {
|
|
||||||
server ${FUNKWHALE_FRONT_IP}:${FUNKWHALE_FRONT_PORT};
|
|
||||||
}
|
|
||||||
|
|
||||||
# Required for websocket support.
|
|
||||||
map $http_upgrade $connection_upgrade {
|
|
||||||
default upgrade;
|
default upgrade;
|
||||||
'' close;
|
'' close;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
charset utf-8;
|
charset utf-8;
|
||||||
|
@ -163,5 +137,4 @@ http {
|
||||||
alias /staticfiles/;
|
alias /staticfiles/;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eux
|
|
||||||
|
|
||||||
TEMPLATE_PATH="/etc/nginx/nginx.conf.template"
|
|
||||||
CONFIG_PATH="/etc/nginx/nginx.conf"
|
|
||||||
|
|
||||||
ALLOWED_VARS="$(env | cut -d '=' -f 1 | xargs printf "\${%s} ")"
|
|
||||||
envsubst "$ALLOWED_VARS" < "$TEMPLATE_PATH" | tee "$CONFIG_PATH"
|
|
||||||
|
|
||||||
nginx-debug -g 'daemon off;'
|
|
Loading…
Reference in New Issue