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
+37 -9
View File
@@ -2,26 +2,42 @@
set -e
: "${WEBROOT:?WEBROOT is not set}"
: "${REPO:?REPO is not set}"
: "${SITE_CONFIG_DIR:?SITE_CONFIG_DIR is not set}"
: "${USER_REPO:?USER_REPO is not set}"
: "${MAIN_REPO:?MAIN_REPO is not set}"
: "${GRAV_VERSION:?GRAV_VERSION is not set}"
: "${PLUGINS:?PLUGINS is not set}"
: "${GITEA_HOST:?GITEA_HOST is not set}"
: "${GITEA_USER:?GITEA_USER is not set}"
: "${GITEA_TOKEN:?GITEA_TOKEN is not set}"
trap 'rm -f ~/.netrc' EXIT
echo "==> Setting up credentials (temporary)"
printf 'machine %s\nlogin %s\npassword %s\n' "$GITEA_HOST" "$GITEA_USER" "$GITEA_TOKEN" > ~/.netrc
chmod 600 ~/.netrc
echo "==> Downloading Grav $GRAV_VERSION"
cd "$WEBROOT"
wget -q "https://getgrav.org/download/core/grav-admin/$GRAV_VERSION" -O grav-admin.zip
unzip -q grav-admin.zip
mv grav-admin/* grav-admin/.htaccess .
wget --no-verbose "https://getgrav.org/download/core/grav-admin/$GRAV_VERSION" -O grav-admin.zip
unzip -oq grav-admin.zip
cp -rf grav-admin/. .
rm -rf grav-admin grav-admin.zip
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 "$REPO" user
rm ~/.netrc
git clone "$USER_REPO" user
echo "==> Cloning main config repo to $SITE_CONFIG_DIR"
if [ -d "$SITE_CONFIG_DIR/.git" ]; then
git -C "$SITE_CONFIG_DIR" pull
else
rm -rf "$SITE_CONFIG_DIR"
git clone "$MAIN_REPO" "$SITE_CONFIG_DIR"
fi
echo "==> Creating required directories"
mkdir -p user/plugins user/accounts user/data
echo "==> Installing plugins"
php bin/gpm install $PLUGINS -y
@@ -30,4 +46,16 @@ echo "==> Setting permissions"
find "$WEBROOT" -type f -exec chmod 664 {} \;
find "$WEBROOT" -type d -exec chmod 775 {} \;
echo "==> Done. Visit your domain to complete setup."
echo "==> Removing temporary credentials"
rm -f ~/.netrc
echo ""
echo "==> Done."
echo ""
echo "NEXT STEP — add this server's SSH public key to both Gitea repos as a deploy key"
echo "so that 'make remote-fetch' and future git pulls work without credentials:"
echo ""
cat ~/.ssh/id_rsa.pub 2>/dev/null || cat ~/.ssh/id_ed25519.pub 2>/dev/null || \
echo " No SSH key found. Generate one on the server: ssh-keygen -t ed25519 -C 'server-deploy'"
echo ""
echo "Visit your domain to complete Grav setup."
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
set -e
if [ "$#" -ne 2 ]; then
echo "Usage: server-maintenance.sh on|off <webroot>"
exit 1
fi
MODE="$1"
WEBROOT="$2"
CONFIG="$WEBROOT/user/config/system.yaml"
if [ "$MODE" != "on" ] && [ "$MODE" != "off" ]; then
echo "Usage: server-maintenance.sh on|off <webroot>"
exit 1
fi
[ -f "$CONFIG" ] || { echo "Not found: $CONFIG"; exit 1; }
VALUE="false"
[ "$MODE" = "on" ] && VALUE="true"
if grep -q "^[[:space:]]*offline:" "$CONFIG"; then
sed -i "s/^\([[:space:]]*\)offline: .*/\1offline: $VALUE/" "$CONFIG"
else
printf '\npages:\n offline: %s\n' "$VALUE" >> "$CONFIG"
fi
echo "Maintenance mode: $MODE (offline: $VALUE)"