diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b7d0106..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -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 diff --git a/.env b/.env new file mode 100644 index 0000000..8dbfe38 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +DATA_ROOT=/data/beta.chaospott.de/ diff --git a/nginx/conf.d/default.conf b/configs/nginx/conf.d/default.conf similarity index 100% rename from nginx/conf.d/default.conf rename to configs/nginx/conf.d/default.conf diff --git a/nginx/conf.d/headers.conf b/configs/nginx/conf.d/headers.conf similarity index 100% rename from nginx/conf.d/headers.conf rename to configs/nginx/conf.d/headers.conf diff --git a/nginx/fastcgi.conf b/configs/nginx/fastcgi.conf similarity index 100% rename from nginx/fastcgi.conf rename to configs/nginx/fastcgi.conf diff --git a/nginx/fastcgi_params b/configs/nginx/fastcgi_params similarity index 100% rename from nginx/fastcgi_params rename to configs/nginx/fastcgi_params diff --git a/nginx/koi-utf b/configs/nginx/koi-utf similarity index 100% rename from nginx/koi-utf rename to configs/nginx/koi-utf diff --git a/nginx/koi-win b/configs/nginx/koi-win similarity index 100% rename from nginx/koi-win rename to configs/nginx/koi-win diff --git a/nginx/mime.types b/configs/nginx/mime.types similarity index 100% rename from nginx/mime.types rename to configs/nginx/mime.types diff --git a/nginx/modules b/configs/nginx/modules similarity index 100% rename from nginx/modules rename to configs/nginx/modules diff --git a/nginx/nginx.conf b/configs/nginx/nginx.conf similarity index 100% rename from nginx/nginx.conf rename to configs/nginx/nginx.conf diff --git a/nginx/scgi_params b/configs/nginx/scgi_params similarity index 100% rename from nginx/scgi_params rename to configs/nginx/scgi_params diff --git a/nginx/uwsgi_params b/configs/nginx/uwsgi_params similarity index 100% rename from nginx/uwsgi_params rename to configs/nginx/uwsgi_params diff --git a/nginx/win-utf b/configs/nginx/win-utf similarity index 100% rename from nginx/win-utf rename to configs/nginx/win-utf diff --git a/configs/webhook/hooks.json b/configs/webhook/hooks.json new file mode 100644 index 0000000..5b31d08 --- /dev/null +++ b/configs/webhook/hooks.json @@ -0,0 +1,12 @@ +[ + { + "id": "$ENDPOINT_ID", + "execute-command": "/webhook/reload.sh", + "command-working-directory": "/repo", + "match": + { + "secret": "$ENDPOINT_PW" + } + } +] + diff --git a/docker-compose.yml b/docker-compose.yml index b3fc5a1..393d13a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,36 +2,37 @@ version: '3.3' services: webhook: - image: cryptkiddie2/webhook:latest + image: cryptkiddie2/webhook-docker:latest restart: always labels: - - "traefik.frontend.rule=Host:site.webhook.nachtigall.chaospott.de" - - "traefik.port=9000" - - "traefik.docker.network=web" + - traefik.frontend.rule=Host:site.webhook.nachtigall.chaospott.de + - traefik.port=9000 + - traefik.docker.network=web networks: - extern expose: - - 80 + - 9000 volumes: - - /data/rasen-nein-danke.de/webhook/:/webhook - - /data/beta.chaospott.de/repo/:/repo + - ${DATA_ROOT}/webhook/:/webhook + - ${DATA_ROOT}/repo/:/repo + command: [-hooks, /webhook/hooks.json, -verbose] jekyll: image: jekyll/jekyll 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: - - /data/beta.chaospott.de/repo/:/repo - - /data/beta.chaospott.de/static/:/static + - ${DATA_ROOT}/repo/:/repo + - ${DATA_ROOT}/static/:/static nginx: image: nginx:latest restart: always volumes: - - /data/beta.chaospott.de/static/:/usr/share/nginx/html + - ${DATA_ROOT}/static/:/usr/share/nginx/html - ./nginx:/etc/nginx labels: - - "traefik.frontend.rule=Host:beta.chaospott.de" - - "traefik.port=80" - - "traefik.docker.network=web" + - traefik.frontend.rule=Host:beta.chaospott.de + - traefik.port=80 + - traefik.docker.network=web networks: - extern expose: diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..17b0df6 --- /dev/null +++ b/init.sh @@ -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