This is beta.chaospott.de, an experimental deployment of chaospott.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

44 lines
1.6 KiB

#!/bin/bash
exe() {
echo "running $@"
$@
}
SITE_REPO_DEFAULT="https://git.chaospott.de/chaospott/site.git"
SITE_DOMAIN_DEFAULT="chaospott.de"
REDIRECT_DOMAIN_DEFAULT="www.chaospott.de"
echo "Where should the site store all volumes?"
read -p "PATH: " VOLUMES_PATH_RAW
read -p "Hook endpoint ID (just make something up):" ENDPOINT_ID
read -p "Hook endpoint Password:" ENDPOINT_PW
read -p "Hook Domain (NOT site domain):" HOOK_DOMAIN
read -p "Repo (Default: Repo for chaospott.de):" SITE_REPO
read -p "Domain (Default: chaospott.de):" SITE_DOMAIN
read -p "Domain(s) to redirect (Default: www.chaospott.de)" REDIRECT_DOMAIN
#set defaults
if [ -z "$SITE_REPO" ]; then SITE_REPO="$SITE_REPO_DEFAULT"; fi
if [ -z "$SITE_DOMAIN" ]; then SITE_DOMAIN="$SITE_DOMAIN_DEFAULT"; fi
if [ -z "$REDIRECT_DOMAIN" ]; then REDIRECT_DOMAIN="$REDIRECT_DOMAIN_DEFAULT"; fi
VOLUMES_PATH=$(echo $VOLUMES_PATH_RAW | sed 's/\/$//g')
echo "Creating volumes structure"
exe mkdir -p $VOLUMES_PATH/static
exe git clone $SITE_REPO $VOLUMES_PATH/repo
exe cp -rv configs/webhook $VOLUMES_PATH
echo """[
{
\"id\": \"$ENDPOINT_ID\",
\"execute-command\": \"/webhook/reload.sh\",
\"command-working-directory\": \"/repo\",
\"match\":
{
\"secret\": \"$ENDPOINT_PW\"
}
}
]""" > $VOLUMES_PATH/webhook/hooks.json
echo """DATA_ROOT=$VOLUMES_PATH
WEBHOOK_DOMAIN=$HOOK_DOMAIN
DOMAIN=$SITE_DOMAIN
REDIRECT_DOMAIN=$REDIRECT_DOMAIN""" > .env
exe chmod 777 $VOLUMES_PATH -Rc
echo "configure your git with the following hook URL:"
echo "https://$HOOK_DOMAIN/hooks/$ENDPOINT_ID"