The last few stragglers of server setup

This commit is contained in:
Ben Visness 2021-09-04 16:57:16 -05:00
parent a42973c3cb
commit b70ae9a3c5
2 changed files with 79 additions and 73 deletions

View File

@ -14,6 +14,10 @@ chgrp $ANNOTATIONS_USER_GROUP $CINERA_OUTPUT_PATH
chgrp $ANNOTATIONS_USER_GROUP $CINERA_ASSETS_PATH chgrp $ANNOTATIONS_USER_GROUP $CINERA_ASSETS_PATH
chgrp $ANNOTATIONS_USER_GROUP $CINERA_SCRIPT_PATH chgrp $ANNOTATIONS_USER_GROUP $CINERA_SCRIPT_PATH
chgrp $ANNOTATIONS_USER_GROUP $CINERA_SCRIPT_PATH/data chgrp $ANNOTATIONS_USER_GROUP $CINERA_SCRIPT_PATH/data
chmod 775 $CINERA_OUTPUT_PATH
chmod 775 $CINERA_ASSETS_PATH
chmod 775 $CINERA_SCRIPT_PATH
chmod 775 $CINERA_SCRIPT_PATH/data
./update_cinera.sh ./update_cinera.sh

View File

@ -163,7 +163,6 @@ SCRIPT
echo "https://git.handmade.network/Annotation-Pushers/cinera_handmade.network/-/settings/ci_cd#js-deploy-keys-settings" echo "https://git.handmade.network/Annotation-Pushers/cinera_handmade.network/-/settings/ci_cd#js-deploy-keys-settings"
echo "" echo ""
echo "Run this script again when you're done - it will continue where it left off." echo "Run this script again when you're done - it will continue where it left off."
exit 0
savecheckpoint 81 savecheckpoint 81
@ -252,7 +251,6 @@ if [ $checkpoint -lt 100 ]; then
cp /home/hmn/hmn/src/config/config.go.example /home/hmn/hmn/src/config/config.go cp /home/hmn/hmn/src/config/config.go.example /home/hmn/hmn/src/config/config.go
cp /home/hmn/hmn/server/hmn.conf.example /home/hmn/hmn/server/hmn.conf cp /home/hmn/hmn/server/hmn.conf.example /home/hmn/hmn/server/hmn.conf
cp /home/hmn/hmn/server/deploy.conf.example /home/hmn/hmn/server/deploy.conf
cp /home/hmn/hmn/adminmailer/config.go.example /home/hmn/hmn/adminmailer/config.go cp /home/hmn/hmn/adminmailer/config.go.example /home/hmn/hmn/adminmailer/config.go
cp /home/hmn/hmn/cinera/cinera.conf.sample /home/hmn/hmn/cinera/cinera.conf cp /home/hmn/hmn/cinera/cinera.conf.sample /home/hmn/hmn/cinera/cinera.conf
chown hmn:hmn /home/hmn/hmn/src/config/config.go chown hmn:hmn /home/hmn/hmn/src/config/config.go
@ -298,79 +296,82 @@ SCRIPT
fi fi
cat <<HELP cat <<HELP
Everything has been installed, but before you can run the site, you will need Everything has been successfully installed!
to edit several config files:
${BLUE_BOLD}Caddy${RESET}: /home/caddy/Caddyfile ${BLUE_BOLD}===== Next steps =====${RESET}
Get an API token from Cloudflare and add it to the Caddyfile to allow the First, make sure you have everything on your path:
ACME challenge to succeed. The token must have the Zone / Zone / Read and
Zone / DNS / Edit permissions (as laid out in the following links). source ~/.bashrc
${BLUE_BOLD}Edit the Caddy config${RESET}
Get an API token from Cloudflare. The token must have the Zone / Zone / Read and
Zone / DNS / Edit permissions (as laid out in the following links).
https://github.com/caddy-dns/cloudflare https://github.com/caddy-dns/cloudflare
https://github.com/libdns/cloudflare https://github.com/libdns/cloudflare
Add the Cloudflare token to allow the ACME challenge to succeed, and add Then edit the Caddyfile:
the correct domains. (Don't forget to include both the normal and wildcard
domains.)
Also, in the CGI config, add the name of the Git branch you would like to vim /home/caddy/Caddyfile
use when deploying. For example, a deployment of the beta site should use
the 'beta' branch.
${BLUE_BOLD}Website${RESET}: /home/hmn/hmn/src/config/config.go Add the Cloudflare token to allow the ACME challenge to succeed, and add
the correct domains. (Don't forget to include both the normal and wildcard
domains.)
First make sure you have Go on your path: Also, in the CGI config, add the name of the Git branch you would like to
use when deploying. For example, a deployment of the beta site should use
the 'beta' branch.
source ~/.bashrc ${BLUE_BOLD}Edit the website config${RESET}
Then edit the config file using a special make task: Edit the config file using a special make task:
make edit-config make edit-config
Fill out everything, then rebuild the site: Fill out everything, then rebuild the site:
make build make build
You don't need to deploy the site yet; wait until you've You don't need to deploy the site yet; wait until you've
configured everything. configured everything.
${BLUE_BOLD}HMN Environment Vars${RESET}: /home/hmn/hmn/server/hmn.conf ${BLUE_BOLD}Edit HMN environment vars${RESET}
First, go to GitLab and add a webhook with a secret. Set it to trigger on First, go to GitLab and add a webhook with a secret. Set it to trigger on
push events for the branch you are using for deploys. push events for the branch you are using for deploys.
https://git.handmade.network/hmn/hmn/hooks https://git.handmade.network/hmn/hmn/hooks
Then, edit the above file and fill in all the environment vars, including Then, edit the following file and fill in all the environment vars, including
the secret value from the GitLab webhook. the secret value from the GitLab webhook:
${BLUE_BOLD}Cinera${RESET}: /home/hmn/hmn/cinera/cinera.conf /home/hmn/hmn/server/hmn.conf
Add the correct domain. ${BLUE_BOLD}Configure s3cmd${RESET}
${BLUE_BOLD}s3cmd${RESET}: /home/hmn/.s3cfg Edit the following file:
Add the DigitalOcean Spaces credentials, and ensure that the bucket info is correct. /home/hmn/.s3cfg
${BLUE_BOLD}Admin mailer${RESET}: /home/hmn/hmn/adminmailer/config.go Add the DigitalOcean Spaces credentials, and ensure that the bucket info is correct.
First make sure you have Go on your path: ${BLUE_BOLD}Configure Cinera${RESET}
source ~/.bashrc Edit the following file, adding the correct domain:
Fill in the config file and build the mailer: /home/hmn/hmn/cinera/cinera.conf
${BLUE_BOLD}Configure the admin mailer${RESET}
Fill in the config file and build the mailer:
cd /home/hmn/hmn/adminmailer cd /home/hmn/hmn/adminmailer
vim config.go
go build -o /usr/bin/adminmailer . go build -o /usr/bin/adminmailer .
${BLUE_BOLD}===== Next steps =====${RESET} ${BLUE_BOLD}Download and restore a database backup${RESET}
Make sure you have everything on your path:
source ~/.bashrc
Download and restore a database backup:
make download-database make download-database
@ -378,21 +379,22 @@ Download and restore a database backup:
cd ~ cd ~
hmn migrate --list hmn migrate --list
hmn seedfile <your backup file> <ID of initial migration> hmn seedfile <your backup file> <ID of initial migration>
hmn migrate
Restore static files: ${BLUE_BOLD}Restore static files${RESET}
make restore-static-files make restore-static-files
Set up Cinera: ${BLUE_BOLD}Set up Cinera${RESET}
cd /home/hmn/hmn/cinera cd /home/hmn/hmn/cinera
./setup.sh ./setup.sh
Start up Caddy: ${BLUE_BOLD}Start up Caddy${RESET}
systemctl start caddy systemctl start caddy
Then deploy the site: ${BLUE_BOLD}Deploy the site!${RESET}
make deploy make deploy