From 83a548ca8ff6402a1db9a6c957e05055e89685a4 Mon Sep 17 00:00:00 2001 From: Raine Date: Fri, 29 Mar 2024 16:45:06 +0100 Subject: [PATCH] feat: nebulosus tmp solution Signed-off-by: Raine --- .idea/.gitignore | 8 +++++ .idea/misc.xml | 10 ++++++ .idea/modules.xml | 8 +++++ .idea/neb.iml | 9 +++++ .idea/vcs.xml | 6 ++++ .woodpecker/images.yml | 6 ++++ images/nginx/Dockerfile | 16 +++++++++ images/nginx/conf.d/default.conf | 17 +++++++++ images/nginx/content/index.html | 24 +++++++++++++ images/nginx/entrypoint.sh | 28 +++++++++++++++ .../custom/nginx/conf.d/nebulosus.conf | 8 +++++ .../docker-compose.nebulosus.yml | 8 +++++ .../docker-compose.d/docker-compose.yml | 4 +-- .../docker-compose.d/custom/nginx/Dockerfile | 13 ------- .../custom/nginx/conf.d/default.conf | 21 ----------- .../custom/nginx/content/index.html | 26 -------------- .../custom/nginx/entrypoint.sh | 28 --------------- .../docker-compose.d/custom/nginx/nginx.conf | 35 ------------------- .../skel/docker-compose.d/docker-compose.yml | 3 +- skel/etc/ixvd/skel-sum.txt | 2 +- 20 files changed, 153 insertions(+), 127 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/neb.iml create mode 100644 .idea/vcs.xml create mode 100644 .woodpecker/images.yml create mode 100644 images/nginx/Dockerfile create mode 100644 images/nginx/conf.d/default.conf create mode 100644 images/nginx/content/index.html create mode 100755 images/nginx/entrypoint.sh create mode 100644 servers/keymaker/docker-compose.d/custom/nginx/conf.d/nebulosus.conf create mode 100644 servers/keymaker/docker-compose.d/docker-compose.nebulosus.yml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..947ef84 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..391a425 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/neb.iml b/.idea/neb.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/neb.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.woodpecker/images.yml b/.woodpecker/images.yml new file mode 100644 index 0000000..91a691f --- /dev/null +++ b/.woodpecker/images.yml @@ -0,0 +1,6 @@ +when: + event: + - push + - manual + - tag + \ No newline at end of file diff --git a/images/nginx/Dockerfile b/images/nginx/Dockerfile new file mode 100644 index 0000000..3e3af88 --- /dev/null +++ b/images/nginx/Dockerfile @@ -0,0 +1,16 @@ +FROM nginx:alpine + +RUN apk add \ + certbot \ + certbot-nginx + +COPY content /usr/share/nginx/html +COPY conf.d/ /etc/nginx/conf.d/ +COPY nginx.conf /etc/nginx/nginx.conf + +VOLUME /etc/nginx/conf.d/ +VOLUME /usr/share/nginx/html/ + +COPY entrypoint.sh /entrypoint +ENTRYPOINT [ "sh", "/entrypoint" ] +CMD [ "nginx", "-g", "daemon off;" ] \ No newline at end of file diff --git a/images/nginx/conf.d/default.conf b/images/nginx/conf.d/default.conf new file mode 100644 index 0000000..3b5746c --- /dev/null +++ b/images/nginx/conf.d/default.conf @@ -0,0 +1,17 @@ +server { + listen 80; + server_name _; + + # SSL is managed by certbot, no need for a ssl listen; it will be generated automagically! + + # default html page + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/images/nginx/content/index.html b/images/nginx/content/index.html new file mode 100644 index 0000000..4a98c86 --- /dev/null +++ b/images/nginx/content/index.html @@ -0,0 +1,24 @@ + + + + + Welcome to nginx! + + + + +

Welcome to nginx!

+ This is the default page, so the admin was likely too lazy too remove it. + + + \ No newline at end of file diff --git a/images/nginx/entrypoint.sh b/images/nginx/entrypoint.sh new file mode 100755 index 0000000..b28582b --- /dev/null +++ b/images/nginx/entrypoint.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +trap exit TERM + +if [ -n "${CERTBOT_DOMAINS}" ]; then + echo "registering..." + if ! certbot show_account; then + certbot register -n \ + --agree-tos \ + -m "${CERTBOT_EMAIL}" + fi + + for d in $(echo "${CERTBOT_DOMAINS}" | sed 's/,/ /g'); do + echo "requesting for $d..." + certbot --nginx -n --keep -d "$d" + done + + while :; do + echo "renewing domains..." + certbot --nginx --keep -n renew + sleep 12h & + wait $! + done & +else + echo "skipping certbot due to no domains!" +fi & + +exec "$@" \ No newline at end of file diff --git a/servers/keymaker/docker-compose.d/custom/nginx/conf.d/nebulosus.conf b/servers/keymaker/docker-compose.d/custom/nginx/conf.d/nebulosus.conf new file mode 100644 index 0000000..de69d59 --- /dev/null +++ b/servers/keymaker/docker-compose.d/custom/nginx/conf.d/nebulosus.conf @@ -0,0 +1,8 @@ +server { + listen 80; + server_name nebulosus.nl; + + # SSL is managed by certbot, no need for a ssl listen; it will be generated automagically! + + proxy_pass http://site; +} diff --git a/servers/keymaker/docker-compose.d/docker-compose.nebulosus.yml b/servers/keymaker/docker-compose.d/docker-compose.nebulosus.yml new file mode 100644 index 0000000..1f69786 --- /dev/null +++ b/servers/keymaker/docker-compose.d/docker-compose.nebulosus.yml @@ -0,0 +1,8 @@ +version: '2.2' + + +services: + site: + image: git.ixvd.net/nebulosus/web + networks: + - proxy diff --git a/servers/keymaker/docker-compose.d/docker-compose.yml b/servers/keymaker/docker-compose.d/docker-compose.yml index 1518226..ea306c6 100644 --- a/servers/keymaker/docker-compose.d/docker-compose.yml +++ b/servers/keymaker/docker-compose.d/docker-compose.yml @@ -7,7 +7,7 @@ services: build: custom/nginx environment: CERTBOT_EMAIL: "webmaster@ixvd.net" - CERTBOT_DOMAINS: "keymaker.ixvd.net,ixvd.net,via.ixvd.net,cdn.ixvd.net,park.ixvd.net" + CERTBOT_DOMAINS: "keymaker.ixvd.net,ixvd.net,via.ixvd.net,cdn.ixvd.net,park.ixvd.net,nebulosus.nl" volumes: - /srv/certbot/data:/etc/letsencrypt - /srv/certbot/other/www:/var/www/certbot @@ -30,4 +30,4 @@ networks: external: true internal: external: true - \ No newline at end of file + diff --git a/servers/skel/docker-compose.d/custom/nginx/Dockerfile b/servers/skel/docker-compose.d/custom/nginx/Dockerfile index 6bb5b49..e69de29 100644 --- a/servers/skel/docker-compose.d/custom/nginx/Dockerfile +++ b/servers/skel/docker-compose.d/custom/nginx/Dockerfile @@ -1,13 +0,0 @@ -FROM nginx:alpine - -RUN apk add \ - certbot \ - certbot-nginx - -COPY content /usr/share/nginx/html -COPY conf.d/ /etc/nginx/conf.d/ -COPY nginx.conf /etc/nginx/nginx.conf - -COPY entrypoint.sh /entrypoint -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 18f1f8d..e69de29 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 @@ -1,21 +0,0 @@ -server { - listen 80; - server_name localhost; - - # SSL is managed by certbot, no need for a ssl listen; it will be generated automagically! - - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - # default html page - location / { - root /usr/share/nginx/html; - index index.html index.htm; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } -} diff --git a/servers/skel/docker-compose.d/custom/nginx/content/index.html b/servers/skel/docker-compose.d/custom/nginx/content/index.html index c66cf70..e69de29 100644 --- a/servers/skel/docker-compose.d/custom/nginx/content/index.html +++ b/servers/skel/docker-compose.d/custom/nginx/content/index.html @@ -1,26 +0,0 @@ - - - - - Welcome to nginx! - - - - -

Welcome to nginx!

-
- If you're seeing this, it means the admin was too lazy to remove this page.
- Expected something here? contact the admin: webmaster@ixvd.net - - - \ No newline at end of file diff --git a/servers/skel/docker-compose.d/custom/nginx/entrypoint.sh b/servers/skel/docker-compose.d/custom/nginx/entrypoint.sh index df5fa5c..e69de29 100755 --- a/servers/skel/docker-compose.d/custom/nginx/entrypoint.sh +++ b/servers/skel/docker-compose.d/custom/nginx/entrypoint.sh @@ -1,28 +0,0 @@ -#!/bin/sh - -trap exit TERM - -if [ -n "${CERTBOT_DOMAINS}" ]; then - echo "registering..." - if ! certbot show_account; then - certbot register -n \ - --agree-tos \ - -m "${CERTBOT_EMAIL}" - fi - - for d in $(echo "${CERTBOT_DOMAINS}" | sed 's/,/ /g'); do - echo "requesting for $d..." - certbot --nginx -n --keep -d "$d" - done - - while :; do - echo "renewing domains..." - certbot --nginx --keep -n renew - sleep 12h & - wait $! - done & -else - echo "skipping certbot due to no domains!" -fi & - -exec "$@" \ No newline at end of file diff --git a/servers/skel/docker-compose.d/custom/nginx/nginx.conf b/servers/skel/docker-compose.d/custom/nginx/nginx.conf index 2f54d99..e69de29 100644 --- a/servers/skel/docker-compose.d/custom/nginx/nginx.conf +++ b/servers/skel/docker-compose.d/custom/nginx/nginx.conf @@ -1,35 +0,0 @@ - -user nginx; -worker_processes auto; - -error_log /var/log/nginx/error.log notice; -pid /var/run/nginx.pid; - - -events { - worker_connections 1024; -} - - -http { - 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"'; - - # docker resolver and quad9; - resolver 127.0.0.11 9.9.9.9 ipv6=off; - - access_log /var/log/nginx/access.log main; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - #gzip on; - - include /etc/nginx/conf.d/*.conf; -} diff --git a/servers/skel/docker-compose.d/docker-compose.yml b/servers/skel/docker-compose.d/docker-compose.yml index 159ffe1..abcc778 100644 --- a/servers/skel/docker-compose.d/docker-compose.yml +++ b/servers/skel/docker-compose.d/docker-compose.yml @@ -4,7 +4,8 @@ version: '2.2' services: # default nginx setup nginx: - build: custom/nginx + build: + context: ../../../images/nginx environment: CERTBOT_EMAIL: "webmaster@ixvd.net" CERTBOT_DOMAINS: "localhost" diff --git a/skel/etc/ixvd/skel-sum.txt b/skel/etc/ixvd/skel-sum.txt index 47dacea..debf3d8 100644 --- a/skel/etc/ixvd/skel-sum.txt +++ b/skel/etc/ixvd/skel-sum.txt @@ -1 +1 @@ -059c7c3eb87d4a9bd30b70ba9016b875783b9206cbd44b4c2dc1bb8f59787127 - +07453417352829e9a47d22b3d8e15e0bb2d12df86f92165bda2568883d1817ab -