site-deploy/init.sh

29 lines
913 B
Bash
Raw Normal View History

2020-07-05 15:56:22 +00:00
#!/bin/bash
exe() {
echo "running $@"
$@
}
SITE_REPO="https://git.chaospott.de/zehka/site.git"
echo "Where should the site store all volumes?"
read -p "PATH: " VOLUMES_PATH
read -p "Hook endpoint ID (just make something up):" ENDPOINT_ID
read -p "Hook endpoint Password:" ENDPOINT_PW
echo "Creating volumes structure"
exe mkdir $VOLUMES_PATH
exe git clone $SITE_REPO $VOLUMES_PATH/repo
2020-07-05 16:22:00 +00:00
exe cp -rv configs/webhook $VOLUME
2020-07-05 15:56:22 +00:00
echo """[
{
\"id\": \"$ENDPOINT_ID\",
\"execute-command\": \"/webhook/reload.sh\",
\"command-working-directory\": \"/repo\",
\"match\":
{
\"secret\": \"$ENDPOINT_PW\"
}
}
]""" > $VOLUMES_PATH/webhook/hooks.json
VOLUMES_PATH_SANITIZED=$(echo $VOLUMES_PATH | sed 's/\/$//g')
echo "DATA_ROOT=$VOLUMES_PATH_SANITIZED" > .env
2020-07-05 16:04:13 +00:00
exe chmod 777 $VOLUMES_PATH -Rc