nixos: backend server

This commit is contained in:
Antoine Thouvenin 2022-08-06 22:31:18 +02:00 committed by Pierre-Olivier Mercier
commit 643ecb1e14
24 changed files with 542 additions and 5 deletions

8
configs/synchro.sh Normal file → Executable file
View file

@ -4,19 +4,19 @@
# retrieves submissions
BASEDIR="/srv"
FRONTEND_HOSTNAME="deimos"
FRONTEND_HOSTNAME="synchro@deimos"
SSH_OPTS="/usr/bin/ssh -p 22 -i ~/.ssh/id_ed25519 -o ControlMaster=auto -o ControlPath=/root/.ssh/%r@%h:%p -o ControlPersist=2 -o PasswordAuthentication=no -o StrictHostKeyChecking=no"
SSH_OPTS="ssh -p 22 -i ~/.ssh/id_ed25519 -o ControlMaster=auto -o ControlPath=/root/.ssh/%r@%h:%p -o ControlPersist=2 -o PasswordAuthentication=no -o StrictHostKeyChecking=no"
cd "${BASEDIR}"
touch /tmp/stop
# Establish first ssh connection for controlpersist socket, to avoid delay during time synchronization
${SSH_OPTS} ls > /dev/null
${SSH_OPTS} ${FRONTEND_HOSTNAME} ls > /dev/null
# Synchronize the date one time
${SSH_OPTS} date -s @"$(date +%s)"
${SSH_OPTS} ${FRONTEND_HOSTNAME} date -s @"$(date +%s)"
# Synchronize static files in a separate loop (to avoid submissions delays during file synchronization)
while ! [ -f SETTINGS/stop ] || [ /tmp/stop -nt SETTINGS/stop ]