summaryrefslogtreecommitdiff
path: root/playbooks/roles/src
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/roles/src')
-rw-r--r--playbooks/roles/src/templates/stacks/docker-compose.yml49
-rw-r--r--playbooks/roles/src/templates/volumes/cgit.nginx.conf49
-rw-r--r--playbooks/roles/src/templates/volumes/cgit/cgit-css/cgit.pngbin25036 -> 0 bytes
-rw-r--r--playbooks/roles/src/templates/volumes/cgit/index.html1
-rwxr-xr-xplaybooks/roles/src/templates/volumes/data/hooks/update37
-rw-r--r--playbooks/roles/src/templates/volumes/soft-serve/.gitkeep (renamed from playbooks/roles/src/templates/volumes/data/.gitkeep)0
-rwxr-xr-xplaybooks/roles/src/templates/volumes/soft-serve/hooks/update68
7 files changed, 80 insertions, 124 deletions
diff --git a/playbooks/roles/src/templates/stacks/docker-compose.yml b/playbooks/roles/src/templates/stacks/docker-compose.yml
index 547020d..3ac70f9 100644
--- a/playbooks/roles/src/templates/stacks/docker-compose.yml
+++ b/playbooks/roles/src/templates/stacks/docker-compose.yml
@@ -1,46 +1,16 @@
services:
- frontend:
- image: emarcs/nginx-cgit
- volumes:
- - {{ src_base }}/volumes/data/repos:/srv/git:ro
- - {{ src_base }}/volumes/cgit/:/usr/share/cgit:ro
- - {{ src_base }}/volumes/cgit.nginx.conf:/etc/nginx/sites-available/default
- environment:
- CGIT_TITLE: '{{ src_domain }}'
- CGIT_DESC: '<3 {{ domain }}'
- CGIT_VROOT: '/cgit'
- CGIT_SECTION_FROM_STARTPATH: 1
- CGIT_MAX_REPO_COUNT: 100
- networks:
- - proxy
- healthcheck:
- test: ["CMD-SHELL", "curl --fail http://localhost"]
- timeout: 15s
- interval: 30s
- retries: 3
- start_period: 5s
- deploy:
- mode: replicated
- update_config:
- parallelism: 1
- failure_action: rollback
- order: start-first
- monitor: 10s
- labels:
- - traefik.enable=true
- - traefik.swarm.network=proxy
- - traefik.http.routers.src.tls=true
- - traefik.http.routers.src.tls.certResolver=letsencrypt
- - traefik.http.routers.src.rule=Host(`{{ src_domain }}`)
- - traefik.http.routers.src.entrypoints=websecure
- - traefik.http.services.src.loadbalancer.server.port=80
+ # TODO: own cgit fork
src:
image: charmcli/soft-serve
volumes:
- - {{ src_base }}/volumes/data:/soft-serve
+ - {{ src_base }}/volumes/soft-serve:/soft-serve
ports:
- "2222:2222"
+{% if not homelab_build %}
+ networks:
+ - ci
+{% endif %}
environment:
- TZ={{ timezone }}
- DEPLOYMENT_TIME={{ deployment_time }}
@@ -56,7 +26,7 @@ services:
healthcheck:
test: ["CMD-SHELL", "netstat -tuln | grep 2222"]
timeout: 15s
- interval: 30s
+ interval: 10s
retries: 3
start_period: 5s
deploy:
@@ -69,5 +39,10 @@ services:
replicas: 1
networks:
+{% if not homelab_build %}
+ ci:
+ external: true
+ name: ci
+{% endif %}
proxy:
external: true
diff --git a/playbooks/roles/src/templates/volumes/cgit.nginx.conf b/playbooks/roles/src/templates/volumes/cgit.nginx.conf
deleted file mode 100644
index 5abe189..0000000
--- a/playbooks/roles/src/templates/volumes/cgit.nginx.conf
+++ /dev/null
@@ -1,49 +0,0 @@
-server {
- listen 80;
- server_name localhost;
-
- #charset koi8-r;
- #access_log /var/log/nginx/log/host.access.log main;
-
- location / {
- root /usr/share/cgit/;
- }
-
- location /cgit {
- try_files $uri @cgit;
- }
-
- location @cgit {
- fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
-
- fastcgi_param HTTP_HOST $server_name;
- fastcgi_split_path_info ^(/cgit/?)(.+)$;
- fastcgi_param PATH_INFO $fastcgi_path_info;
- fastcgi_param QUERY_INFO $uri;
-
- include fastcgi_params;
-
- fastcgi_pass unix:/var/run/fcgiwrap.socket;
- }
-
- location /cgit-css/ {
- rewrite ^/cgit-css(/.*)$ $1 break;
- root /usr/share/cgit/cgit-css/;
- }
-
- error_page 404 /404.html;
- error_page 401 /401.html;
-
- # redirect server error pages to the static page /50x.html
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/html;
- }
-
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- #
- location ~ /\.ht {
- deny all;
- }
-}
diff --git a/playbooks/roles/src/templates/volumes/cgit/cgit-css/cgit.png b/playbooks/roles/src/templates/volumes/cgit/cgit-css/cgit.png
deleted file mode 100644
index bb7ffa1..0000000
--- a/playbooks/roles/src/templates/volumes/cgit/cgit-css/cgit.png
+++ /dev/null
Binary files differ
diff --git a/playbooks/roles/src/templates/volumes/cgit/index.html b/playbooks/roles/src/templates/volumes/cgit/index.html
deleted file mode 100644
index 4b06983..0000000
--- a/playbooks/roles/src/templates/volumes/cgit/index.html
+++ /dev/null
@@ -1 +0,0 @@
-<h1>hai</h1>
diff --git a/playbooks/roles/src/templates/volumes/data/hooks/update b/playbooks/roles/src/templates/volumes/data/hooks/update
deleted file mode 100755
index 5723dc5..0000000
--- a/playbooks/roles/src/templates/volumes/data/hooks/update
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-#
-
-refname="$1"
-oldrev="$2"
-newrev="$3"
-
-# Safety check
-if [ -z "$GIT_DIR" ]; then
- echo "Don't run this script from the command line." >&2
- echo " (if you want, you could supply GIT_DIR then run" >&2
- echo " $0 <ref> <oldrev> <newrev>)" >&2
- exit 1
-fi
-
-if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
- echo "usage: $0 <ref> <oldrev> <newrev>" >&2
- exit 1
-fi
-
-# Check types
-# if $newrev is 0000...0000, it's a commit to delete a ref.
-zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
-if [ "$newrev" = "$zero" ]; then
- newrev_type=delete
-else
- newrev_type=$(git cat-file -t $newrev)
-fi
-
-echo "Hi from Soft Serve update hook!"
-echo "$GITDIR"
-echo "RefName: $refname"
-echo "Change Type: $newrev_type"
-echo "Old SHA1: $oldrev"
-echo "New SHA1: $newrev"
-
-exit 0
diff --git a/playbooks/roles/src/templates/volumes/data/.gitkeep b/playbooks/roles/src/templates/volumes/soft-serve/.gitkeep
index e69de29..e69de29 100644
--- a/playbooks/roles/src/templates/volumes/data/.gitkeep
+++ b/playbooks/roles/src/templates/volumes/soft-serve/.gitkeep
diff --git a/playbooks/roles/src/templates/volumes/soft-serve/hooks/update b/playbooks/roles/src/templates/volumes/soft-serve/hooks/update
new file mode 100755
index 0000000..a97e5f9
--- /dev/null
+++ b/playbooks/roles/src/templates/volumes/soft-serve/hooks/update
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+# -- <logo> --
+function logo() {
+ git config --global color.ui auto
+
+cat <<'EOF'
+--| |--
+--| ~ welcome to ~ |--
+--| |--
+--| .-. _ .--. .--. |--
+--| :.: :_; : .-': .-' |--
+--| :.: .-..---. .--. .--. : `; : `;.--. .--. |--
+--| :.:_ : :`-'_.' _ ' ..'' .; :: : : :' '_.'' '_.' |--
+--| `.__;:_;`.___;:_;`.__.'`.__.':_; :_;`.__.'`.__.' |--
+--| |--
+--| ~₊˚⊹ ⋆˚✿˖°~ -────୨ৎ────- ~₊˚⊹ ⋆˚✿˖°~ |--
+--| ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ |--
+--| ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠒⠉⠉⠉⣀⣂⣅⠬⡉⠭⢛⠿⢟⡶⣄⡀⠀⠀⠀⠀ we'll get brewing |--
+--| ⠀⠀⠀⠀⠀⠀⠀⣠⠞⠁⠀⣄⢎⢩⢸⢉⣵⡖⢰⣶⣮⢹⣦⣡⢊⢻⡿⣦⠀⠀⠀ right away! |--
+--| ⠀⠀⠀⠀⠀⠀⢠⡇⠀⠀⢎⠕⢭⢪⡶⠈⢿⣷⣿⠟⣋⣚⣯⣒⣣⡑⢨⢻⡇⠀⣀⣀⠀⠀⠀ |--
+--| ⠀⠀⠀⠀⠀⣀⡼⣧⠀⠄⡊⢼⡩⣾⢌⠳⡜⣉⡠⡜⡞⣵⣊⡧⡠⠝⣣⡾⠁⠀⠻⠿⠗⠀⠀ /) /) (\ (\ |--
+--| ⠀⠀⠀⣢⣾⡟⣥⠻⣷⣌⡀⠬⡘⢅⡟⡇⡮⣷⡾⡿⢋⣉⢣⢔⣎⠿⠊⠀⠀⡴⣛⠆⠌⠀⠀ ( . .) (. . ) |--
+--| ⠀⢀⣶⡟⣡⣿⣿⣟⢯⣟⢿⣷⣶⣯⣬⣵⣾⣷⣶⡾⠧⠞⠓⠉⠀⠀⠀⢀⠘⠈⠀⠠⢘⡤⠀ ( づ ˚♡︎˖ ⊂ ) |--
+--| ⠄⣾⠏⣐⣛⡻⢿⣿⣯⣿⣿⣿⣾⣽⣛⣍⢃⡂⢄⠀⡀⠀⡀⠄⢂⠄⠡⢈⠒⡈⢒⠘⠴⢀⠀ |--
+--| ⢰⣿⠀⠈⠻⣜⣄⠈⢙⣾⢿⣿⣿⣿⡿⣜⢣⡜⢢⠁⠄⡐⢠⢉⠂⠌⠀⡀⠄⠐⡀⠄⠐⠀⢐ ___ |--
+--| ⠸⣟⠀⡐⡅⠈⠑⠀⠊⠝⠈⢖⡿⠿⣿⣾⡱⢊⠅⡌⡰⢌⢆⠣⠈⢀⠐⠀⠄⠂⠠⡈⠠⣈⡧ (...) |--
+--| ⠀⢿⣆⠱⣘⣧⣤⣀⣀⡀⢒⡥⣑⢨⠒⡰⠯⠾⡼⠶⠙⢈⠀⣀⠂⡄⢂⣁⢢⣑⣶⡽⣳⠟⠁ _ \ _ |--
+--| ⠀⠀⠻⣧⡜⢹⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣴⡀⡀⠀⠛⠺⢿⣶⣿⣾⣷⣿⣿⣿⢟⣵⠏⠀⠀ ('> <') |--
+--| ⠀⠀⠀⠈⠿⣶⣉⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣧⣤⢀⠀⠀⠈⠉⠙⠻⣯⡷⠟⠁⠀⠀⠀ (v) (v) |--
+--| ⠀⠀⠀⠀⠀⠈⠙⠿⣶⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣞⣤⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀\(__w w__)/ |--
+--| ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠿⠿⠿⠿⠿⠿⠛⠛⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ |--
+--| |--
+--| |--
+EOF
+}
+# -- </logo> --
+
+# -- <continuous_integration> --
+refname="$1"
+_oldrev="$2"
+rev="$3"
+
+function post_trigger_ci_jobs() {
+ local host="cihooks"
+ local port="9000"
+ local path="/job"
+ local json_payload=$(printf '{"type": "ci_pipeline", "arguments": {"remote": "%s", "rev": "%s", "refname": "%s"}}' "$1" "$2" "$3")
+
+ echo "> $json_payload"
+
+ which curl 2&>/dev/null || apk add -q curl
+
+ curl --silent --show-error -X POST \
+ -H "Content-Type: application/json" \ -H "Connection: close" \
+ -d "$json_payload" \
+ "http://$host:$port$path"
+
+ echo "... Done!"
+}
+# -- </continuous_integration> --
+
+# -- <main> --
+remote="ssh://{{ src_domain }}:2222/$(basename "$PWD")"
+
+logo
+post_trigger_ci_jobs "$remote" "$rev" "$refname"
+# -- </main> --