Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Latest commit

 

History

History
53 lines (36 loc) · 1.71 KB

README.md

File metadata and controls

53 lines (36 loc) · 1.71 KB

sqldef GitOps CDK

There are serveral approaches to the database table migration. This project introduces one of the approach, GitOps with AWS CDK by leveraging sqldef. sqldef is a idempotent schema management tool. So it has a high affinity for GitOps. You can use this project as a skeleton so that acquire the maintainable table migration from the beginning.

Architecture

Step-by-Step Guide

Install the dependencies

npm install

Bootstrap CDK (Skip if you already did it.)

npx cdk bootstrap

Deployment

npx cdk deploy

After the deployment, push this code to AWS CodeCommit. The CodeCommit repository was created by the deployment above. Read Setup for HTTPS users using Git credentials.

The git push will trigger the AWS Step Functions execution. Visit StateMachine and confirm the AWS CodeBuild execution logs.

How does the "GitOps" work?

Modify /sql/tables.sql to add new table or new columns. Then push the code again to trigger the new execution. You can confirm that the new ALTER query is applied to the database.

Why Step Functions?

Database-related CI/CD may require complex CI/CD flows in the future, including rollback and adaptation to staging environments. CodePipeline can also be used in the current CI/CD flow.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.