Skip to content

Commit 97858a3

Browse files
committed
docs(readme): bootstrap documentation
Signed-off-by: Theo Bob Massard <tbobm@protonmail.com>
1 parent fd02770 commit 97858a3

File tree

1 file changed

+59
-6
lines changed

1 file changed

+59
-6
lines changed

README.md

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,67 @@
1-
# Boostrapping databases for local and prod
1+
# Database Bootstrapping — Local and Production setup
22

3-
## Content
3+
This repository provides an example of how to manage PostgreSQL databases
4+
using **schema as code** (with [Atlas](https://atlasgo.io)) and
5+
**infrastructure as code** (via Docker Compose and Terraform).
46

5-
- infra: infrastructure as code for RDS / ECS migration task
6-
- db-as-code: setup for managing databases using atlas
7-
- cicd: example automation and tooling for handling databases with github action
7+
It supports both local development and cloud deployment with CI/CD workflows.
88

9-
## Setup
9+
> Based on the article: [**“Bootstrapping SQL databases for local and production setup”**][article]
10+
11+
## Features
12+
13+
- **Docker Compose** setup for local PostgreSQL + Atlas CLI
14+
- **Atlas** schema definition, migrations, and deployment logic
15+
- **Terraform** resources for:
16+
- ECS Task Definition to run DB migrations
17+
- ECR repository to store migration images
18+
- **Github Actions** CI/CD pipeline to:
19+
- Build + push migration containers
20+
- Run one-off ECS tasks to apply migrations
21+
- Validate success or failure automatically
22+
23+
## Local development
24+
25+
### Start local setup
1026

1127
```console
1228
$ docker compose up -d --wait --quiet-pull db
1329
$ docker compose run -it atlas schema inspect -u "postgres://user:pass@db:5432/local_db?sslmode=disable"
1430
```
31+
32+
## Production deployment
33+
34+
> Provision AWS infrastructure using Terraform.
35+
36+
```bash
37+
cd terraform
38+
terraform init
39+
terraform apply
40+
```
41+
42+
Outputs will include:
43+
- ECS Cluster and Task Definition
44+
- ECR repository URL
45+
46+
## Migrations via Github Actions
47+
48+
The included workflow (`.github/workflows/migrate.yml`) can be triggered manually:
49+
50+
1. Builds migration image from latest schema + migration files
51+
2. Pushes to ECR
52+
3. Runs a one-off ECS Fargate task to apply changes
53+
4. Fails safely if the task fails
54+
55+
## Tools Used
56+
57+
- [Atlas](https://atlasgo.io/) – schema and migration management
58+
- [Docker Compose](https://docs.docker.com/compose/) – local dev
59+
- [Terraform](https://www.terraform.io/) – cloud infrastructure
60+
- [Github Actions](https://docs.github.com/en/actions) – deployment automation
61+
62+
## Related
63+
64+
- Blog article: [Bootstrapping SQL Databases][article]
65+
- Atlas documentation: https://atlasgo.io
66+
67+
[article]: https://blog.tbobm.dev/posts/db-bootstrapping/

0 commit comments

Comments
 (0)