Skip to content
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

MIgrate Micromasters resources into management by Pulumi #1090

Closed
4 tasks done
blarghmatey opened this issue Sep 20, 2022 · 9 comments · Fixed by #1380
Closed
4 tasks done

MIgrate Micromasters resources into management by Pulumi #1090

blarghmatey opened this issue Sep 20, 2022 · 9 comments · Fixed by #1380

Comments

@blarghmatey
Copy link
Member

blarghmatey commented Sep 20, 2022

User Story

As a platform engineer I want to make sure that the Micromasters application and its infrastructure resources are being managed in the same way as all of our other systems.

Description/Context

The Micromasters application was set up before our current usage of Pulumi and before we had established some of the patterns that led to the creation of the apps VPC. The result is that the RDS instance used in production was created in its own VPC and the Vault policies are managed via Salt code which is being actively deprecated. There are also associated S3 buckets that were created either manually or via Salt and are not being actively managed by Pulumi.

Acceptance Criteria

  • Create a Pulumi project for managing the Micromasters infrastructure resources
  • Either import or recreate the Micromasters RDS instance in the applications VPC using Pulumi
  • Import the S3 buckets used by Micromasters into the stack state for the Pulumi project
  • Remove the associated code (e.g. Vault policies, S3 bucket management, etc.) from the salt-ops project
@blarghmatey blarghmatey assigned blarghmatey and unassigned mitangelo Jan 13, 2023
@blarghmatey blarghmatey assigned feoh and unassigned blarghmatey Jan 31, 2023
feoh added a commit that referenced this issue Feb 8, 2023
feoh added a commit that referenced this issue Feb 9, 2023
feoh added a commit that referenced this issue Feb 10, 2023
feoh added a commit that referenced this issue Feb 24, 2023
feoh added a commit that referenced this issue Mar 8, 2023
feoh added a commit that referenced this issue Mar 8, 2023
feoh added a commit that referenced this issue Mar 8, 2023
feoh added a commit that referenced this issue Mar 8, 2023
@feoh feoh closed this as completed in #1380 Mar 9, 2023
feoh added a commit that referenced this issue Mar 9, 2023
…d RDS (#1380)

#1090 - Code to transition bespoke Heroku managed database instances and associated s3 buckets under Pulumi management.
@feoh
Copy link
Contributor

feoh commented Mar 10, 2023

Re-opening because we still need to transition the actual production Heroku app.

@feoh feoh reopened this Mar 10, 2023
@feoh
Copy link
Contributor

feoh commented Apr 3, 2023

At @pdpinch's suggestion @annagav tested Micromasters RC last week and says it looks good from her perspective. I'll coordinate with @shaidar to see what needs to happen to get our ducks in a row so we can migrate production.

@feoh
Copy link
Contributor

feoh commented Apr 4, 2023

Necessary steps to finish migration in production:

  • Schedule production migration date with @pdpinch and @blarghmatey
  • Get the salt-proxy service on the prod salt master configured and running so that we can populate the Heroku configs. - @shaidar
  • Actually perform the migration - @feoh

@blarghmatey
Copy link
Member Author

To help determine when to schedule the cutover @feoh will be doing a trial run of the dump/load of Postgres in the production environment so that we can collect timing information and identify any variance from the RC process.

feoh added a commit that referenced this issue Apr 5, 2023
feoh added a commit that referenced this issue Apr 5, 2023
@feoh
Copy link
Contributor

feoh commented Apr 6, 2023

Exact steps for migration with timings and rollback sequence:

@2:30 PM EDT

@feoh will put the micromasters production app into maint. mode and trigger the database transfer.

heroku maintenance:on -a micromasters
cd ~/src/mit/heroku
pg_dump -x -O $HEROKU_DATABASE_URL > micromasters_heroku_prod_db_dump.sql
psql $RDS_DATABASE_URL < ./micromasters_heroku_prod_db_dump.sql

@2:40 PM EDT

@shaidar will trigger the Salt proxy update:

salt proxy-micromasters-production state.sls heroku.update_heroku_config

@feoh will trigger a catch-up s3 sync and upon ack. of completion from @shaidur take the app out of maint. mode:

heroku maintenance:off -a micromasters
aws s3 sync s3://odl-micromasters-production s3://ol-micromasters-app-production

@2:50 PM EDT

@pdpinch @feoh and @annagav will spot check and 'smoke test' micromasters production and declare success or need for rollback.

Rollback

@shaidar will revert the Salt proxy configuration to prior values using saved data.

# include specific invocations to enact rollback here.

@blarghmatey
Copy link
Member Author

I would say that you can actually take it out of maintenance mode prior to finalizing the S3 sync

@feoh
Copy link
Contributor

feoh commented Apr 6, 2023

Current status:

The database transfer and migration were successful. However, we are having problems transitioning the CDN to the new CloudFront distribution we created, so we're still using the old S3 bucket.

The team will reconvene tomorrow and troubleshoot this remaining issue, but as of now production is up and all tests look good.

@feoh
Copy link
Contributor

feoh commented Apr 7, 2023

All set as of yesterday evening! \o/

@feoh feoh closed this as completed Apr 7, 2023
@feoh
Copy link
Contributor

feoh commented Apr 24, 2023

Post-work resource clean-up list:

## ci

Postgres:
heroku-postgresql (postgresql-rigid-71273)  mini   $5/month   created

### S3:
2016-04-11 10:42:30 odl-micromasters-ci

## rc/qa

### Postgres:
heroku-postgresql (postgresql-amorphous-36035)  basic     $9/month   created

### S3:
2016-04-11 10:42:42 odl-micromasters-rc

## Production

### Postgres
micromasters-db.cbnm7ajau6mi.us-east-1.rds.amazonaws.com
- Also read replica:
  - micromasters-db-read-replica.cbnm7ajau6mi.us-east-1.rds.amazonaws.com

### S3
2016-04-11 10:42:51 odl-micromasters-production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants