Sync local state with remote after untracked local evolution

Local site-ai/ had diverged significantly from the last commit pushed
to Gitea (new remote-env-setup/remove targets, SITE_CONFIG_DIR/MAIN_REPO
split, credential cleanup in server-install.sh, migration docs) without
ever being committed. This catches the repo up to what's actually on disk.

Also untracks the legacy user/ subtree left over from before content was
split into its own standalone repo (natascha-rieter.nl-user) — user/ is
gitignored here and stays a separate git repo, unaffected by this commit.
This commit is contained in:
2026-08-30 14:48:54 +02:00
parent 9f798daaa3
commit 8c93dfd7c9
106 changed files with 1056 additions and 1081 deletions
Regular → Executable
+67 -13
View File
@@ -1,10 +1,13 @@
-include .env
export
SSH := $(REMOTE_USER)@$(REMOTE_HOST)
WEBROOT := $(REMOTE_HOME)/public_html
REMOTE_PORT ?= 22
SSH := ssh -p $(REMOTE_PORT) $(REMOTE_USER)@$(REMOTE_HOST)
WEBROOT ?= $(REMOTE_HOME)/public_html
SITE_CONFIG_DIR ?= $(REMOTE_HOME)/site-config
# ── Local dev ──────────────────────────────────────────────────────────────────
# Local dev
start:
docker compose up -d
@@ -16,25 +19,76 @@ setup: start install-plugins
install-plugins:
docker exec natascha_grav php /app/www/public/bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y
# Content (user repo)
# ── Environment-specific config (git-sync direction) ───────────────────────────
# git-sync's `direction` lives in a shared, synced config file, so setting it
# there fights between environments. These targets instead write it into Grav's
# env/<hostname>/config/... override path, which is gitignored on purpose and
# never syncs. Re-run after a fresh clone/install or a wiped local checkout.
REMOTE_ENV_HOST ?= nieuw.natascha-rieter.nl
configure-env-local:
mkdir -p user/env/localhost/config/plugins user/env/cli/config/plugins
printf 'sync:\n direction: pull\n' | tee user/env/localhost/config/plugins/git-sync.yaml user/env/cli/config/plugins/git-sync.yaml > /dev/null
@echo "Local git-sync pinned to pull-only (user/env/{localhost,cli}/config/plugins/git-sync.yaml)."
# ── Content sync (user repo ↔ Gitea) ──────────────────────────────────────────
content-push:
git subtree push --prefix=user user-deploy main
git -C user push origin main
content-pull:
git subtree pull --prefix=user user-deploy main --squash
git -C user pull origin main
# ── Remote credentials ─────────────────────────────────────────────────────────
remote-env-setup:
@$(SSH) "printf 'GITEA_HOST=%s\nGITEA_USER=%s\nGITEA_TOKEN=%s\n' \
'$(GITEA_HOST)' '$(GITEA_USER)' '$(GITEA_TOKEN)' > ~/.env-natascha && chmod 600 ~/.env-natascha"
@echo "Credentials written to server. Run 'make remote-env-remove' when done."
remote-env-remove:
@$(SSH) "rm -f ~/.env-natascha"
@echo "Credentials removed from server."
# ── Remote: initial install ────────────────────────────────────────────────────
remote-wipe:
$(SSH) "cd $(WEBROOT) && rm -rf assets backup bin cache images logs system tmp vendor webserver-configs index.php .htaccess CHANGELOG.md LICENSE.txt README.md"
# Remote
remote-install:
ssh $(SSH) "WEBROOT=$(WEBROOT) REPO=$(REPO) GRAV_VERSION=$(GRAV_VERSION) PLUGINS='$(shell cat plugins.txt | tr '\n' ' ')' GITEA_HOST=$(GITEA_HOST) GITEA_USER=$(GITEA_USER) GITEA_TOKEN=$(GITEA_TOKEN) bash -s" < scripts/server-install.sh
$(SSH) "WEBROOT=$(WEBROOT) \
SITE_CONFIG_DIR=$(SITE_CONFIG_DIR) \
USER_REPO=$(USER_REPO) \
MAIN_REPO=$(MAIN_REPO) \
GRAV_VERSION=$(GRAV_VERSION) \
PLUGINS='$(shell cat plugins.txt | tr '\n' ' ')' \
GITEA_HOST=$(GITEA_HOST) \
GITEA_USER=$(GITEA_USER) \
GITEA_TOKEN=$(GITEA_TOKEN) \
bash -s" < scripts/server-install.sh
remote-deploy:
ssh $(SSH) "cd $(WEBROOT)/user && git pull && cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y"
# ── Remote: ongoing maintenance ────────────────────────────────────────────────
remote-fetch:
$(SSH) "git -C $(SITE_CONFIG_DIR) pull"
remote-install-plugins:
ssh $(SSH) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y"
$(SSH) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y"
remote-upgrade-grav:
ssh $(SSH) "cd $(WEBROOT) && php bin/grav upgrade"
$(SSH) "cd $(WEBROOT) && php bin/grav upgrade"
remote-clean:
ssh $(SSH) "cd $(WEBROOT) && php bin/grav clearcache"
$(SSH) "cd $(WEBROOT) && php bin/grav clearcache"
remote-maintenance-on:
$(SSH) "bash -s on $(WEBROOT)" < scripts/server-maintenance.sh
remote-maintenance-off:
$(SSH) "bash -s off $(WEBROOT)" < scripts/server-maintenance.sh
remote-configure-env:
$(SSH) "mkdir -p $(WEBROOT)/user/env/$(REMOTE_ENV_HOST)/config/plugins $(WEBROOT)/user/env/cli/config/plugins && \
printf 'sync:\n direction: both\n' | tee $(WEBROOT)/user/env/$(REMOTE_ENV_HOST)/config/plugins/git-sync.yaml $(WEBROOT)/user/env/cli/config/plugins/git-sync.yaml > /dev/null"
@echo "Production git-sync pinned to push+pull for $(REMOTE_ENV_HOST) and cli."