From 38e77371ea657c88749fcd30877c25c5c1a1b990 Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Sat, 18 Apr 2020 09:18:48 +0100 Subject: [PATCH 1/8] home --- .drone.home.yml | 14 ++++++++++++++ docker-compose-home.yml | 13 +++++++++++++ letsencrypt-nginx/Dockerfile.home | 4 ++++ letsencrypt-nginx/build.home.sh | 3 +++ letsencrypt-nginx/conf/home.conf | 20 ++++++++++++++++++++ letsencrypt-nginx/website/index.html | 1 + 6 files changed, 55 insertions(+) create mode 100644 letsencrypt-nginx/Dockerfile.home create mode 100644 letsencrypt-nginx/build.home.sh create mode 100644 letsencrypt-nginx/conf/home.conf create mode 100644 letsencrypt-nginx/website/index.html diff --git a/.drone.home.yml b/.drone.home.yml index c8700d5..43851ed 100644 --- a/.drone.home.yml +++ b/.drone.home.yml @@ -65,6 +65,20 @@ steps: - cd letsencrypt-nginx - docker build . -t $${LOCAL_DOCKER_REGISTRY}letsencrypt-nginx - docker push $${LOCAL_DOCKER_REGISTRY}letsencrypt-nginx +- name: build-nginx-home + when: + branch: + - home-deploy + image: docker:dind + volumes: + - name: dockersock + path: /var/run + environment: + LOCAL_DOCKER_REGISTRY: + from_secret: local-docker-registry + commands: + - cd letsencrypt-nginx + - sh build.home.sh - name: build-letsencrypt-blog when: branch: diff --git a/docker-compose-home.yml b/docker-compose-home.yml index ba37aa0..4bf9324 100644 --- a/docker-compose-home.yml +++ b/docker-compose-home.yml @@ -334,6 +334,19 @@ services: volumes: - mongo-chat:/data/db command: mongod --smallfiles --replSet rs0 --oplogSize 128 + nginx-home: + deploy: + placement: + constraints: [node.labels.com.sigyl.git-stack == yes] + replicas: 1 + restart_policy: + condition: any + image: ${LOCAL_DOCKER_REGISTRY}nginx-home + environment: + - SERVER_NAME=${BLOG_DOMAIN} + ports: + - 80:80 + volumes: gitea-app: gitea-db: diff --git a/letsencrypt-nginx/Dockerfile.home b/letsencrypt-nginx/Dockerfile.home new file mode 100644 index 0000000..15e966f --- /dev/null +++ b/letsencrypt-nginx/Dockerfile.home @@ -0,0 +1,4 @@ +ARG image +FROM $image +COPY ./conf/home.conf /etc/nginx/user.conf.d/server._conf +COPY ./website /www/data \ No newline at end of file diff --git a/letsencrypt-nginx/build.home.sh b/letsencrypt-nginx/build.home.sh new file mode 100644 index 0000000..d6d2712 --- /dev/null +++ b/letsencrypt-nginx/build.home.sh @@ -0,0 +1,3 @@ +set -e +docker build . -f Dockerfile.home --build-arg image=nginx:latest -t sigyl.com:5001/nginx-home +docker push sigyl.com:5001/nginx-home diff --git a/letsencrypt-nginx/conf/home.conf b/letsencrypt-nginx/conf/home.conf new file mode 100644 index 0000000..e5e13c8 --- /dev/null +++ b/letsencrypt-nginx/conf/home.conf @@ -0,0 +1,20 @@ + + server { + # resolver 127.0.0.11 valid=30s; ## internal docker dns + #listen [::]:3011 default ipv6only=on; ## listen for ipv6 + listen 80; + client_header_timeout 120s; + client_body_timeout 120s; + client_max_body_size 200m; + + # save logs here + + root /www/data; + + location / { + } + + + } + + diff --git a/letsencrypt-nginx/website/index.html b/letsencrypt-nginx/website/index.html new file mode 100644 index 0000000..99819a2 --- /dev/null +++ b/letsencrypt-nginx/website/index.html @@ -0,0 +1 @@ +

SiGyl Ltd

\ No newline at end of file From 0a1680138b90bba45826e2868f7fb70c70d7f559 Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Sat, 18 Apr 2020 09:38:09 +0100 Subject: [PATCH 2/8] . --- .drone.home.yml | 2 +- letsencrypt-nginx/build.home.sh | 4 ++-- letsencrypt-nginx/build.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.home.yml b/.drone.home.yml index 43851ed..39da5f4 100644 --- a/.drone.home.yml +++ b/.drone.home.yml @@ -78,7 +78,7 @@ steps: from_secret: local-docker-registry commands: - cd letsencrypt-nginx - - sh build.home.sh + - sh build.home.sh $${LOCAL_DOCKER_REGISTRY} - name: build-letsencrypt-blog when: branch: diff --git a/letsencrypt-nginx/build.home.sh b/letsencrypt-nginx/build.home.sh index d6d2712..a374592 100644 --- a/letsencrypt-nginx/build.home.sh +++ b/letsencrypt-nginx/build.home.sh @@ -1,3 +1,3 @@ set -e -docker build . -f Dockerfile.home --build-arg image=nginx:latest -t sigyl.com:5001/nginx-home -docker push sigyl.com:5001/nginx-home +docker build . -f Dockerfile.home --build-arg image=nginx:latest -t $1nginx-home +docker push $1nginx-home diff --git a/letsencrypt-nginx/build.sh b/letsencrypt-nginx/build.sh index feb27ea..94da20c 100644 --- a/letsencrypt-nginx/build.sh +++ b/letsencrypt-nginx/build.sh @@ -1,3 +1,3 @@ set -e -docker build . -f Dockerfile.$1 --build-arg image=sigyl.com:5001/letsencrypt-nginx -t sigyl.com:5001/letsencrypt-$1 -docker push sigyl.com:5001/letsencrypt-$1 +docker build . -f Dockerfile.$1 --build-arg image=$2letsencrypt-nginx -t $2letsencrypt-$1 +docker push $2letsencrypt-$1 From 49f759bac2c3ac0da788888946d31dad3be48df6 Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Sat, 18 Apr 2020 10:05:18 +0100 Subject: [PATCH 3/8] . --- letsencrypt-nginx/Dockerfile.home | 5 ++++- letsencrypt-nginx/nginx.conf | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 letsencrypt-nginx/nginx.conf diff --git a/letsencrypt-nginx/Dockerfile.home b/letsencrypt-nginx/Dockerfile.home index 15e966f..ada15ea 100644 --- a/letsencrypt-nginx/Dockerfile.home +++ b/letsencrypt-nginx/Dockerfile.home @@ -1,4 +1,7 @@ ARG image FROM $image COPY ./conf/home.conf /etc/nginx/user.conf.d/server._conf -COPY ./website /www/data \ No newline at end of file +COPY ./nginx.conf /etc/nginx/nginx.conf +COPY ./website /www/data +COPY run.sh / +CMD sh /run.sh \ No newline at end of file diff --git a/letsencrypt-nginx/nginx.conf b/letsencrypt-nginx/nginx.conf new file mode 100644 index 0000000..4e751bf --- /dev/null +++ b/letsencrypt-nginx/nginx.conf @@ -0,0 +1,31 @@ +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +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"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/user.conf.d/*.conf; +} From ca481fabfc69f74a3c0f507ec1cf246efa5122dd Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Sat, 18 Apr 2020 10:23:04 +0100 Subject: [PATCH 4/8] . --- letsencrypt-nginx/Dockerfile.home | 4 ++-- letsencrypt-nginx/home.sh | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 letsencrypt-nginx/home.sh diff --git a/letsencrypt-nginx/Dockerfile.home b/letsencrypt-nginx/Dockerfile.home index ada15ea..1608f0b 100644 --- a/letsencrypt-nginx/Dockerfile.home +++ b/letsencrypt-nginx/Dockerfile.home @@ -3,5 +3,5 @@ FROM $image COPY ./conf/home.conf /etc/nginx/user.conf.d/server._conf COPY ./nginx.conf /etc/nginx/nginx.conf COPY ./website /www/data -COPY run.sh / -CMD sh /run.sh \ No newline at end of file +COPY home.sh / +CMD sh /home.sh \ No newline at end of file diff --git a/letsencrypt-nginx/home.sh b/letsencrypt-nginx/home.sh new file mode 100644 index 0000000..aa5f249 --- /dev/null +++ b/letsencrypt-nginx/home.sh @@ -0,0 +1,4 @@ +export DOLLAR='$' +envsubst < /etc/nginx/user.conf.d/server._conf > /etc/nginx/user.conf.d/server.conf +cat /etc/nginx/user.conf.d/server.conf +nginx -g "daemon off;" \ No newline at end of file From d12595a00b04dfda021655853df0a41ebc86a82f Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Sat, 18 Apr 2020 10:38:32 +0100 Subject: [PATCH 5/8] . --- letsencrypt-nginx/Dockerfile.home | 4 ++-- letsencrypt-nginx/website/index copy.html | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 letsencrypt-nginx/website/index copy.html diff --git a/letsencrypt-nginx/Dockerfile.home b/letsencrypt-nginx/Dockerfile.home index 1608f0b..3bb1dec 100644 --- a/letsencrypt-nginx/Dockerfile.home +++ b/letsencrypt-nginx/Dockerfile.home @@ -1,7 +1,7 @@ ARG image FROM $image COPY ./conf/home.conf /etc/nginx/user.conf.d/server._conf -COPY ./nginx.conf /etc/nginx/nginx.conf -COPY ./website /www/data +COPY nginx.conf /etc/nginx +COPY website /www/data COPY home.sh / CMD sh /home.sh \ No newline at end of file diff --git a/letsencrypt-nginx/website/index copy.html b/letsencrypt-nginx/website/index copy.html new file mode 100644 index 0000000..99819a2 --- /dev/null +++ b/letsencrypt-nginx/website/index copy.html @@ -0,0 +1 @@ +

SiGyl Ltd

\ No newline at end of file From b66b612b098fc3058fa0e41f9e482077d5aeaf80 Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Sat, 18 Apr 2020 10:50:30 +0100 Subject: [PATCH 6/8] . --- .drone.home.yml | 1 + docker-compose-home.yml | 2 +- letsencrypt-nginx/build.home.sh | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.drone.home.yml b/.drone.home.yml index 39da5f4..ad25350 100644 --- a/.drone.home.yml +++ b/.drone.home.yml @@ -234,6 +234,7 @@ steps: - export REMOTE_DOMAIN=$REMOTE_DOMAIN - export BLOG_DOMAIN=$BLOG_DOMAIN - docker pull $${LOCAL_DOCKER_REGISTRY}letsencrypt-git + - docker pull $${LOCAL_DOCKER_REGISTRY}nginx-home1 - docker pull $${LOCAL_DOCKER_REGISTRY}letsencrypt-chat - docker pull $${LOCAL_DOCKER_REGISTRY}letsencrypt-remote - docker pull $${LOCAL_DOCKER_REGISTRY}letsencrypt-blog diff --git a/docker-compose-home.yml b/docker-compose-home.yml index 4bf9324..46db257 100644 --- a/docker-compose-home.yml +++ b/docker-compose-home.yml @@ -341,7 +341,7 @@ services: replicas: 1 restart_policy: condition: any - image: ${LOCAL_DOCKER_REGISTRY}nginx-home + image: ${LOCAL_DOCKER_REGISTRY}nginx-home1 environment: - SERVER_NAME=${BLOG_DOMAIN} ports: diff --git a/letsencrypt-nginx/build.home.sh b/letsencrypt-nginx/build.home.sh index a374592..afc7c53 100644 --- a/letsencrypt-nginx/build.home.sh +++ b/letsencrypt-nginx/build.home.sh @@ -1,3 +1,3 @@ set -e -docker build . -f Dockerfile.home --build-arg image=nginx:latest -t $1nginx-home -docker push $1nginx-home +docker build . -f Dockerfile.home --build-arg image=nginx:latest -t $1nginx-home1 +docker push $1nginx-home1 From a9ad02fc442689c8f8883fe1083fdd941fe7c8f5 Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Sat, 18 Apr 2020 11:05:01 +0100 Subject: [PATCH 7/8] static website --- letsencrypt-nginx/Dockerfile.do | 1 + letsencrypt-nginx/conf/do.conf | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/letsencrypt-nginx/Dockerfile.do b/letsencrypt-nginx/Dockerfile.do index c7ee953..4681890 100644 --- a/letsencrypt-nginx/Dockerfile.do +++ b/letsencrypt-nginx/Dockerfile.do @@ -1,3 +1,4 @@ ARG image FROM $image +COPY website /www/data COPY ./conf/do.conf /etc/nginx/user.conf.d/server._conf \ No newline at end of file diff --git a/letsencrypt-nginx/conf/do.conf b/letsencrypt-nginx/conf/do.conf index 534f00b..95829ec 100644 --- a/letsencrypt-nginx/conf/do.conf +++ b/letsencrypt-nginx/conf/do.conf @@ -115,6 +115,11 @@ chunked_transfer_encoding on; server_name ${SERVER_NAME}; + + root /www/data; + + location / { + } location ${LOCATION} { proxy_pass ${PROXY_PASS}; From dddcc8314d652263a715089cc38bb950d0820109 Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Sat, 18 Apr 2020 11:13:09 +0100 Subject: [PATCH 8/8] links --- letsencrypt-nginx/website/index copy.html | 1 - letsencrypt-nginx/website/index.html | 28 ++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) delete mode 100644 letsencrypt-nginx/website/index copy.html diff --git a/letsencrypt-nginx/website/index copy.html b/letsencrypt-nginx/website/index copy.html deleted file mode 100644 index 99819a2..0000000 --- a/letsencrypt-nginx/website/index copy.html +++ /dev/null @@ -1 +0,0 @@ -

SiGyl Ltd

\ No newline at end of file diff --git a/letsencrypt-nginx/website/index.html b/letsencrypt-nginx/website/index.html index 99819a2..22f99e9 100644 --- a/letsencrypt-nginx/website/index.html +++ b/letsencrypt-nginx/website/index.html @@ -1 +1,27 @@ -

SiGyl Ltd

\ No newline at end of file +

SiGyl Ltd

+ + + +

home

+ +