/blog-infra

Some fancy scripts and yamls for my blog infrastructure... gosh just use docker already, Jesus.

GNU Affero General Public License v3.0AGPL-3.0

🚧 Infra has moved 🚧

New repo link: https://github.com/i9or/blog -> infra folder.

Blog Infrastructure

Some fancy scripts and yamls for my blog infrastructure... gosh just use docker already, Jesus.

Requirements

  • ansible v2.12+

Keys

Key generation:

ssh-keygen -t ed25519 -C "user@example.com" -f ./keys/production_key
ssh-keygen -t ed25519 -C "user@example.com" -f ./keys/staging_key

Key naming:

  • production_key — SSH key for production deploy user
  • staging_key — SSH key for staging deploy user

Note: ./keys/ folder should be added to .gitignore!

Provision

Some steps are still manual, host that needs to be provisioned have to have deploy user.

To provision staging environment:

ansible-playbook staging-provision.yml 

Another manual step is to run pm2 startup command and follow its instruction.

The same goes for production environment, but production-provision.yml playbook needs to be used.

Environment variables

Sometimes PM2 doesn't start services with new environment variables. Command below forces PM2 to update environment variables to the latest version:

ansible staging -a "pm2 restart all -a"