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.

init.sh 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. exe() {
  3. echo "running $@"
  4. $@
  5. }
  6. SITE_REPO_DEFAULT="https://git.chaospott.de/chaospott/site.git"
  7. SITE_DOMAIN_DEFAULT="chaospott.de"
  8. REDIRECT_DOMAIN_DEFAULT="www.chaospott.de"
  9. echo "Where should the site store all volumes?"
  10. read -p "PATH: " VOLUMES_PATH_RAW
  11. read -p "Hook endpoint ID (just make something up):" ENDPOINT_ID
  12. read -p "Hook endpoint Password:" ENDPOINT_PW
  13. read -p "Hook Domain (NOT site domain):" HOOK_DOMAIN
  14. read -p "Repo (Default: Repo for chaospott.de):" SITE_REPO
  15. read -p "Domain (Default: chaospott.de):" SITE_DOMAIN
  16. read -p "Domain(s) to redirect (Default: www.chaospott.de)" REDIRECT_DOMAIN
  17. #set defaults
  18. if [ -z "$SITE_REPO" ]; then SITE_REPO="$SITE_REPO_DEFAULT"; fi
  19. if [ -z "$SITE_DOMAIN" ]; then SITE_DOMAIN="$SITE_DOMAIN_DEFAULT"; fi
  20. if [ -z "$REDIRECT_DOMAIN" ]; then REDIRECT_DOMAIN="$REDIRECT_DOMAIN_DEFAULT"; fi
  21. VOLUMES_PATH=$(echo $VOLUMES_PATH_RAW | sed 's/\/$//g')
  22. echo "Creating volumes structure"
  23. exe mkdir -p $VOLUMES_PATH/static
  24. exe git clone $SITE_REPO $VOLUMES_PATH/repo
  25. exe cp -rv configs/webhook $VOLUMES_PATH
  26. echo """[
  27. {
  28. \"id\": \"$ENDPOINT_ID\",
  29. \"execute-command\": \"/webhook/reload.sh\",
  30. \"command-working-directory\": \"/repo\",
  31. \"match\":
  32. {
  33. \"secret\": \"$ENDPOINT_PW\"
  34. }
  35. }
  36. ]""" > $VOLUMES_PATH/webhook/hooks.json
  37. echo """DATA_ROOT=$VOLUMES_PATH
  38. WEBHOOK_DOMAIN=$HOOK_DOMAIN
  39. DOMAIN=$SITE_DOMAIN
  40. REDIRECT_DOMAIN=$REDIRECT_DOMAIN""" > .env
  41. exe chmod 777 $VOLUMES_PATH -Rc
  42. echo "configure your git with the following hook URL:"
  43. echo "https://$HOOK_DOMAIN/hooks/$ENDPOINT_ID"