From 27f4fdf00ba5be3852e7d5e2388995e93896ec31 Mon Sep 17 00:00:00 2001 From: Karl Ostmo Date: Sun, 12 May 2024 20:59:38 -0700 Subject: [PATCH] more deployment documentation --- tournament/scripts/deploy/README.md | 5 +++++ tournament/scripts/deploy/nginx/README.md | 9 +++++++++ .../deploy/nginx/swarm-server-block.conf | 18 ++++++++++++++++++ tournament/scripts/deploy/systemd/README.md | 4 ++++ .../scripts/deploy/systemd/run-webserver.sh | 3 +++ .../deploy/systemd/swarm-tournament.service | 14 ++++++++++++++ 6 files changed, 53 insertions(+) create mode 100644 tournament/scripts/deploy/README.md create mode 100644 tournament/scripts/deploy/nginx/README.md create mode 100644 tournament/scripts/deploy/nginx/swarm-server-block.conf create mode 100644 tournament/scripts/deploy/systemd/README.md create mode 100755 tournament/scripts/deploy/systemd/run-webserver.sh create mode 100644 tournament/scripts/deploy/systemd/swarm-tournament.service diff --git a/tournament/scripts/deploy/README.md b/tournament/scripts/deploy/README.md new file mode 100644 index 000000000..9c25c173f --- /dev/null +++ b/tournament/scripts/deploy/README.md @@ -0,0 +1,5 @@ +In these scripts, `lightsail` has been set up as a host alias +in `/etc/hosts` for the AWS Lightsail instance. + +Additional configuraion (`.pem` file and remote username) +is specified in `~/.ssh/config`. \ No newline at end of file diff --git a/tournament/scripts/deploy/nginx/README.md b/tournament/scripts/deploy/nginx/README.md new file mode 100644 index 000000000..8f5c8fb92 --- /dev/null +++ b/tournament/scripts/deploy/nginx/README.md @@ -0,0 +1,9 @@ +Place in: +``` +/etc/nginx/sites-available/ +``` +or in +``` +/opt/bitnami/nginx/conf/server_blocks/ +``` +if using bitnami. \ No newline at end of file diff --git a/tournament/scripts/deploy/nginx/swarm-server-block.conf b/tournament/scripts/deploy/nginx/swarm-server-block.conf new file mode 100644 index 000000000..faa6f8a86 --- /dev/null +++ b/tournament/scripts/deploy/nginx/swarm-server-block.conf @@ -0,0 +1,18 @@ +server { + listen 80; + listen [::]:80; + + listen 443 ssl; + listen [::]:443 ssl; + + ssl_certificate /opt/bitnami/nginx/conf/swarmgame.net.crt; + ssl_certificate_key /opt/bitnami/nginx/conf/swarmgame.net.key; + + server_name swarmgame.net; + + location / { + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $http_host; + proxy_pass "http://127.0.0.1:5500"; + } +} diff --git a/tournament/scripts/deploy/systemd/README.md b/tournament/scripts/deploy/systemd/README.md new file mode 100644 index 000000000..75f43b3b3 --- /dev/null +++ b/tournament/scripts/deploy/systemd/README.md @@ -0,0 +1,4 @@ +Place `swarm-tournament.service` in: +``` +/etc/systemd/system/swarm-tournament.service +``` \ No newline at end of file diff --git a/tournament/scripts/deploy/systemd/run-webserver.sh b/tournament/scripts/deploy/systemd/run-webserver.sh new file mode 100755 index 000000000..1ece6a5e4 --- /dev/null +++ b/tournament/scripts/deploy/systemd/run-webserver.sh @@ -0,0 +1,3 @@ +#!/bin/bash -xe + +./tournament-bin --version $(cat git-hash.txt) --port 5500 diff --git a/tournament/scripts/deploy/systemd/swarm-tournament.service b/tournament/scripts/deploy/systemd/swarm-tournament.service new file mode 100644 index 000000000..9dd2dd2b5 --- /dev/null +++ b/tournament/scripts/deploy/systemd/swarm-tournament.service @@ -0,0 +1,14 @@ +[Unit] +Description=Swarm tournament host +After=network.target +StartLimitIntervalSec=0 +[Service] +Type=simple +Restart=always +RestartSec=5 +User=bitnami +WorkingDirectory=/home/bitnami +ExecStart=/usr/bin/env ./run-webserver.sh + +[Install] +WantedBy=multi-user.target