Skip to content

Oneoff migration pegasus.storage_apps => dashboard.projects - #45476

Merged
maureensturgeon merged 6 commits into
stagingfrom
maureen/LP-2267-storage-apps-prod-migration
Mar 28, 2022
Merged

Oneoff migration pegasus.storage_apps => dashboard.projects#45476
maureensturgeon merged 6 commits into
stagingfrom
maureen/LP-2267-storage-apps-prod-migration

Conversation

@maureensturgeon

@maureensturgeon maureensturgeon commented Mar 24, 2022

Copy link
Copy Markdown
Contributor

This is the one-off migration to be run on production to move the pegasus storage_apps table to dashboard with the name projects. A view with the old name is created for the time between when the migration is run in production and when we flip the DCDO flag to point the code at the new table name.

To roll out this change:

  1. Run the migration with ruby bin/oneoff/move_storage_apps_to_dashboard
  2. Set the DCDO flag with DCDO.set('storage_apps_in_dashboard', true)

To roll back the change:

  1. Set the DCDO flag with DCDO.set('storage_apps_in_dashboard', false)
  2. Revert the migration with ruby bin/oneoff/move_storage_apps_to_dashboard --revert

Links

Testing story

I've tested the steps to roll out and roll back the migration locally, verifying that projects load as expected at every step.
To Do:

  • work with Infra to run this migration while tests are running in the test env
  • Do more thorough testing of more scenarios locally (maureen)

Deployment strategy

These code changes will be deployed and when we're ready we'll work with Infra to find a time to run the migration.

Follow-up work

Once the migration has been run in production, we'll want to merge #45480 so that every environment will match production.

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@maureensturgeon
maureensturgeon force-pushed the maureen/LP-2267-storage-apps-prod-migration branch from 85a1750 to b036b43 Compare March 24, 2022 21:41
Base automatically changed from maureen/consolidate-storage-apps-refs to staging March 25, 2022 00:11
@maureensturgeon
maureensturgeon marked this pull request as ready for review March 25, 2022 20:02
@maureensturgeon
maureensturgeon requested review from a team March 25, 2022 20:03
Comment thread dashboard/lib/projects_list.rb Outdated
def fetch_featured_projects_by_type(project_type)
storage_apps = "#{CDO.pegasus_db_name}__storage_apps".to_sym

storage_apps_table = DCDO.get('storage_apps_in_dashboard', false) ? "#{CDO.dashboard_db_name}__projects".to_sym : "#{CDO.pegasus_db_name}__#{table_name}".to_sym

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to qualify table_name with StorageApps here? Or maybe just hardcode it in?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops! This was an artifact of not being able to decide what to do. I'll hard-code it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a side-note, this shows that we do not have very good test coverage around this, since no tests failed 😬

@@ -0,0 +1,69 @@
require File.expand_path('../../../pegasus/src/env', __FILE__)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not critical, but we have a convention to make our one-off scripts shell scripts by setting the first line to:

#!/usr/bin/env ruby

And making the file executable (an attribute that can be committed in git):
chmod +x bin/oneoff/move_storage_apps_to_dashboard.rb

And typically renaming to drop the .rb extension.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sureshc when I run chmod +x bin/oneoff/move_storage_apps_to_dashboard.rb I don't see any changes to commit, should I?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try setting filemode = true in [repository]/.git/config?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look like this command would accomplish the same:
git config core.filemode true

@sureshc sureshc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m so excited about this! 😀

@maureensturgeon
maureensturgeon merged commit 564d806 into staging Mar 28, 2022
@maureensturgeon
maureensturgeon deleted the maureen/LP-2267-storage-apps-prod-migration branch March 28, 2022 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants