From bc3df5c24bba707ed4c9b181495354b08b1478ba Mon Sep 17 00:00:00 2001 From: Mischa Date: Sat, 13 Jun 2026 21:06:48 +0200 Subject: [PATCH] Split SERVER into REMOTE_USER/HOST/HOME, rename USER_REPO to REPO --- .env.example | 7 ++++--- Makefile | 11 +++++++---- scripts/server-install.sh | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index e3429ad..73352f1 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,7 @@ -SERVER=user@example.com -WEBROOT=/home/example.com/public_html -USER_REPO=https://gitea.example.com/user/natascha-rieter.nl-user.git +REMOTE_USER=root +REMOTE_HOST=example.com +REMOTE_HOME=/home/example.com +REPO=https://gitea.example.com/user/natascha-rieter.nl-user.git GITEA_HOST=gitea.example.com GITEA_USER=natascha-deploy diff --git a/Makefile b/Makefile index 1beed04..1fc5049 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ -include .env export +SSH := $(REMOTE_USER)@$(REMOTE_HOST) +WEBROOT := $(REMOTE_HOME)/public_html + # Local dev start: docker compose up -d @@ -22,13 +25,13 @@ content-pull: # Remote remote-install: - ssh $(SERVER) "WEBROOT=$(WEBROOT) USER_REPO=$(USER_REPO) GITEA_HOST=$(GITEA_HOST) GITEA_USER=$(GITEA_USER) GITEA_TOKEN=$(GITEA_TOKEN) bash -s" < scripts/server-install.sh + ssh $(SSH) "WEBROOT=$(WEBROOT) REPO=$(REPO) GITEA_HOST=$(GITEA_HOST) GITEA_USER=$(GITEA_USER) GITEA_TOKEN=$(GITEA_TOKEN) bash -s" < scripts/server-install.sh remote-install-plugins: - ssh $(SERVER) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y" + ssh $(SSH) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y" remote-upgrade-grav: - ssh $(SERVER) "cd $(WEBROOT) && php bin/grav upgrade" + ssh $(SSH) "cd $(WEBROOT) && php bin/grav upgrade" remote-clean: - ssh $(SERVER) "cd $(WEBROOT) && php bin/grav clearcache" + ssh $(SSH) "cd $(WEBROOT) && php bin/grav clearcache" diff --git a/scripts/server-install.sh b/scripts/server-install.sh index a689ffb..e8c95f7 100755 --- a/scripts/server-install.sh +++ b/scripts/server-install.sh @@ -2,7 +2,7 @@ set -e : "${WEBROOT:?WEBROOT is not set}" -: "${USER_REPO:?USER_REPO is not set}" +: "${REPO:?REPO is not set}" : "${GITEA_HOST:?GITEA_HOST is not set}" : "${GITEA_USER:?GITEA_USER is not set}" : "${GITEA_TOKEN:?GITEA_TOKEN is not set}" @@ -18,7 +18,7 @@ echo "==> Cloning user repo" printf 'machine %s\nlogin %s\npassword %s\n' "$GITEA_HOST" "$GITEA_USER" "$GITEA_TOKEN" > ~/.netrc chmod 600 ~/.netrc rm -rf user -git clone "$USER_REPO" user +git clone "$REPO" user rm ~/.netrc echo "==> Setting permissions"