From db4f5eca5ff3f52c1c2f4c0d9f06a9f2c6acc8ce Mon Sep 17 00:00:00 2001 From: Raine Date: Fri, 20 Oct 2023 02:43:56 +0200 Subject: [PATCH] fix: various minor bugs --- servers/skel/docker-compose.d/custom/nginx/Dockerfile | 3 ++- .../skel/docker-compose.d/custom/nginx/conf.d/default.conf | 2 ++ servers/skel/docker-compose.d/custom/nginx/entrypoint.sh | 6 +++--- tools/repo/setup-server-folder.sh | 3 ++- tools/setup/05-install-packages.sh | 3 ++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/servers/skel/docker-compose.d/custom/nginx/Dockerfile b/servers/skel/docker-compose.d/custom/nginx/Dockerfile index 4e819e7..499e182 100644 --- a/servers/skel/docker-compose.d/custom/nginx/Dockerfile +++ b/servers/skel/docker-compose.d/custom/nginx/Dockerfile @@ -9,4 +9,5 @@ COPY conf.d /etc/nginx COPY nginx.conf /etc/nginx/nginx.conf COPY entrypoint.sh /entrypoint -ENTRYPOINT [ "sh", "/entrypoint" ] \ No newline at end of file +ENTRYPOINT [ "sh", "/entrypoint" ] +CMD [ "nginx", "-g", "daemon off;" ] \ No newline at end of file diff --git a/servers/skel/docker-compose.d/custom/nginx/conf.d/default.conf b/servers/skel/docker-compose.d/custom/nginx/conf.d/default.conf index e58e934..6634d60 100644 --- a/servers/skel/docker-compose.d/custom/nginx/conf.d/default.conf +++ b/servers/skel/docker-compose.d/custom/nginx/conf.d/default.conf @@ -18,6 +18,8 @@ server { listen 443 ssl; server_name localhost; + # SSL will be managed by certbot, no need to insert SSL config. + location / { proxy_pass http://$host$request_uri; } diff --git a/servers/skel/docker-compose.d/custom/nginx/entrypoint.sh b/servers/skel/docker-compose.d/custom/nginx/entrypoint.sh index 98f43ec..d8ec00a 100644 --- a/servers/skel/docker-compose.d/custom/nginx/entrypoint.sh +++ b/servers/skel/docker-compose.d/custom/nginx/entrypoint.sh @@ -3,6 +3,7 @@ trap exit TERM if [ -n "${CERTBOT_DOMAINS}" ]; then + sleep 5 echo "registering domains..." certbot --nginx -n --agree-tos \ @@ -12,11 +13,10 @@ if [ -n "${CERTBOT_DOMAINS}" ]; then while :; do echo "renewing domains..." certbot --nginx -n renew - nginx -s reload sleep 12h & wait $! done & else echo "skipping certbot due to no domains!" -fi +fi & -exec nginx -g "daemon off;" \ No newline at end of file +exec "$@" \ No newline at end of file diff --git a/tools/repo/setup-server-folder.sh b/tools/repo/setup-server-folder.sh index b218894..b2de0de 100644 --- a/tools/repo/setup-server-folder.sh +++ b/tools/repo/setup-server-folder.sh @@ -3,5 +3,6 @@ if ! [ -d "servers/${1:-$HOSTNAME}" ]; then echo "setting up servers/${1:-$HOSTNAME}..." cp -r servers/skel/. servers/${1:-$HOSTNAME} + sed -i "s/localhost/${1:-$HOSTNAME}.ixvd.net/g" servers/${1:-$HOSTNAME}/docker-compose.d/custom/nginx/conf.d/default.conf echo "server configuration for \`${1:-$HOSTNAME}\`." >servers/${1:-$HOSTNAME}/README.md -fi +fi \ No newline at end of file diff --git a/tools/setup/05-install-packages.sh b/tools/setup/05-install-packages.sh index 1f8885a..a265852 100644 --- a/tools/setup/05-install-packages.sh +++ b/tools/setup/05-install-packages.sh @@ -7,5 +7,6 @@ if grep -q "debian" /etc/os-release; then cifs-utils \ restic \ docker.io \ - docker-compose + docker-compose \ + apparmor fi \ No newline at end of file