From 68e3be1f591e40925b4c5c3f57aee8d4e260ebbf Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Tue, 13 Sep 2022 22:02:12 +0430 Subject: update --- terminaldweller.com/cgit/bootstrap/Dockerfile | 7 +++ terminaldweller.com/cgit/bootstrap/bootstrap.sh | 64 ++++++++++++++++++++++ terminaldweller.com/cgit/bootstrap/crontab | 1 + .../cgit/bootstrap/docker-entrypoint.sh | 6 ++ terminaldweller.com/cgit/cgit/Dockerfile | 2 + terminaldweller.com/cgit/cgit/cgitrc | 19 +++++++ terminaldweller.com/cgit/cgit/nginx.conf | 32 +++++++++++ terminaldweller.com/cgit/docker-compose.yaml | 30 ++++++++++ terminaldweller.com/haproxy/haproxy.cfg | 9 +++ terminaldweller.com/rss-bridge/docker-compose.yaml | 16 ++++++ 10 files changed, 186 insertions(+) create mode 100644 terminaldweller.com/cgit/bootstrap/Dockerfile create mode 100755 terminaldweller.com/cgit/bootstrap/bootstrap.sh create mode 100644 terminaldweller.com/cgit/bootstrap/crontab create mode 100755 terminaldweller.com/cgit/bootstrap/docker-entrypoint.sh create mode 100644 terminaldweller.com/cgit/cgit/Dockerfile create mode 100644 terminaldweller.com/cgit/cgit/cgitrc create mode 100644 terminaldweller.com/cgit/cgit/nginx.conf create mode 100644 terminaldweller.com/cgit/docker-compose.yaml create mode 100644 terminaldweller.com/rss-bridge/docker-compose.yaml (limited to 'terminaldweller.com') diff --git a/terminaldweller.com/cgit/bootstrap/Dockerfile b/terminaldweller.com/cgit/bootstrap/Dockerfile new file mode 100644 index 0000000..73e757a --- /dev/null +++ b/terminaldweller.com/cgit/bootstrap/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:3.16 +RUN apk update && apk add --no-cache git cronie busybox-initscripts +RUN rc-service crond start && rc-update add crond +COPY ./bootstrap.sh /bootstrap.sh +COPY ./docker-entrypoint.sh /docker-entrypoint.sh +COPY ./crontab /etc/crontabs/root +ENTRYPOINT ["/bootstrap.sh"] diff --git a/terminaldweller.com/cgit/bootstrap/bootstrap.sh b/terminaldweller.com/cgit/bootstrap/bootstrap.sh new file mode 100755 index 0000000..a943ffb --- /dev/null +++ b/terminaldweller.com/cgit/bootstrap/bootstrap.sh @@ -0,0 +1,64 @@ +#!/bin/sh +set -e + +GIT_REPO_DIR=/etc/gitrepos +ORIGIN_HTTPS=https://github.com/terminaldweller +ORIGIN_SSH=git@github.com:terminaldweller +REPOS="cgrep \ + mutator \ + delf \ + dwasm \ + colo \ + blog \ + devourer \ + hived \ + mdrtl \ + simplex \ + scripts \ + vagrantboxes \ + dockerimages \ + st \ + dmenu \ + tabbed \ + dwm \ + w3m \ + leetcode \ + irssi-scripts \ + jupyter-notebook-docker-compose \ + seer \ + devi-githooks \ + kaminokumo \ + wikis \ + grpc \ + faultreiber \ + luatablegen \ + cfe-extra" + +bootstrap() { + for REPO in ${REPOS}; do + (cd "${GIT_REPO_DIR}" && git clone --bare "${ORIGIN_HTTPS}/${REPO}") + done +} + +update_repos() { + for REPO in ${REPOS}; do + (cd "${GIT_REPO_DIR}/${REPO}" && git fetch) + done +} + +on_startup() { + dir_list=$(ls -A == "$1") + if [ -z "$dir_list" ]; then + bootstrap + else + update_repos + fi +} + +if [ "$1" = "--startup" ]; then + on_startup "$@" +elif [ "$1" = "--update" ]; then + update_repos +elif [ "$1" = "--bootstrap" ]; then + bootstrap +fi diff --git a/terminaldweller.com/cgit/bootstrap/crontab b/terminaldweller.com/cgit/bootstrap/crontab new file mode 100644 index 0000000..2346740 --- /dev/null +++ b/terminaldweller.com/cgit/bootstrap/crontab @@ -0,0 +1 @@ +0 */6 * * * /bootstrap.sh --update diff --git a/terminaldweller.com/cgit/bootstrap/docker-entrypoint.sh b/terminaldweller.com/cgit/bootstrap/docker-entrypoint.sh new file mode 100755 index 0000000..a6ea4d5 --- /dev/null +++ b/terminaldweller.com/cgit/bootstrap/docker-entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +. /bootstrap.sh +on_startup +crond -s -P -f diff --git a/terminaldweller.com/cgit/cgit/Dockerfile b/terminaldweller.com/cgit/cgit/Dockerfile new file mode 100644 index 0000000..247023a --- /dev/null +++ b/terminaldweller.com/cgit/cgit/Dockerfile @@ -0,0 +1,2 @@ +FROM alpine:3.16 +RUN apk add && apk add --no-cache cgit git fcgiwrap highlight diff --git a/terminaldweller.com/cgit/cgit/cgitrc b/terminaldweller.com/cgit/cgit/cgitrc new file mode 100644 index 0000000..3b72aa7 --- /dev/null +++ b/terminaldweller.com/cgit/cgit/cgitrc @@ -0,0 +1,19 @@ +css=/cgit/cgit.css +# logo=/cgit.png + +# git repos go here +scan-path=/srv/git/ + +virtual-root=/ + +# automatically render READMEs +about-file=/usr/lib/cgit/filters/about-formatting.sh +readme:=README.md + +# robots +robots=noindex, nofollow + +include=/etc/cgitrepos + +# syntax highlighting +source-filter=/usr/lib/cgit/filters/syntax-highlighting-edited.sh diff --git a/terminaldweller.com/cgit/cgit/nginx.conf b/terminaldweller.com/cgit/cgit/nginx.conf new file mode 100644 index 0000000..1fea320 --- /dev/null +++ b/terminaldweller.com/cgit/cgit/nginx.conf @@ -0,0 +1,32 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + gzip on; + + server { + listen 80; + + server_name git.terminaldweller.com; + + root /usr/share/git; + + try_files $uri @cgit; + + location @cgit { + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi; + fastcgi_param PATH_INFO $uri; + fastcgi_param QUERY_STRING $args; + fastcgi_param HTTP_HOST $server_name; + fastcgi_pass unix:/run/fcgiwrap.socket; + } + } +} diff --git a/terminaldweller.com/cgit/docker-compose.yaml b/terminaldweller.com/cgit/docker-compose.yaml new file mode 100644 index 0000000..4635764 --- /dev/null +++ b/terminaldweller.com/cgit/docker-compose.yaml @@ -0,0 +1,30 @@ +version: "3" +services: + cgit: + image: cgit + build: + context: ./cgit/ + networks: + - cgitnet + ports: + - "8040:8080" + restart: unless-stopped + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + - ./cgitrc:/etc/cgitrc:ro + - storage:/etc/gitrepos/ + bootstrap: + image: bootstrap + build: + context: ./bootstrap + networks:bootstrapnet + volumes: + - storage:/etc/gitrepos/ + entrypoint: ["/docker-entrypoint.sh"] + cap_drop: + - ALL +networks: + cgitnet: + bootstrapnet: +volumes: + storage: diff --git a/terminaldweller.com/haproxy/haproxy.cfg b/terminaldweller.com/haproxy/haproxy.cfg index 825b2b3..d9ae9e3 100644 --- a/terminaldweller.com/haproxy/haproxy.cfg +++ b/terminaldweller.com/haproxy/haproxy.cfg @@ -42,6 +42,7 @@ frontend http acl editorsave-host hdr_sub(host) -i editorsave.terminaldweller.com acl devourer-host hdr_sub(host) -i mila.terminaldweller.com acl discord-host hdr_sub(host) -i discord.terminaldweller.com + acl rssgen-host hdr_sub(host) -i rssgen.terminaldweller.com acl mila-api-acl url_beg /mila acl crypto-api-acl url_beg /crypto acl http ssl_fc,not @@ -55,6 +56,7 @@ frontend http http-request redirect scheme https code 301 if http api-host !letsencrypt-acl http-request redirect scheme https code 301 if http devourer-host !letsencrypt-acl http-request redirect scheme https code 301 if http searx-host !letsencrypt-acl + # http-request redirect scheme https code 301 if http rssgen-host !letsencrypt-acl #Conditions #use_backend chat-cert-backend if letsencrypt-acl chat-host @@ -66,12 +68,14 @@ frontend http use_backend api-crypto-backend-cert if letsencrypt-acl api-host use_backend api-mila-backend-cert if letsencrypt-acl api-host use_backend searx-backend-cert if letsencrypt-acl searx-host + use_backend searx-backend-cert if letsencrypt-acl rssgen-host # use_backend editor-backend-cert if letsencrypt-acl editor-host use_backend certbot-backend if letsencrypt-acl !chat-host !blog-host !api-host use_backend blog-backend if blog-host use_backend mail-backend if mail-host use_backend api-backend if api-host use_backend searx-backend if searx-host + use_backend rssgen-backend if rssgen-host #use_backend chat-backend if chat-host default_backend blog-backend @@ -333,3 +337,8 @@ backend editorsave-backend-s mode tcp option ssl-hello-chk server cargo-host-s 192.99.102.52:9080 + +backend rssgen-backend + mode http + option forwardfor + server rssgen-host 130.185.121.80:3000 check diff --git a/terminaldweller.com/rss-bridge/docker-compose.yaml b/terminaldweller.com/rss-bridge/docker-compose.yaml new file mode 100644 index 0000000..225c94c --- /dev/null +++ b/terminaldweller.com/rss-bridge/docker-compose.yaml @@ -0,0 +1,16 @@ +version: "3" +services: + rssbridge: + image: rssbridge/rss-bridge:latest + networks: + - rssbridgenet + ports: + - "3000:80" + restart: unless-stopped + # volumes: + # - ./nginx.conf:/etc/nginx/nginx.conf:ro + # - /home/ubuntu/cargo:/cargo + # cap_drop: + # - ALL +networks: + rssbridgenet: -- cgit v1.2.3