euchre-live

Euchre web-app for the socially distant family
git clone git://git.alexkarle.com/euchre-live.git
Log | Files | Refs | README | LICENSE

commit 02a65f788ce236aadcec24c0da31ec80aabcf563 (patch)
parent 409716b0cd84dd015c7368bc86b940d0d1659fb7
Author: Alex Karle <alex@alexkarle.com>
Date:   Wed, 23 Dec 2020 17:41:34 -0500

make: Update release target to use rc.d init script

The whole restart.sh model was... well, clever but also pretty wacky!

I've been running under the rc.d script for a while now, which has many
advantages (but most importantly means I can reboot the server and have
the service come back online...).

So this patch removes the whole concept of preprod vs prod (we aren't editing
the code much these days!) as well as restart.sh. Ah. Much simpler.

Diffstat:
MMakefile | 11+++--------
Dbin/restart.sh | 52----------------------------------------------------
2 files changed, 3 insertions(+), 60 deletions(-)

diff --git a/Makefile b/Makefile @@ -35,14 +35,9 @@ release: build test git show HEAD --pretty=full -s |\ sed 's/\(Author\|Commit\): \([^<]\+\).*/\1: \2<redacted>/' > build/public/version.txt rsync -av --delete --rsh="ssh -o StrictHostKeyChecking=no" \ - build/ _euchre@euchre.live:preprod-el/ - ssh -o StrictHostKeyChecking=no _euchre@euchre.live \ - env FORCE=$(FORCE) sh restart.sh preprod - -.PHONY: release-prod -release-prod: release - ssh -o StrictHostKeyChecking=no _euchre@euchre.live \ - env FORCE=$(FORCE) UPDATE=1 sh restart.sh prod + build/ _euchre@euchre.live:prod-el/ + ssh -t -o StrictHostKeyChecking=no euchre.live \ + doas rcctl restart euchre .PHONY: clean clean: diff --git a/bin/restart.sh b/bin/restart.sh @@ -1,52 +0,0 @@ -#!/bin/sh -# no more tmux for daemons -# A safe restart script to be run on the server -set -e -die() { - echo "$1" 1>&2 - exit 1 -} - -HOST=localhost - -restart() { - name="$1" - port="$2" - if pgrep -f "gloat.pl.*$port"; then - if [ -z "$FORCE" ]; then - curl -s $HOST:$port/stats | grep -q "0 Players" || die "Players on server" - fi - - printf "%s" "Killing old server... " - pkill -f "gloat.pl.*$port" - sleep 2 # not needed? - echo "Check!" - fi - - if [ -n "$UPDATE" ]; then - printf "%s" "Updating preprod -> prod..." - rm -rf $HOME/prod-el - cp -a $HOME/preprod-el $HOME/prod-el - echo "Check!" - fi - - if [ $name = "preprod" ]; then - export MOJO_MODE=development - else - export MOJO_MODE=production - fi - - printf "%s" "Starting new server... " - $HOME/${name}-el/gloat.pl daemon -l http://*:$port >> /var/log/gloat/$name.log 2>&1 & - sleep 2 - echo "Check!" - - curl -s $HOST:$port/stats | grep "Server Start" -} - -# Decide which server to restart based on the first arg -case "$1" in - preprod) restart "preprod" 3001 ;; - prod) restart "prod" 3000 ;; - *) die "usage: restart.sh prod|preprod" ;; -esac