updated and added init script

This commit is contained in:
Zehka 2020-07-05 17:56:22 +02:00
parent 5721a871bd
commit bd3d9e1856
17 changed files with 55 additions and 37 deletions

View File

@ -1,23 +0,0 @@
version: 2
jobs:
build:
docker:
- image: golang:1.6.4
steps:
- setup_remote_docker
- checkout
- run:
name: Install Docker client
command: |
set -x
VER="17.03.0-ce"
curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run: docker build -t chaospott/site .
- run: |
docker tag chaospott/site chaospott/site:$CIRCLE_SHA1
docker push chaospott/site:$CIRCLE_SHA1
docker push chaospott/site:latest

1
.env Normal file
View File

@ -0,0 +1 @@
DATA_ROOT=/data/beta.chaospott.de/

View File

@ -0,0 +1,12 @@
[
{
"id": "$ENDPOINT_ID",
"execute-command": "/webhook/reload.sh",
"command-working-directory": "/repo",
"match":
{
"secret": "$ENDPOINT_PW"
}
}
]

View File

@ -2,36 +2,37 @@ version: '3.3'
services: services:
webhook: webhook:
image: cryptkiddie2/webhook:latest image: cryptkiddie2/webhook-docker:latest
restart: always restart: always
labels: labels:
- "traefik.frontend.rule=Host:site.webhook.nachtigall.chaospott.de" - traefik.frontend.rule=Host:site.webhook.nachtigall.chaospott.de
- "traefik.port=9000" - traefik.port=9000
- "traefik.docker.network=web" - traefik.docker.network=web
networks: networks:
- extern - extern
expose: expose:
- 80 - 9000
volumes: volumes:
- /data/rasen-nein-danke.de/webhook/:/webhook - ${DATA_ROOT}/webhook/:/webhook
- /data/beta.chaospott.de/repo/:/repo - ${DATA_ROOT}/repo/:/repo
command: [-hooks, /webhook/hooks.json, -verbose]
jekyll: jekyll:
image: jekyll/jekyll image: jekyll/jekyll
restart: always restart: always
command: ["/usr/jekyll/bin/jekyll", "build", "--source", "/repo/web", "--destination", "/static", "--watch"] command: [/usr/jekyll/bin/jekyll, build, --source, /repo/web, --destination, /static, --watch]
volumes: volumes:
- /data/beta.chaospott.de/repo/:/repo - ${DATA_ROOT}/repo/:/repo
- /data/beta.chaospott.de/static/:/static - ${DATA_ROOT}/static/:/static
nginx: nginx:
image: nginx:latest image: nginx:latest
restart: always restart: always
volumes: volumes:
- /data/beta.chaospott.de/static/:/usr/share/nginx/html - ${DATA_ROOT}/static/:/usr/share/nginx/html
- ./nginx:/etc/nginx - ./nginx:/etc/nginx
labels: labels:
- "traefik.frontend.rule=Host:beta.chaospott.de" - traefik.frontend.rule=Host:beta.chaospott.de
- "traefik.port=80" - traefik.port=80
- "traefik.docker.network=web" - traefik.docker.network=web
networks: networks:
- extern - extern
expose: expose:

27
init.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
exe() {
echo "running $@"
$@
}
SITE_REPO="https://git.chaospott.de/zehka/site.git"
echo "Where should the site store all volumes?"
read -p "PATH: " VOLUMES_PATH
read -p "Hook endpoint ID (just make something up):" ENDPOINT_ID
read -p "Hook endpoint Password:" ENDPOINT_PW
echo "Creating volumes structure"
exe mkdir $VOLUMES_PATH
exe git clone $SITE_REPO $VOLUMES_PATH/repo
exe cp -rv configs/webhook $VOLUMES_PATH/webhook
echo """[
{
\"id\": \"$ENDPOINT_ID\",
\"execute-command\": \"/webhook/reload.sh\",
\"command-working-directory\": \"/repo\",
\"match\":
{
\"secret\": \"$ENDPOINT_PW\"
}
}
]""" > $VOLUMES_PATH/webhook/hooks.json
VOLUMES_PATH_SANITIZED=$(echo $VOLUMES_PATH | sed 's/\/$//g')
echo "DATA_ROOT=$VOLUMES_PATH_SANITIZED" > .env