Skip to content

fix: Use immutable names for volumes in example templates #3663

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

Closed
wants to merge 4 commits into from

Conversation

mafredri
Copy link
Member

This contributes towards #3000, #3386

Related #3409

NOTE: When this is merged, our release notes should make a mention / warning about updating to our example templates as doing so will very likely result in data loss (due to volume name changes).

@mafredri mafredri requested a review from ammario as a code owner August 24, 2022 13:22
@mafredri mafredri self-assigned this Aug 24, 2022
@mafredri mafredri requested a review from a team August 24, 2022 13:22
Copy link
Member

@deansheather deansheather left a comment

Choose a reason for hiding this comment

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

Have these been tested? I expected some of these names have length limits which will be hit by stringing together two UUIDs. Why not only use the workspace ID instead of both the user ID and the workspace ID instead?

Also, I don't think these should be merged until we've decided what upgrade strategy we want to put into our changelog. Are we going to tell people that they need to make a new template and abandon their old workspaces?

@mafredri mafredri closed this Aug 24, 2022
@mafredri mafredri deleted the mafredri/stable-volume-names-in-templates branch August 24, 2022 13:35
@mafredri
Copy link
Member Author

Dogfood thing fails due to tagging with branch name (containing /), tried renaming the branch but that closed this PR instead. 😔

@deansheather I've tested Docker, but have not tested others (I can do a test on DO, but don't have setups for any others). Hmm, we could probably stick to only using the workspace UUID though 👍🏻. One motivation behind using both is additional metadata, but that would be amended by e.g. #3048.

@mafredri mafredri force-pushed the mafredri/stable-volume-names-in-templates branch from cc34cc6 to ed59636 Compare August 26, 2022 13:25
@mafredri
Copy link
Member Author

mafredri commented Aug 26, 2022

Have these been tested? I expected some of these names have length limits which will be hit by stringing together two UUIDs. Why not only use the workspace ID instead of both the user ID and the workspace ID instead?

I've made the change to single UUID. 👍🏻

Also, I don't think these should be merged until we've decided what upgrade strategy we want to put into our changelog. Are we going to tell people that they need to make a new template and abandon their old workspaces?

They can keep using their existing templates if they wish, but they should be vary of updating volume names to match that of these updated examples because that will result in loss of volumes.

BREAKING CHANGE: We have updated all example templates to use immutable UUID-based volume names (#3663). Note that changing volume names in an existing template will result in data loss for all workspaces that are updated. If you would like to update your own templates to match, please delete all existing workspaces as a precaution to avoid situations where data is unexpectedly lost at a later time.

See #3386 for more discussion around this topic.

Thoughts @deansheather?

@ammario ammario removed their request for review August 29, 2022 15:51
@github-actions
Copy link

github-actions bot commented Sep 6, 2022

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Sep 6, 2022
@mafredri mafredri removed the stale This issue is like stale bread. label Sep 6, 2022
@github-actions
Copy link

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Sep 14, 2022
@github-actions github-actions bot closed this Sep 18, 2022
@mafredri mafredri reopened this Sep 19, 2022
@mafredri mafredri removed the stale This issue is like stale bread. label Sep 19, 2022
@github-actions
Copy link

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Sep 27, 2022
@github-actions github-actions bot closed this Sep 30, 2022
@mafredri
Copy link
Member Author

mafredri commented Oct 5, 2022

@deansheather ping on this #3663 (comment)

@deansheather @kylecarbs thoughts? Do we still want to merge this change? Or do we want to combine it with some other changes? Or do something else entirely?

@deansheather
Copy link
Member

I'd change the text to say that we don't recommend updating templates, and instead renaming the old one and creating a new template so users can migrate their data across. Hopefully we don't need to do this again.

@mafredri
Copy link
Member Author

Updated text:

BREAKING CHANGE: We have updated all example templates to use immutable UUID-based volume names (#3663). Note that changing volume names in an existing template will result in data loss for all workspaces that are updated. We do not recommend updating existing templates to match because of the risk of losing user workspace volumes, instead, rename the old template and upload a new one that users can migrate to.

See #3386 for more discussion around this topic.

@mafredri mafredri reopened this Oct 14, 2022
@mafredri mafredri removed the stale This issue is like stale bread. label Oct 14, 2022
@mafredri mafredri requested a review from deansheather October 14, 2022 11:03
Comment on lines -84 to +83
<<EOT
trap '[ $? -ne 0 ] && echo === Agent script exited with non-zero code. Sleeping infinitely to preserve logs... && sleep infinity' EXIT
${replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")}
EOT
"sh", "-c", replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")
Copy link
Member

Choose a reason for hiding this comment

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

This may make debugging harder since the container will get immediately deleted AFAIK

Copy link
Member Author

Choose a reason for hiding this comment

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

We already have a trap in the bootstrap script, I think this is a remnant from a past implementation before that change.

This one also uses sleep infinity which isn’t compatible with all docker images.

@github-actions
Copy link

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Oct 22, 2022
@ammario
Copy link
Member

ammario commented Oct 24, 2022

We can use the ignore_changes = all lifecycle attribute to merge this in a non-breaking way.

@mafredri
Copy link
Member Author

We can use the ignore_changes = all lifecycle attribute to merge this in a non-breaking way.

It could definitely be a good addition, I'll try it out (I'm a bit worried about how Terraform will interpret this for existing resources that lack it, which might not help with the non-breakage).

@ammario
Copy link
Member

ammario commented Oct 27, 2022

We can use the ignore_changes = all lifecycle attribute to merge this in a non-breaking way.

It could definitely be a good addition, I'll try it out (I'm a bit worried about how Terraform will interpret this for existing resources that lack it, which might not help with the non-breakage).

I tried it out already in our dogfood image and it doesn't invalidate the resource. The lifecycle block is not included in the state file, it's a "meta block" so to speak.

@github-actions github-actions bot removed the stale This issue is like stale bread. label Oct 28, 2022
@github-actions
Copy link

github-actions bot commented Nov 5, 2022

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Nov 5, 2022
@github-actions github-actions bot closed this Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This issue is like stale bread.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants