Files
kokkoja-rel/deploy/deploy.sh
T

28 lines
1.2 KiB
Bash
Raw Normal View History

2026-10-06 15:58:02 +02:00
#!/bin/bash
# Deploy the Kokkoja server: copy the relay, the client and the server
# files to the VPS, then run deploy/setup_vps.sh there. Run from the
# project directory on a development machine.
#
# deploy/deploy.sh
#
# KOKKOJA_SERVER names the ssh destination (default root@vps313847.iceservers.net).
# The site's config.json is written here: the relay and site addresses
# below are the server's public names.
set -euo pipefail
cd "$(dirname "$0")/.."
server=${KOKKOJA_SERVER:-root@vps313847.iceservers.net}
site=https://kokkoja.andykopra.com/
relay=wss://kokkoja.andykopra.com/relay
staging=$(mktemp -d)
trap 'rm -rf "$staging"' EXIT
mkdir -p "$staging/relay" "$staging/client" "$staging/deploy"
cp relay/kokkoja_relay.py relay/requirements.txt "$staging/relay/"
rsync -a --exclude '__pycache__' client/ "$staging/client/"
printf '{"relay": "%s", "storage": "browser", "site": "%s"}\n' "$relay" "$site" > "$staging/client/config.json"
cp deploy/kokkoja-relay.service deploy/nginx-site.conf deploy/setup_vps.sh "$staging/deploy/"
ssh "$server" 'mkdir -p /opt/kokkoja/incoming'
rsync -a --delete "$staging/" "$server:/opt/kokkoja/incoming/"
ssh "$server" 'bash /opt/kokkoja/incoming/deploy/setup_vps.sh'