Pass Gitea credentials to remote-install, clean up after clone
This commit is contained in:
+5
-1
@@ -1,3 +1,7 @@
|
|||||||
SERVER=user@example.com
|
SERVER=user@example.com
|
||||||
WEBROOT=/home/example.com/public_html
|
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
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ content-pull:
|
|||||||
|
|
||||||
# Remote
|
# Remote
|
||||||
remote-install:
|
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:
|
remote-install-plugins:
|
||||||
ssh $(SERVER) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y"
|
ssh $(SERVER) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y"
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ set -e
|
|||||||
|
|
||||||
: "${WEBROOT:?WEBROOT is not set}"
|
: "${WEBROOT:?WEBROOT is not set}"
|
||||||
: "${USER_REPO:?USER_REPO 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"
|
echo "==> Installing PHP extensions"
|
||||||
apt-get install -y php-curl php-gd php-mbstring php-xml php-zip php-yaml php-intl
|
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
|
rm -rf grav-admin grav-admin.zip
|
||||||
|
|
||||||
echo "==> Cloning user repo"
|
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
|
rm -rf user
|
||||||
git clone "$USER_REPO" user
|
git clone "$USER_REPO" user
|
||||||
|
rm ~/.netrc
|
||||||
|
|
||||||
echo "==> Setting permissions"
|
echo "==> Setting permissions"
|
||||||
find "$WEBROOT" -type f -exec chmod 664 {} \;
|
find "$WEBROOT" -type f -exec chmod 664 {} \;
|
||||||
|
|||||||
Reference in New Issue
Block a user