Adds webhooks service with site reploy webhook
This commit is contained in:
parent
f01472bbeb
commit
6ac456b193
@ -85,3 +85,9 @@ services:
|
||||
- db
|
||||
site:
|
||||
image: abhin4v/abhinavsarkar.net:latest
|
||||
hooks:
|
||||
build:
|
||||
context: ./webhooks
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- .:/opt/space
|
||||
|
23
nginx-conf/hooks.conf
Normal file
23
nginx-conf/hooks.conf
Normal file
@ -0,0 +1,23 @@
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name hooks.abhinavsarkar.net;
|
||||
|
||||
ssl_certificate /etc/nginx/certs/fullchain1.pem;
|
||||
ssl_certificate_key /etc/nginx/certs/privkey1.pem;
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
|
||||
|
||||
proxy_set_header X-Real-IP $remote_addr; # pass on real client IP
|
||||
|
||||
location / {
|
||||
proxy_pass http://hooks:9000;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name hooks.abhinavsarkar.net;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
7
webhooks/Dockerfile
Normal file
7
webhooks/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM almir/webhook
|
||||
RUN apk add --update docker py-pip \
|
||||
&& pip install docker-compose \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
COPY hooks.json /etc/webhook/hooks.json
|
||||
COPY redeploy-site.sh /var/scripts/redeploy-site.sh
|
||||
CMD ["-verbose", "-hooks=/etc/webhook/hooks.json"]
|
7
webhooks/hooks.json
Normal file
7
webhooks/hooks.json
Normal file
@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"id": "redeploy-site",
|
||||
"execute-command": "/var/scripts/redeploy-site.sh",
|
||||
"command-working-directory": "/opt/space"
|
||||
}
|
||||
]
|
4
webhooks/redeploy-site.sh
Executable file
4
webhooks/redeploy-site.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
docker-compose pull site
|
||||
docker-compose up -d --build site
|
Loading…
Reference in New Issue
Block a user