-
Notifications
You must be signed in to change notification settings - Fork 8
Add .gitignore and pgcopydb infrastructure templates #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
teknogeek0
wants to merge
2
commits into
main
Choose a base branch
from
add/gitignore-and-templates-readme
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # AI assistant config | ||
| CLAUDE.md | ||
|
|
||
| # Environment and secrets | ||
| .env | ||
| *.env | ||
| .env.* | ||
|
|
||
| # Terraform | ||
| .terraform/ | ||
| *.tfstate | ||
| *.tfstate.* | ||
| *.tfvars | ||
| *.tfvars.json | ||
| crash.log | ||
| override.tf | ||
| override.tf.json | ||
| *_override.tf | ||
| *_override.tf.json | ||
| .terraform.lock.hcl | ||
|
|
||
| # pgcopydb migration artifacts | ||
| migration_*/ | ||
| filters.ini | ||
| *.log | ||
| core.* | ||
|
|
||
| # Editor | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
| .vscode/ | ||
| .idea/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # pgcopydb Migration Instance Templates | ||
|
|
||
| Infrastructure-as-code templates for provisioning a migration instance pre-configured with [pgcopydb](https://github.com/planetscale/pgcopydb) and the [PlanetScale migration helper scripts](../pgcopydb-helpers/). Each template creates a compute instance running Ubuntu 24.04 that installs pgcopydb, PostgreSQL client tools, and the helper scripts at boot. | ||
|
|
||
| ## Available Templates | ||
|
|
||
| | Template | Platform | Tool | README | | ||
| |----------|----------|------|--------| | ||
| | [AWS CloudFormation](./aws-cloudformation/) | AWS EC2 | CloudFormation | [README](./aws-cloudformation/README-pgcopydb-cfn.md) | | ||
| | [AWS Terraform](./aws-terraform/) | AWS EC2 | Terraform | [README](./aws-terraform/README-pgcopydb-aws-tf.md) | | ||
| | [GCP Terraform](./gcp-terraform/) | GCP Compute Engine | Terraform | [README](./gcp-terraform/README-pgcopydb-gcp.md) | | ||
|
|
||
| All three templates produce an equivalent migration instance — choose based on your cloud provider and preferred provisioning tool. | ||
|
|
||
| ## What Gets Provisioned | ||
|
|
||
| - A compute instance with pgcopydb and PostgreSQL 17 client tools | ||
| - An attached data volume for migration working data | ||
| - Network and access configuration (security group/firewall rule, IAM/SSH via SSM or IAP) | ||
| - Migration helper scripts from this repo deployed to `/home/ubuntu/` | ||
|
|
||
| ## After Provisioning | ||
|
|
||
| Once the instance is running, connect to it and follow the [migration workflow](../pgcopydb-helpers/README.md#migration-workflow) starting with setting up `~/.env` and `~/filters.ini`. |
46 changes: 46 additions & 0 deletions
46
pgcopydb-templates/aws-cloudformation/README-pgcopydb-cfn.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # PlanetScale Migration — pgcopydb Migration Instance (AWS CloudFormation) | ||
|
|
||
| ## What This Does | ||
|
|
||
| This CloudFormation template creates an EC2 instance pre-configured with | ||
| [pgcopydb](https://pgcopydb.readthedocs.io/), the tool PlanetScale uses to migrate | ||
| your PostgreSQL data. The instance runs Ubuntu 24.04 and pulls the latest | ||
| [PlanetScale migration helper scripts](https://github.com/planetscale/migration-scripts) | ||
| at boot. | ||
|
|
||
| ## What Gets Created | ||
|
|
||
| - An EC2 instance with pgcopydb and PostgreSQL client tools installed | ||
| - An EBS volume for migration working data | ||
| - A security group for network access | ||
| - An IAM instance profile with SSM Session Manager access | ||
| - Migration helper scripts from `github.com/planetscale/migration-scripts` in `/home/ubuntu/` | ||
|
|
||
| ## How to Deploy | ||
|
|
||
| ### Prerequisites | ||
| - The IAM role from Step 1 must be deployed first | ||
| - VPC ID and a subnet ID where the instance should run | ||
| - The restored database from Step 3 must be accessible from this subnet | ||
|
|
||
| ### Steps | ||
|
|
||
| 1. **Upload** the `pgcopydb-migration-instance.yaml` template to CloudFormation | ||
| 2. **Fill in** VPC ID, Subnet ID, instance type, and volume size | ||
| 3. **Deploy** and wait for completion (~10 minutes) | ||
| 4. **Connect** via SSM Session Manager (no SSH key needed): | ||
| ```bash | ||
| aws ssm start-session --target INSTANCE_ID | ||
| ``` | ||
|
|
||
| ## How to Tear Down | ||
|
|
||
| Delete the CloudFormation stack to remove the instance and all associated resources: | ||
|
|
||
| ```bash | ||
| aws cloudformation delete-stack --stack-name YOUR_STACK_NAME | ||
| ``` | ||
|
|
||
| ## Questions? | ||
|
|
||
| Contact your PlanetScale migration team representative. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, these prerequisites don't make any sense to me.