diff options
| author | 2022-12-12 10:26:38 +0000 | |
|---|---|---|
| committer | 2022-12-12 10:26:38 +0000 | |
| commit | 4afa513dced3b9ef024bc366b4fc884802730d50 (patch) | |
| tree | 51098e478054a66439e98dfab89cbbedf5d9f5c0 /examples | |
| parent | Backport from xs. (diff) | |
| download | snac2-4afa513dced3b9ef024bc366b4fc884802730d50.tar.gz snac2-4afa513dced3b9ef024bc366b4fc884802730d50.tar.xz snac2-4afa513dced3b9ef024bc366b4fc884802730d50.zip | |
Add docker-compose support, so a working development server with HTTPS can be started with:
docker-compose build && docker-compose up
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/docker-entrypoint.sh | 6 | ||||
| -rw-r--r-- | examples/nginx-alpine-ssl/Dockerfile | 13 | ||||
| -rw-r--r-- | examples/nginx-alpine-ssl/default.conf | 89 | ||||
| -rwxr-xr-x | examples/nginx-alpine-ssl/entrypoint.sh | 15 | ||||
| -rw-r--r-- | examples/nginx-alpine-ssl/nginx-selfsigned.crt | 21 | ||||
| -rw-r--r-- | examples/nginx-alpine-ssl/nginx-selfsigned.key | 28 |
6 files changed, 172 insertions, 0 deletions
diff --git a/examples/docker-entrypoint.sh b/examples/docker-entrypoint.sh new file mode 100755 index 0000000..b64e039 --- /dev/null +++ b/examples/docker-entrypoint.sh | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | if [ ! -e /data/data/server.json ] | ||
| 2 | then | ||
| 3 | echo -ne "0.0.0.0\r\n8001\r\nlocalhost\r\n\r\n" | /build/snac init /data/data | ||
| 4 | /build/snac adduser /data/data testuser | ||
| 5 | fi | ||
| 6 | SSLKEYLOGFILE=/data/key /build/snac httpd /data/data | ||
diff --git a/examples/nginx-alpine-ssl/Dockerfile b/examples/nginx-alpine-ssl/Dockerfile new file mode 100644 index 0000000..845405d --- /dev/null +++ b/examples/nginx-alpine-ssl/Dockerfile | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | FROM alpine | ||
| 2 | RUN apk add nginx | ||
| 3 | RUN mkdir -p /run/nginx | ||
| 4 | ADD default.conf /etc/nginx/http.d/default.conf | ||
| 5 | ADD *.key /etc/ssl/private/ | ||
| 6 | ADD *.crt /etc/ssl/certs/ | ||
| 7 | WORKDIR /var/www/localhost/htdocs | ||
| 8 | COPY entrypoint.sh /usr/local/bin | ||
| 9 | RUN chmod +x /usr/local/bin/entrypoint.sh | ||
| 10 | ENTRYPOINT ["/bin/sh", "/usr/local/bin/entrypoint.sh"] | ||
| 11 | #EXPOSE 80 | ||
| 12 | EXPOSE 443 | ||
| 13 | CMD ["/bin/sh", "-c", "nginx -g 'daemon off;'; nginx -s reload;"] | ||
diff --git a/examples/nginx-alpine-ssl/default.conf b/examples/nginx-alpine-ssl/default.conf new file mode 100644 index 0000000..22db0df --- /dev/null +++ b/examples/nginx-alpine-ssl/default.conf | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | server { | ||
| 2 | listen 80 default_server; | ||
| 3 | listen [::]:80 default_server; | ||
| 4 | listen 443 ssl http2 default_server; | ||
| 5 | listen [::]:443 ssl http2 default_server; | ||
| 6 | ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt; | ||
| 7 | ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key; | ||
| 8 | |||
| 9 | location /.well-known/webfinger { | ||
| 10 | proxy_http_version 1.1; | ||
| 11 | proxy_set_header Upgrade $http_upgrade; | ||
| 12 | proxy_set_header Connection "upgrade"; | ||
| 13 | proxy_redirect off; | ||
| 14 | proxy_connect_timeout 90; | ||
| 15 | proxy_send_timeout 90; | ||
| 16 | proxy_read_timeout 90; | ||
| 17 | proxy_set_header Host $host; | ||
| 18 | proxy_set_header X-Real-IP $remote_addr; | ||
| 19 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| 20 | proxy_set_header X-Forwarded-Proto $scheme; | ||
| 21 | proxy_set_header Proxy ""; | ||
| 22 | proxy_pass_header Server; | ||
| 23 | proxy_buffering on; | ||
| 24 | tcp_nodelay on; | ||
| 25 | proxy_pass http://snac:8001; | ||
| 26 | proxy_set_header Host $http_host; | ||
| 27 | } | ||
| 28 | |||
| 29 | location /.well-known/nodeinfo { | ||
| 30 | proxy_http_version 1.1; | ||
| 31 | proxy_set_header Upgrade $http_upgrade; | ||
| 32 | proxy_set_header Connection "upgrade"; | ||
| 33 | proxy_redirect off; | ||
| 34 | proxy_connect_timeout 90; | ||
| 35 | proxy_send_timeout 90; | ||
| 36 | proxy_read_timeout 90; | ||
| 37 | proxy_set_header Host $host; | ||
| 38 | proxy_set_header X-Real-IP $remote_addr; | ||
| 39 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| 40 | proxy_set_header X-Forwarded-Proto $scheme; | ||
| 41 | proxy_set_header Proxy ""; | ||
| 42 | proxy_pass_header Server; | ||
| 43 | proxy_buffering on; | ||
| 44 | tcp_nodelay on; | ||
| 45 | proxy_pass http://snac:8001; | ||
| 46 | proxy_set_header Host $http_host; | ||
| 47 | } | ||
| 48 | |||
| 49 | location / { | ||
| 50 | proxy_http_version 1.1; | ||
| 51 | proxy_set_header Upgrade $http_upgrade; | ||
| 52 | proxy_set_header Connection "upgrade"; | ||
| 53 | proxy_redirect off; | ||
| 54 | proxy_connect_timeout 90; | ||
| 55 | proxy_send_timeout 90; | ||
| 56 | proxy_read_timeout 90; | ||
| 57 | proxy_set_header Host $host; | ||
| 58 | proxy_set_header X-Real-IP $remote_addr; | ||
| 59 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| 60 | proxy_set_header X-Forwarded-Proto $scheme; | ||
| 61 | proxy_set_header Proxy ""; | ||
| 62 | proxy_pass_header Server; | ||
| 63 | proxy_buffering on; | ||
| 64 | tcp_nodelay on; | ||
| 65 | proxy_pass http://snac:8001; | ||
| 66 | proxy_set_header Host $http_host; | ||
| 67 | } | ||
| 68 | |||
| 69 | location /fedi/ { | ||
| 70 | proxy_http_version 1.1; | ||
| 71 | proxy_set_header Upgrade $http_upgrade; | ||
| 72 | proxy_set_header Connection "upgrade"; | ||
| 73 | proxy_redirect off; | ||
| 74 | proxy_connect_timeout 90; | ||
| 75 | proxy_send_timeout 90; | ||
| 76 | proxy_read_timeout 90; | ||
| 77 | proxy_set_header Host $host; | ||
| 78 | proxy_set_header X-Real-IP $remote_addr; | ||
| 79 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| 80 | proxy_set_header X-Forwarded-Proto $scheme; | ||
| 81 | proxy_set_header Proxy ""; | ||
| 82 | proxy_pass_header Server; | ||
| 83 | proxy_buffering on; | ||
| 84 | tcp_nodelay on; | ||
| 85 | proxy_pass http://snac:8001; | ||
| 86 | proxy_set_header Host $http_host; | ||
| 87 | } | ||
| 88 | } | ||
| 89 | |||
diff --git a/examples/nginx-alpine-ssl/entrypoint.sh b/examples/nginx-alpine-ssl/entrypoint.sh new file mode 100755 index 0000000..5432d46 --- /dev/null +++ b/examples/nginx-alpine-ssl/entrypoint.sh | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | cd /etc/nginx/http.d; | ||
| 2 | export CRT="${CRT:=nginx-selfsigned.crt}"; | ||
| 3 | if [ -f "/etc/ssl/certs/$CRT" ] | ||
| 4 | then | ||
| 5 | # set crt file in the default.conf file | ||
| 6 | sed -i "/ssl_certificate \//c\\\tssl_certificate \/etc\/ssl\/certs\/$CRT;" default.conf; | ||
| 7 | fi | ||
| 8 | export KEY="${KEY:=nginx-selfsigned.key}"; | ||
| 9 | if [ -f "/etc/ssl/private/$KEY" ] | ||
| 10 | then | ||
| 11 | # set key file in the default.conf file | ||
| 12 | sed -i "/ssl_certificate_key \//c\\\tssl_certificate_key \/etc\/ssl\/private\/$KEY;" default.conf; | ||
| 13 | fi | ||
| 14 | nginx -g 'daemon off;'; nginx -s reload; | ||
| 15 | |||
diff --git a/examples/nginx-alpine-ssl/nginx-selfsigned.crt b/examples/nginx-alpine-ssl/nginx-selfsigned.crt new file mode 100644 index 0000000..ac607a1 --- /dev/null +++ b/examples/nginx-alpine-ssl/nginx-selfs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/8ptI9ncISkYBDz8hUmWE | ||
| 16 | WkBsSFs2BTBvUQ4bsdXmV3AkC1BFw0meW3kNL/4ptkSsOvVj4imBjG906UfyXw5l | ||
| 17 | TyegRn2pA13IqBgl0Fs0+qlg5a/a+UgMZHmJeCsOZ3gJCG/mqJ0MyE8vUCUcD1oZ | ||
| 18 | XGsUgOUkiK/eMN6r4kW6SsBs7iapDpascvmGz4VuzYpBy+qOGayfCOt4h/hS9VEC | ||
| 19 | ErZo1L6jJFBApM1Jxmd7yYWJeQAkN1/LjdYJltSZ4dNlw6ewzK/Px0hGeEzr60M7 | ||
| 20 | +JgGuAuxIdp3pTYZwB5TqZ5v/bvapzPgK4A7COBOj1N3uqJiTmYErKwx201AP3BQ | ||
| 21 | -----END CERTIFICATE----- | ||
diff --git a/examples/nginx-alpine-ssl/nginx-selfsigned.key b/examples/nginx-alpine-ssl/nginx-selfsigned.key new file mode 100644 index 0000000..f26cf84 --- /dev/null +++ b/examples/nginx-alpine-ssl/nginx-selfsigned.key | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | -----BEGIN PRIVATE KEY----- | ||
| 2 | MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDbLNsPxlMCnKFM | ||
| 3 | R7Fg355XRLic8Mdya6Eb02WO2XBDPL7FVvF4utY6aNh/1Kr/t45evkelBS9SCkFG | ||
| 4 | NI5/SmrWJH6x3R3GMUcB/MiylnwmPf6qzxPDc2EDJHjVKruaBlgzBaAnBgLhzswf | ||
| 5 | r+iUdv9M2hGr4venWWcI4o3WbWQAfQbqg+UeXZlQVdX2EljP19PyjdkT6aAUWpPh | ||
| 6 | 5qaGX4prrfazAD42slo1cUAkf5Ai+jpXyy+QhaenurvaXM0TUy69EDg5skBiAXeE | ||
| 7 | Y4dSUA9itXNUDeM7cBMRlvoKnuwhrsFXz0o5VLBNZIgtdSq3gFmnS4qLzqeE4epc | ||
| 8 | oHmmIOEfAgMBAAECggEBAJDckN1YQ71SMP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y9opTEU0aSrU3l8GtNVI+6wVnjyefoAElhVaAtTIMRHAkDAhKD0/irKkvmcq | ||
| 24 | o5Y2L/rgEEKVf59Oiyz8iRpoWmnvWQmA3Wo05iUVmwKBgHTh1q1PTUzgvL0uNNZ3 | ||
| 25 | Kttp/U81I0C0TEyLFt/WfAD6ZrsG3GMq5IqN2CkOvPSDCrdxAxiDuxK7l3/gWU6s | ||
| 26 | 9EtoG2gZb5SyU6hZ0isuokaeAyuueDEco38AFXSvmt/jxvdzilYW/n5+HNoV2XL1 | ||
| 27 | CBv1Y6Ouy7rA3Q9C7WPb43m4 | ||
| 28 | -----END PRIVATE KEY----- | ||