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

[WIP] Building a CLI for migrating between storage backends #1609

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arschles
Copy link
Member

What is the problem I am trying to address?

It's hard to move modules from one storage backend to another. You have to understand the internals of how Athens lays out zip/mod/info files in each backend and then you have to write a script or manually copy.

How is the fix applied?

I've started a CLI that can migrate between any 2 storages that Athens supports. It uses built-in catalog, get and set methods, so any new storages automatically become supported by the CLI next time it's built.

What GitHub issue(s) does this PR fix or close?

Fixes #1604

Copy link
Contributor

@marwan-at-work marwan-at-work left a comment

Choose a reason for hiding this comment

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

Nice work :) I think we should make this a bit more robust per the comment below.

Also, how do we feel about making a cmd/athens that has all the tools we need:

  1. athens server would run the server (and possibly just athens)
  2. athens migrate would run the migration process
  3. athens upload for if we ever implement direct uploads to athens

if err != nil {
return err
}
for _, pathParam := range pathParams {
Copy link
Contributor

Choose a reason for hiding this comment

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

moving storages is likely a very timely process, we should do a couple of things:

  1. Parallelize reads/writes
  2. Check if the destination storage has the module@version first, instead of always overriding it.
  3. Further enhancement: make the migration process resumable, though with 2 it should be good enough i think.

Copy link
Member Author

Choose a reason for hiding this comment

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

@marwan-at-work for (1), I agree that it should be parallelized . I was waiting to see if the general structure of this looks ok.

If you're ok with my suggestion for a follow-up, I can continue on with parallelizing and doing reads before writes in here. Let me know ✌️

@miecio45
Copy link

Thanks for this PR! Great job! In my opinion having everything in single binary is good idea and I agree for parallelization as migrating my test repository took quite a long time.

@arschles
Copy link
Member Author

@miecio45 I'm glad you like this 😄

@marwan-at-work regarding the athens CLI, adding it to the existing cmd/proxy is going to mean a fairly large refactor of main.go. Can we save that for a follow-up?

I'll just add it to cmd/proxy. is that cool with you?

@arschles arschles self-assigned this May 12, 2020
@arschles arschles changed the base branch from master to main June 15, 2020 19:21
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.

Tool for data migration between storage backend
3 participants