https://github.com/hanchiang/market-data-notification-infra
Automate provision of cloud infrastructure and application deployment.
https://github.com/hanchiang/market-data-notification-infra
ansible automation aws iac packer terraform
Last synced: 3 months ago
JSON representation
Automate provision of cloud infrastructure and application deployment.
- Host: GitHub
- URL: https://github.com/hanchiang/market-data-notification-infra
- Owner: hanchiang
- Created: 2023-01-01T08:40:03.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2026-03-25T14:39:57.000Z (3 months ago)
- Last Synced: 2026-03-25T18:48:23.220Z (3 months ago)
- Topics: ansible, automation, aws, iac, packer, terraform
- Language: Shell
- Homepage: https://www.yaphc.com/automating-infrastructure-provisioning-configuration-and-application-deployment
- Size: 142 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Agents: AGENTS.md
Awesome Lists containing this project
README


This project is the infrastructure as code management for [Market data notification](https://github.com/hanchiang/market-data-notification) using AWS.
# Structure
* [`images/`](images): Packer files for building AMI
* `image.pkr.hcl`: Main packer script
* `scripts/`: Scripts to be run when provisioning AMI
* [`instances/`](instances): Terraform files to provision EC2 in VPC
* `main.tf`: Main terraform script
* `ansible/`: Ansible scripts to run post-provisioning tasks such as mounting EBS volume, set up file system, copy postgres data, setup SSL for nginx
* `scripts/`: Scripts that automate the post-provisioning flow: EC2 start and stop, DNS updates, and backend deployment.
# Workflow
## 1. Provision EC2 AMI using packer
Provisions a EBS-backed EC2 AMI, and install the necessary softwares for [Market data notification](https://github.com/hanchiang/market-data-notification):
* redis
* docker
* nginx
cd into [`images/`](images)
Define variables that are declared in `image.pkr.hcl` in a new file `variables.auto.pkrvars.hcl`
Build image: `packer build -machine-readable -var-file variables.auto.pkrvars.hcl image.pkr.hcl | tee build.log`
## 2. Provision EC2 using terraform
cd into [`instances/`](instances)
Copy the AMI ID from packer build, update it in `variables.tf`
Provision infra: `terraform apply`
Everything from here onwards is handled in `instances/scripts/start.sh`
## 3. Run ansible script
Run post-provisioning configurations such as setting up DNS, configuring nginx SSL
## 4. Deploy application
Rerun the latest deploy job in github action
# Diagram
