summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSt33v <github@f3rr3t.com>2026-03-25 18:23:14 +1100
committerSt33v <github@f3rr3t.com>2026-03-25 18:23:14 +1100
commitc132b3985e24e557549544a1d10fb0daababdfb1 (patch)
tree03a22b64a9d0742f3313b23a6ec0acee31fbc4c9
parent0b7ad7787794e7e0f14eb3e6ada7139fd1b47c78 (diff)
Update cremonde deployment and runtime checks
-rw-r--r--README.md26
-rwxr-xr-xdeploy.sh4
-rw-r--r--nginx/pestrel.com.conf2
-rwxr-xr-xsetup.sh26
-rwxr-xr-xsynopticChart.sh16
5 files changed, 60 insertions, 14 deletions
diff --git a/README.md b/README.md
index 5c2a195..0312369 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,32 @@ Script can download most recent pdf and convert it to a scaled png file
* write a timer service
* 'xdg-open' the png file in its own workspace (in i3 window manager)
+## Deployment
+
+Current deployment target:
+
+Item | Value
+-----|------
+VPS | `cremonde`
+Site | `pestrel.com`
+Nginx web root | `/srv/www/pestrel/`
+Latest published image | `/srv/www/pestrel/synopticLatest.png`
+App install dir | `/opt/synoptic`
+
+Runtime dependencies on the VPS:
+
+- `curl`
+- `imagemagick`
+- `ghostscript`
+- `nginx`
+
+Relevant scripts:
+
+File | Purpose
+-----|--------
+`setup.sh` | Install systemd units, nginx config, and web content on `cremonde`
+`deploy.sh` | Copy `synopticChart.sh` to `cremonde` and restart `synoptic.service`
+
Files:
diff --git a/deploy.sh b/deploy.sh
index bb1badb..36d50e9 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -1,14 +1,14 @@
#!/bin/bash
set -euo pipefail
-REMOTE=st33v@pestrel.com
+REMOTE=st33v@cremonde
PORT=40022
echo "Deploying synopticChart.sh to ${REMOTE}..."
scp -P "$PORT" synopticChart.sh "${REMOTE}:/opt/synoptic/synopticChart.sh"
echo "Restarting synoptic.service..."
-if ssh -p "$PORT" "$REMOTE" "sudo systemctl restart synoptic.service"; then
+if ssh -t -p "$PORT" "$REMOTE" "sudo systemctl restart synoptic.service"; then
echo "SUCCESS: synoptic.service ran cleanly."
else
echo "FAILURE: synoptic.service exited non-zero." >&2
diff --git a/nginx/pestrel.com.conf b/nginx/pestrel.com.conf
index 372c321..95c7310 100644
--- a/nginx/pestrel.com.conf
+++ b/nginx/pestrel.com.conf
@@ -9,7 +9,7 @@ server {
listen [::]:80;
server_name pestrel.com www.pestrel.com;
- root /srv/www;
+ root /srv/www/pestrel;
index index.html;
location / {
diff --git a/setup.sh b/setup.sh
index 14c2eec..f2707d9 100755
--- a/setup.sh
+++ b/setup.sh
@@ -1,7 +1,7 @@
#!/bin/bash
set -euo pipefail
-# Run once on pestrel as root (or with sudo) to install the synoptic service.
+# Run once on cremonde as root (or with sudo) to install the synoptic service.
# Usage: sudo ./setup.sh
if [ "$(id -u)" -ne 0 ]; then
@@ -13,6 +13,12 @@ SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
OWNER=st33v
# ---------------------------------------------------------------------------
+# Packages
+# ---------------------------------------------------------------------------
+echo "==> Installing required packages..."
+pacman -Sy --needed --noconfirm curl imagemagick ghostscript nginx
+
+# ---------------------------------------------------------------------------
# Nginx conflict checks
# ---------------------------------------------------------------------------
echo "==> Checking for nginx conflicts..."
@@ -45,13 +51,15 @@ install -d -o "$OWNER" -g "$OWNER" /opt/synoptic
install -d -o "$OWNER" -g "$OWNER" /var/lib/synoptic
install -d -o "$OWNER" -g "$OWNER" /var/lib/synoptic/archive
install -d -o "$OWNER" -g "$OWNER" /var/lib/synoptic/archive/raw
-install -d -o "$OWNER" -g "$OWNER" /srv/www
+install -d /srv/www
+install -d -o "$OWNER" -g "$OWNER" /srv/www/pestrel
+chown "$OWNER:$OWNER" /srv/www/pestrel
# ---------------------------------------------------------------------------
# Web content
# ---------------------------------------------------------------------------
echo "==> Writing index.html..."
-install -o "$OWNER" -g "$OWNER" -m 644 "$SCRIPT_DIR/index.html" /srv/www/index.html
+install -o "$OWNER" -g "$OWNER" -m 644 "$SCRIPT_DIR/index.html" /srv/www/pestrel/index.html
# ---------------------------------------------------------------------------
# Systemd units
@@ -69,14 +77,14 @@ systemctl enable --now synoptic.timer
# ---------------------------------------------------------------------------
# Nginx
# ---------------------------------------------------------------------------
-echo "==> Installing nginx config..."
-install -m 644 "$SCRIPT_DIR/nginx/pestrel.com.conf" /etc/nginx/conf.d/synoptic.conf
+#echo "==> Installing nginx config..."
+#install -m 644 "$SCRIPT_DIR/nginx/pestrel.com.conf" /etc/nginx/conf.d/synoptic.conf
-echo "==> Testing nginx config..."
-nginx -t
+#echo "==> Testing nginx config..."
+#nginx -t
-echo "==> Reloading nginx..."
-systemctl reload nginx
+#echo "==> Reloading nginx..."
+#systemctl reload nginx
# ---------------------------------------------------------------------------
echo "==> Done."
diff --git a/synopticChart.sh b/synopticChart.sh
index f209beb..059665d 100755
--- a/synopticChart.sh
+++ b/synopticChart.sh
@@ -5,11 +5,23 @@ set -euo pipefail
# Download BOM synoptic chart (IDY00030) and publish as PNG.
# BOM permits anonymous FTP for personal use.
# Charts are valid at 00, 06, 12, 18 UTC; files appear ~2h later.
-# Deployed to /opt/synoptic/synopticChart.sh on pestrel.com.
+# Deployed to /opt/synoptic/synopticChart.sh on cremonde for pestrel.com.
ARCHIVE_DIR=/var/lib/synoptic/archive
RAW_DIR=/var/lib/synoptic/archive/raw
-LATEST=/srv/www/synopticLatest.png
+LATEST=/srv/www/pestrel/synopticLatest.png
+
+require_cmd() {
+ local cmd="$1"
+ if ! command -v "$cmd" >/dev/null 2>&1; then
+ echo "Required command not found: ${cmd}" >&2
+ exit 127
+ fi
+}
+
+require_cmd curl
+require_cmd magick
+require_cmd gs
# Return the datetime string for the most recently published chart slot.
# BOM chart slots: 0000, 0600, 1200, 1800 UTC.