diff --git a/.gitignore b/.gitignore index a4ac09e..1a9ef4e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.env bibliogram/ nitter/ +omgur/ config/ diff --git a/build.bibliogram.sh b/build.bibliogram.sh deleted file mode 100755 index e09aaf8..0000000 --- a/build.bibliogram.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -set -e - -REPO_URL=https://git.sr.ht/~cadence/bibliogram -REPO_DIR_PATH=bibliogram - -# If repo exists update, else clone it -if [ -d "$REPO_DIR_PATH" ]; then - # Save the root dir path, enter the repo, pull new changes and come back - ROOT_DIR=$(pwd) - cd "$REPO_DIR_PATH" - git pull - cd "$ROOT_DIR" -else - git clone "$REPO_URL" "$REPO_DIR_PATH" -fi diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..73171b0 --- /dev/null +++ b/build.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +echo "Updating nitter..." +./build.updaterepo.sh https://github.com/zedeus/nitter.git nitter +echo "Updating bibliogram..." +./build.updaterepo.sh https://git.sr.ht/~cadence/bibliogram bibliogram +echo "Updating omgur..." +./build.updaterepo.sh https://git.geraldwu.com/gerald/omgur.git omgur +echo "Done." diff --git a/build.nitter.sh b/build.updaterepo.sh similarity index 81% rename from build.nitter.sh rename to build.updaterepo.sh index 21c35f1..959e495 100755 --- a/build.nitter.sh +++ b/build.updaterepo.sh @@ -2,8 +2,8 @@ set -e -REPO_URL=https://github.com/zedeus/nitter.git -REPO_DIR_PATH=nitter +REPO_URL="${1}" +REPO_DIR_PATH="${2}" # If repo exists update, else clone it if [ -d "$REPO_DIR_PATH" ]; then diff --git a/docker-compose.yml b/docker-compose.yml index da54087..72ac79e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,6 +42,29 @@ services: networks: - socials + omgur-redis: + image: ${OMGR_IMG:-redis:6-alpine} + container_name: ${OMGR_CONTAINER_NAME:-omgur-redis} + restart: ${OMGR_RESTART:-unless-stopped} + environment: + - REDIS_REPLICATION_MODE=master + networks: + - socials + + omgur: + build: + context: omgur/ + container_name: ${OMG_CONTAINER_NAME:-omgur} + restart: ${OMG_RESTART:-unless-stopped} + environment: + - REDIS_HOST=omgur-redis + expose: + - 8080 + networks: + - socials + depends_on: + - omgur-redis + volumes: db: diff --git a/nginx.env.example b/nginx.env.example index ac7cd57..ee2a1bc 100644 --- a/nginx.env.example +++ b/nginx.env.example @@ -10,6 +10,10 @@ NI_HOSTNAME= NI_ADDR=nitter NI_PORT=8080 +OMG_HOSTNAME= +OMG_ADDR=omgur +OMG_PORT=8080 + NGINX_LISTEN_PORT=80 # Reverse-proxy and certbot diff --git a/nginx/root/etc/nginx/conf.d/default.template b/nginx/root/etc/nginx/conf.d/default.template index 6d87c1a..81f3f03 100644 --- a/nginx/root/etc/nginx/conf.d/default.template +++ b/nginx/root/etc/nginx/conf.d/default.template @@ -20,6 +20,13 @@ upstream nitter { server ${NI_ADDR}:${NI_PORT}; } +upstream omgur { + # Cannot connect to network of this container + server 127.0.0.1 down; + ## Can be connected with the network + server ${OMG_ADDR}:${OMG_PORT}; +} + server { # This is a catch-all hostname (it will never trigger on a real hostname). # If an access by IP or by an unhandled domain linking to this IP is tried, @@ -80,3 +87,21 @@ server { } } + +server { + listen ${NGINX_LISTEN_PORT}; + server_name ${OMG_HOSTNAME}; + + # Disable do not add the server version in the header + server_tokens off; + + location / { + proxy_pass http://omgur; + } + + location = /robots.txt { + add_header Content-Type text/plain; + return 200 "User-agent: *\nDisallow: /\n"; + } + +}