diff --git a/.gitignore b/.gitignore index a5d457c..69b42b3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ public/media/ cinera/*/ cinera/cinera.conf annotations/ +/hmn +deploy.conf diff --git a/cinera/cinera.conf.sample b/cinera/cinera.conf.sample index 46cf710..5a52038 100755 --- a/cinera/cinera.conf.sample +++ b/cinera/cinera.conf.sample @@ -1,12 +1,12 @@ -export CINERA_REPO_PATH=/home/handmade/src/handmade-dev/cinera/Annotation-System -export CINERA_HMML_PATH=/home/handmade/src/handmade-dev/cinera/cinera_handmade.network -export CINERA_ASSETS_PATH=/home/handmade/src/handmade-dev/hmdev/static/annotations -export CINERA_OUTPUT_PATH=/home/handmade/src/handmade-dev/annotations -export DOMAIN=handmade.local +export CINERA_REPO_PATH=/home/hmn/hmn/cinera/Annotation-System +export CINERA_HMML_PATH=/home/hmn/hmn/cinera/cinera_handmade.network +export CINERA_ASSETS_PATH=/home/hmn/hmn/public/annotations +export CINERA_OUTPUT_PATH=/home/hmn/hmn/annotations +export DOMAIN= export SCHEME=https export CINERA_MONIT_GROUP=cinera -export CINERA_SCRIPT_PATH=/home/handmade/src/handmade-dev/cinera -export ANNOTATIONS_USER=handmade +export CINERA_SCRIPT_PATH=/home/hmn/hmn/cinera +export ANNOTATIONS_USER=annotations # NOTE(asaf): Known-working version as of 2021-08-26 export CINERA_VERSION=6da970d48ca2cee861b7fe2d8f4d7ed6ca9ccce1 diff --git a/cinera/setup.sh b/cinera/setup.sh index 7365617..d98a824 100755 --- a/cinera/setup.sh +++ b/cinera/setup.sh @@ -9,4 +9,4 @@ fi ./update_cinera.sh ./update_annotations.sh -[ -d "data" ] || mkdir data +mkdir -p data diff --git a/monitrc.sample b/monitrc.sample deleted file mode 100644 index 60bb90f..0000000 --- a/monitrc.sample +++ /dev/null @@ -1,54 +0,0 @@ -SET DAEMON 5 -SET LOGFILE /var/log/monit.log -SET STATEFILE /var/lib/monit/state -SET HTTPD UNIXSOCKET /var/run/monit.sock - allow user:pass -SET MAILSERVER - box.handmadedev.org - PORT 587 - USERNAME "noreply@handmadedev.org" - PASSWORD "[FILL THIS IN]" - USING tlsv1 -SET MAIL-FORMAT { - from: noreply@handmadedev.org -reply-to: noreply@handmadedev.org - subject: $SERVICE $EVENT at $DATE - message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION -} -SET ALERT team@handmadedev.org only on { nonexist, instance } - -CHECK PROCESS beta_cinera PIDFILE /home/hmn-beta/srv/cinera/data/cinera.pid - GROUP cinera_beta - START PROGRAM = "/home/hmn-beta/srv/cinera/start.sh" AS UID "annotations" - STOP PROGRAM = "/home/hmn-beta/srv/cinera/stop.sh" AS UID "annotations" - MODE PASSIVE - -CHECK PROCESS live_cinera PIDFILE /home/hmn-live/srv/cinera/data/cinera.pid - GROUP cinera_live - START PROGRAM = "/home/hmn-live/srv/cinera/start.sh" AS UID "annotations" - STOP PROGRAM = "/home/hmn-live/srv/cinera/stop.sh" AS UID "annotations" - MODE PASSIVE - -CHECK PROCESS beta_discord_history PIDFILE /home/hmn-beta/discordhistory.pid - GROUP discord_history_beta - START PROGRAM = "/home/hmn-beta/start_discord_history.sh" AS UID "hmn-beta" - STOP PROGRAM = "/bin/bash -c '/bin/kill `/bin/cat /home/hmn-beta/discordhistory.pid`'" - MODE ACTIVE - -CHECK PROCESS beta_discord_bot PIDFILE /home/hmn-beta/discordbot.pid - GROUP discord_bot_beta - START PROGRAM = "/home/hmn-beta/start_discord_bot.sh" AS UID "hmn-beta" - STOP PROGRAM = "/bin/bash -c '/bin/kill `/bin/cat /home/hmn-beta/discordbot.pid`'" - MODE ACTIVE - -CHECK PROCESS live_discord_history PIDFILE /home/hmn-live/discordhistory.pid - GROUP discord_history_live - START PROGRAM = "/home/hmn-live/start_discord_history.sh" AS UID "hmn-live" - STOP PROGRAM = "/bin/bash -c '/bin/kill `/bin/cat /home/hmn-live/discordhistory.pid`'" - MODE ACTIVE - -CHECK PROCESS live_discord_bot PIDFILE /home/hmn-live/discordbot.pid - GROUP discord_bot_live - START PROGRAM = "/home/hmn-live/start_discord_bot.sh" AS UID "hmn-live" - STOP PROGRAM = "/bin/bash -c '/bin/kill `/bin/cat /home/hmn-live/discordbot.pid`'" - MODE ACTIVE diff --git a/server/Caddyfile b/server/Caddyfile new file mode 100644 index 0000000..c354ea3 --- /dev/null +++ b/server/Caddyfile @@ -0,0 +1,19 @@ +{ + acme_dns cloudflare + order cgi last +} + +, *. { + handle /public/* { + file_server { + root /home/hmn/hmn + } + } + handle { + reverse_proxy localhost:9001 + } +} + +srv.:8888 { + cgi /deploy /home/hmn/hmn/server/deploy_hook.sh +} diff --git a/server/deploy.conf.example b/server/deploy.conf.example new file mode 100644 index 0000000..8bb0ce7 --- /dev/null +++ b/server/deploy.conf.example @@ -0,0 +1 @@ +export GITLAB_SECRET= diff --git a/server/deploy.sh b/server/deploy.sh new file mode 100644 index 0000000..1ab2d1e --- /dev/null +++ b/server/deploy.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# This script should be called with the name +# of the branch to deploy. ($1 will be the +# branch name.) + +set -euo pipefail + +sudo -u hmn bash -s <