2020-07-05 15:56:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
exe() {
|
|
|
|
echo "running $@"
|
|
|
|
$@
|
|
|
|
}
|
2020-07-05 16:24:25 +00:00
|
|
|
SITE_REPO="https://git.chaospott.de/chaospott/site.git"
|
2020-07-05 15:56:22 +00:00
|
|
|
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
|