From 36bd4c8588b33ec75460593b2a60b0784cb7db89 Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Wed, 22 Jul 2026 09:53:09 -0400 Subject: [PATCH] Require separate SSH user in Pi deploy script --- docs/deploy-raspberry-pi.md | 13 +++++++------ scripts/deploy-raspi.sh | 15 ++++++++------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/docs/deploy-raspberry-pi.md b/docs/deploy-raspberry-pi.md index 412b0c6..4d1310c 100644 --- a/docs/deploy-raspberry-pi.md +++ b/docs/deploy-raspberry-pi.md @@ -29,14 +29,15 @@ From this repo on your local machine: ```bash chmod +x scripts/deploy-raspi.sh -scripts/deploy-raspi.sh pi@raspberrypi.local git@github.com:YOUR_USER/warehouse.git DietPi.ntp.kentcommunications.com +scripts/deploy-raspi.sh pi raspberrypi.local git@github.com:YOUR_USER/warehouse.git DietPi.ntp.kentcommunications.com ``` Arguments: -- argument 1: SSH target, for example `pi@192.168.1.50` -- argument 2: Git clone URL the Pi can access -- argument 3: nginx `server_name` value, optional, defaults to `DietPi.ntp.kentcommunications.com` +- argument 1: SSH user, for example `pi` +- argument 2: SSH host, for example `192.168.1.50` +- argument 3: Git clone URL the Pi can access +- argument 4: nginx `server_name` value, optional, defaults to `DietPi.ntp.kentcommunications.com` ## Useful environment overrides @@ -44,7 +45,7 @@ Arguments: DEPLOY_REF=main \ DEPLOY_PATH=/var/www/warehouse \ PHP_VERSION=8.2 \ -scripts/deploy-raspi.sh pi@raspberrypi.local git@github.com:YOUR_USER/warehouse.git DietPi.ntp.kentcommunications.com +scripts/deploy-raspi.sh pi raspberrypi.local git@github.com:YOUR_USER/warehouse.git DietPi.ntp.kentcommunications.com ``` ## After deploy @@ -59,4 +60,4 @@ scripts/deploy-raspi.sh pi@raspberrypi.local git@github.com:YOUR_USER/warehouse. - the app serves from `public/`, so the nginx root must stay pointed there - low-stock emails are always queued in this app, so the queue worker service matters in production - this script sets up **HTTP only**; add TLS separately with `certbot` or another reverse-proxy setup if you want HTTPS -- if you prefer MySQL instead of SQLite, update `.env` and the script before rerunning it \ No newline at end of file +- if you prefer MySQL instead of SQLite, update `.env` and the script before rerunning it diff --git a/scripts/deploy-raspi.sh b/scripts/deploy-raspi.sh index f216312..6862480 100644 --- a/scripts/deploy-raspi.sh +++ b/scripts/deploy-raspi.sh @@ -1,19 +1,20 @@ #!/usr/bin/env bash set -euo pipefail -if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then - echo "Usage: scripts/deploy-raspi.sh [domain]" +if [ "$#" -lt 3 ] || [ "$#" -gt 4 ]; then + echo "Usage: scripts/deploy-raspi.sh [domain]" exit 1 fi -ssh_host="$1" -repo_url="$2" -domain="${3:-DietPi.ntp.kentcommunications.com}" +ssh_user="$1" +ssh_host="$2" +repo_url="$3" +domain="${4:-DietPi.ntp.kentcommunications.com}" deploy_path="${DEPLOY_PATH:-/var/www/warehouse}" deploy_ref="${DEPLOY_REF:-main}" php_version="${PHP_VERSION:-8.2}" -ssh "$ssh_host" bash -s -- "$repo_url" "$domain" "$deploy_path" "$deploy_ref" "$php_version" <<'REMOTE' +ssh "${ssh_user}@${ssh_host}" bash -s -- "$repo_url" "$domain" "$deploy_path" "$deploy_ref" "$php_version" <<'REMOTE' set -euo pipefail repo_url="$1" @@ -122,4 +123,4 @@ sudo systemctl restart nginx sudo systemctl restart warehouse-queue.service echo "Deployment complete: http://${domain}" -REMOTE \ No newline at end of file +REMOTE