This guide explains how to provision and configure the production server using Terraform and Ansible.
- Authenticate locally:
gcloud auth application-default login- Install Terraform and the Google Cloud CLI.
- Edit
infra/terraform/main.tfwith your project ID and service account email. - Initialize the working directory:
cd infra/terraform terraform init - Apply the configuration to create the VM and firewall rules:
The public IP output will be used by Ansible.
terraform apply
- Install Ansible.
- Export the environment variables referenced in
infra/ansible/group_vars/all/vault.yml. - Update
infra/ansible/inventory.ymlwith the VM IP and your OS login user. - Run the playbook:
This installs dependencies, sets up PostgreSQL, and configures Gunicorn and Nginx.
cd infra/ansible ansible-playbook -i inventory.yml site.yml