moth

Monarch Of The Hill game server
git clone https://git.woozle.org/neale/moth.git

moth / docs
Neale Pickett  ·  2022-11-29

administration.md

  1Administration
  2=========
  3
  4Everything you need to do happens through the filesystem.
  5Usually, in `/srv/moth/state`.
  6
  7The server doesn't cache anything in memory,
  8so the `state` directory always contains the current state.
  9
 10
 11Backing up current state
 12---------------------------
 13
 14    tar czf backup.tar.gz /srv/moth/state  # Full backup
 15    curl http://localhost:8080/state > state.json  # Pull anonymized event log and team names (scoreboard)
 16
 17
 18
 19Scheduling an automatic pause and resume
 20-----------------------------------
 21
 22    printf '-'; date --rfc-3339=s -d '10:00 PM' >> /srv/moth/state/hours.txt  # Schedule suspend at 10:00 PM
 23    printf '+'; date --rfc-3339=s -d '08:00 tomorrow' >> /srv/moth/state/hours.txt # Schedule resume at 08:00 tomorrow
 24
 25You might prefer to open `/srv/moth/state/hours.txt` in a text editor.
 26I do.
 27
 28
 29Re-initalize
 30-------------------
 31
 32    rm /srv/moth/state/initialized
 33
 34This will reset the following:
 35
 36* team registrations
 37* points log
 38
 39Team tokens stick around, though.
 40
 41
 42Scores
 43=======
 44
 45Pausing/resuming scoring
 46-------------------
 47
 48    echo '-###' >> /srv/moth/state/hours.txt # Suspend scoring
 49    sed -i '/###/d' /srv/moth/state/hours.txt # Resume scoring
 50
 51When scoring is paused,
 52participants can still submit answers,
 53and the system will tell them whether the answer is correct.
 54As soon as you unpause,
 55all correctly-submitted answers will be scored.
 56
 57
 58Adjusting scores
 59------------------
 60
 61    echo '-###' >> /srv/moth/state/hours.txt # Suspend scoring
 62    nano /srv/moth/state/points.log  # Replace nano with your preferred editor
 63    sed -i '/###/d' /srv/moth/state/hours.txt # Resume scoring
 64
 65We don't warn participants before we do this:
 66any points scored while scoring is suspended are queued up and processed as soon as scoreing is resumed.
 67
 68It's very important to suspend scoring before mucking around with the points log.
 69The maintenance loop assumes it is the only thing writing to this file,
 70and any edits you make will remove points scored while you were editing.
 71
 72
 73Teams
 74=====
 75
 76Changing a team name
 77----------------------
 78
 79    grep . /srv/moth/state/teams/*  # Show all team IDs and names
 80    echo 'exciting new team name' > /srv/moth/state/teams/$teamid
 81
 82Please remember, you have to replace `$teamid` with the actual team ID that you want to edit.
 83
 84
 85Setting up custom team IDs
 86-------------------
 87
 88    echo > /srv/moth/state/teamids.txt  # Teams must be registered manually
 89    seq 9999 > /srv/moth/state/teamids.txt  # Allow all 4-digit numbers
 90
 91`teamids.txt` is a list of acceptable team IDs,
 92one per line.
 93You can make it anything you want.
 94
 95New instances will initialize this with some hex values.
 96
 97Remember that team IDs are essentially passwords.
 98
 99
100Disabling team registration
101---------------------
102
103`teamids.txt` contains a list of team IDs accepted for registration.
104If you don't want teams to self-register,
105zero out the list:
106
107    true > /srv/moth/state/teamids.txt
108
109
110Manually registering a team
111------------------
112
113    teamid=e2f8cc14
114    echo "Cool Team Name" > /srv/moth/state/teams/$teamid
115
116
117Dealing with puzzles
118===========
119
120Checking on an answer
121----------------------
122
123Mothballs are just zip files.
124If you need to check something about a running category,
125just unzip the mothball for that category.
126
127    mkdir /tmp/category
128    cd /tmp/category
129    unzip /srv/moth/mothballs/category.zip
130    cat answers.txt  # Show all valid answers for all puzzles. Watch your shoulder!
131
132
133Installing new categories
134-------------------
135
136Just drop a new mothball in the `mothballs' directory.
137
138    cp new-category.mb /srv/moth/mothballs
139
140
141Taking a category offline
142-------------------------
143
144    rm /srv/moth/mothballs/old-category.mb
145
146Removing a category won't remove points that have been scored in it!