From 61ec7264a806e3686c53f11b1d4cb253a40747e1 Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 3 Oct 2024 06:43:40 +0200 Subject: [PATCH] Initial commit --- deploy-this/deploy-dc.yml | 32 +++++++++++++ deploy-this/start-proxy.jenkinsfile | 14 ++++++ nginx-config/http/http-for-letsencrypt.conf | 24 ++++++++++ .../http-for-letsencrypt.conf | 24 ++++++++++ .../wp-zaklik-artikus-dynu-net-https.conf | 46 +++++++++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 deploy-this/deploy-dc.yml create mode 100755 deploy-this/start-proxy.jenkinsfile create mode 100644 nginx-config/http/http-for-letsencrypt.conf create mode 100644 nginx-config/https-artikus-dynu-net/http-for-letsencrypt.conf create mode 100644 nginx-config/https-artikus-dynu-net/wp-zaklik-artikus-dynu-net-https.conf diff --git a/deploy-this/deploy-dc.yml b/deploy-this/deploy-dc.yml new file mode 100644 index 0000000..5e69fac --- /dev/null +++ b/deploy-this/deploy-dc.yml @@ -0,0 +1,32 @@ +services: + + central-nginx: + + image: nginx-with-tools + container_name: central-nginx + restart: always + + + networks: + - central-net + + environment: + TZ: Europe/Warsaw + + ports: + - 80:80 + - 443:443 + + volumes: + # Nginx configuration + - ${DOCKER_DATA}/_central_nginx_/nginx-config:/etc/nginx/conf.d + + # Lets encrypt for https + - ${DOCKER_DATA}/letsencrypt:/letsencrypt:rw + - ${DOCKER_DATA}/letsencrypt-tmp:/var/www/certbot/:rw + +networks: + central-net: + name: central-net + external: false +# docker compose --profile base --profile base-dv --profile production --file 3.jenkins-with-docker-compose.yml --env-file artik-docker.env up --detach diff --git a/deploy-this/start-proxy.jenkinsfile b/deploy-this/start-proxy.jenkinsfile new file mode 100755 index 0000000..51e905c --- /dev/null +++ b/deploy-this/start-proxy.jenkinsfile @@ -0,0 +1,14 @@ +pipeline { + agent any + + stages{ + stage('start central-nginx') { + steps { + script{ + def nxinx_build ="docker compose --file deploy-this/deploy-dc.yml up --detach " + sh(nxinx_build); + } + } + } + } +} \ No newline at end of file diff --git a/nginx-config/http/http-for-letsencrypt.conf b/nginx-config/http/http-for-letsencrypt.conf new file mode 100644 index 0000000..9bbcce9 --- /dev/null +++ b/nginx-config/http/http-for-letsencrypt.conf @@ -0,0 +1,24 @@ +server { + + listen 80 default_server; + + server_tokens off; + + location /.well-known/acme-challenge/ { + root /var/www/certbot; + } + + location / { + + proxy_pass http://zaklik:8085; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + } + + +} diff --git a/nginx-config/https-artikus-dynu-net/http-for-letsencrypt.conf b/nginx-config/https-artikus-dynu-net/http-for-letsencrypt.conf new file mode 100644 index 0000000..9bbcce9 --- /dev/null +++ b/nginx-config/https-artikus-dynu-net/http-for-letsencrypt.conf @@ -0,0 +1,24 @@ +server { + + listen 80 default_server; + + server_tokens off; + + location /.well-known/acme-challenge/ { + root /var/www/certbot; + } + + location / { + + proxy_pass http://zaklik:8085; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + } + + +} diff --git a/nginx-config/https-artikus-dynu-net/wp-zaklik-artikus-dynu-net-https.conf b/nginx-config/https-artikus-dynu-net/wp-zaklik-artikus-dynu-net-https.conf new file mode 100644 index 0000000..be5ba20 --- /dev/null +++ b/nginx-config/https-artikus-dynu-net/wp-zaklik-artikus-dynu-net-https.conf @@ -0,0 +1,46 @@ +server { + + listen 443 ssl; + server_name artikus.dynu.net; + + server_tokens off; + + ssl_certificate /letsencrypt/live/artikus.dynu.net/fullchain.pem; + ssl_certificate_key /letsencrypt/live/artikus.dynu.net/privkey.pem; + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!MD5; + + + location / { + + proxy_pass http://zaklik:8085; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + } + + + +} + +server { + + listen 443 ssl; + + server_name www.artikus.dynu.net; + + server_tokens off; + + ssl_certificate /letsencrypt/live/artikus.dynu.net/fullchain.pem; + ssl_certificate_key /letsencrypt/live/artikus.dynu.net/privkey.pem; + + return 301 https://bodypainter.eu$request_uri; + + + +} \ No newline at end of file