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?"
|
2020-07-05 16:38:38 +00:00
|
|
|
read -p "PATH: " VOLUMES_PATH_RAW
|
2020-07-05 15:56:22 +00:00
|
|
|
read -p "Hook endpoint ID (just make something up):" ENDPOINT_ID
|
|
|
|
read -p "Hook endpoint Password:" ENDPOINT_PW
|
2020-07-05 16:38:38 +00:00
|
|
|
read -p "Hook Domain (NOT site domain):" HOOK_DOMAIN
|
|
|
|
VOLUMES_PATH=$(echo $VOLUMES_PATH_RAW | sed 's/\/$//g')
|
2020-07-05 15:56:22 +00:00
|
|
|
echo "Creating volumes structure"
|
2020-07-05 16:52:04 +00:00
|
|
|
exe mkdir -p $VOLUMES_PATH/static
|
2020-07-05 15:56:22 +00:00
|
|
|
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
|
2020-07-05 16:38:38 +00:00
|
|
|
echo """DATA_ROOT=$VOLUMES_PATH
|
|
|
|
WEBHOOK_DOMAIN=$HOOK_DOMAIN""" > .env
|
2020-07-05 16:04:13 +00:00
|
|
|
exe chmod 777 $VOLUMES_PATH -Rc
|
2020-07-05 16:38:38 +00:00
|
|
|
echo "configure your git with the following hook URL:"
|
|
|
|
echo "https://$HOOK_DOMAIN/hooks/$ENDPOINT_ID"
|