diff --git a/.env.example b/.env.example index e3429ad..1463f23 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,6 @@ SERVER=user@example.com WEBROOT=/home/example.com/public_html +WEBROOT_USER=example.com USER_REPO=https://gitea.example.com/user/natascha-rieter.nl-user.git GITEA_HOST=gitea.example.com diff --git a/Makefile b/Makefile index 1beed04..7fba698 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ 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 $(SERVER) "WEBROOT=$(WEBROOT) WEBROOT_USER=$(WEBROOT_USER) 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" diff --git a/scripts/server-install.sh b/scripts/server-install.sh index 6afd471..57455da 100755 --- a/scripts/server-install.sh +++ b/scripts/server-install.sh @@ -2,14 +2,12 @@ set -e : "${WEBROOT:?WEBROOT is not set}" +: "${WEBROOT_USER:?WEBROOT_USER 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 - echo "==> Downloading Grav" cd "$WEBROOT" wget -q https://getgrav.org/download/core/grav-admin/latest -O grav-admin.zip @@ -25,6 +23,7 @@ git clone "$USER_REPO" user rm ~/.netrc echo "==> Setting permissions" +chown -R "$WEBROOT_USER":"$WEBROOT_USER" "$WEBROOT" find "$WEBROOT" -type f -exec chmod 664 {} \; find "$WEBROOT" -type d -exec chmod 775 {} \;