Pass Gitea credentials to remote-install, clean up after clone

This commit is contained in:
2026-06-13 20:53:58 +02:00
parent 643b1ccc61
commit 2b9a926338
3 changed files with 12 additions and 2 deletions
+5 -1
View File
@@ -1,3 +1,7 @@
SERVER=user@example.com
WEBROOT=/home/example.com/public_html
USER_REPO=ssh://git@gitea.example.com:222/user/repo.git
USER_REPO=https://gitea.example.com/user/natascha-rieter.nl-user.git
GITEA_HOST=gitea.example.com
GITEA_USER=natascha-deploy
GITEA_TOKEN=your-token-here
+1 -1
View File
@@ -22,7 +22,7 @@ content-pull:
# Remote
remote-install:
ssh $(SERVER) "WEBROOT=$(WEBROOT) USER_REPO=$(USER_REPO) bash -s" < scripts/server-install.sh
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
remote-install-plugins:
ssh $(SERVER) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y"
+6
View File
@@ -3,6 +3,9 @@ set -e
: "${WEBROOT:?WEBROOT is not set}"
: "${USER_REPO:?USER_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}"
echo "==> Installing PHP extensions"
apt-get install -y php-curl php-gd php-mbstring php-xml php-zip php-yaml php-intl
@@ -15,8 +18,11 @@ mv grav-admin/* grav-admin/.htaccess .
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 "$USER_REPO" user
rm ~/.netrc
echo "==> Setting permissions"
find "$WEBROOT" -type f -exec chmod 664 {} \;