Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wipe deployment ID and any other Coder-specific information before imaging #180

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
bpmct opened this issue Sep 30, 2024 · 3 comments · Fixed by #211
Closed

Wipe deployment ID and any other Coder-specific information before imaging #180

bpmct opened this issue Sep 30, 2024 · 3 comments · Fixed by #211
Assignees

Comments

@bpmct
Copy link
Member

bpmct commented Sep 30, 2024

Somehow, all marketplace installs in our telemetry have the same deployment ID. When we are running the 999-cleanup.sh script let's make sure we wipe whatever is being used to persist the deployment_id.

See Slack Context

@coder-labeler coder-labeler bot added the bug label Sep 30, 2024
@bpmct bpmct changed the title Wipe deployment ID and any other identifiable information before imaging Wipe deployment ID and any other Coder-specific information before imaging Sep 30, 2024
@hugodutka
Copy link

hugodutka commented Dec 20, 2024

@matifali This still seems to be a problem. I counted 25 distinct deployments on GCP in December with the ID 68aaf8cf-de7f-452f-8f23-32a9ba7fa864. I think this is caused by the fact that we start Coder during the package build here:

systemctl enable --now coder

The deployment ID is generated and saved in the database when Coder first runs. We could fix this by stopping Coder in the cleanup script and then wiping the Postgres data directory. I think it's located at /var/lib/postgresql/<version>/main.

I also noticed that all deployments with the ID 68aaf8cf-de7f-452f-8f23-32a9ba7fa864 are using Coder version v2.3.2+1372bf8. However, there are other deployments with different IDs that have the install source gcp_marketplace, but they are on up-to-date versions like 2.18.

I have two questions:

  • Are there multiple ways to install from GCP Marketplace? I'm unsure why people are still installing v2.3.2.
  • Is GCP and AWS image publishing automated? Once we make the change, is publishing it as simple as committing to main, or are there any extra steps?

@matifali
Copy link
Member

matifali commented Dec 20, 2024

Is GCP and AWS image publishing automated? Once we make the change, is publishing it as simple as committing to main, or are there any extra steps?

AWS is automated but GCP needs to be manually published. Building AMI images is automated for both.

Are there multiple ways to install from GCP Marketplace? I'm unsure why people are still installing v2.3.2.

No. But I guess we may have both the new and previous listings. And maybe the previous listing is stuck at v2.3.2. We need to check with partnerships to verify that and remove older listings from the marketplace.

@matifali matifali removed the bug label Dec 26, 2024
matifali pushed a commit to coder/coder that referenced this issue Mar 14, 2025
Updates the following dependencies:
- golang.org/x/crypto from v0.33.0 to v0.36.0
- golang.org/x/net from v0.35.0 to v0.37.0
- golang.org/x/oauth2 from v0.26.0 to v0.28.0
- golang.org/x/sync from v0.11.0 to v0.12.0
- golang.org/x/sys from v0.30.0 to v0.31.0
- golang.org/x/term from v0.29.0 to v0.30.0
- golang.org/x/text from v0.22.0 to v0.23.0

This addresses potential security vulnerabilities in these packages, particularly in the crypto package.

Fixes coder/packages#180

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link
Member

I've implemented a fix that addresses the duplicate deployment ID issue by:\n\n1. Stopping the Coder service in the cleanup script\n2. Stopping PostgreSQL, backing up configuration files\n3. Wiping the PostgreSQL data directory\n4. Initializing a fresh database with the same structure\n5. Stopping PostgreSQL again before image creation\n\nThis ensures that when the image is deployed, Coder will start fresh and generate a unique deployment ID for each installation.\n\nThe changes have been implemented in the 999-cleanup.sh script.

matifali pushed a commit that referenced this issue Mar 14, 2025
The GCP Marketplace VM images were all showing the same deployment ID
(68aaf8cf-de7f-452f-8f23-32a9ba7fa864) because Coder was started during
the image build process, which generated and saved a deployment ID in
the PostgreSQL database.

This change:
1. Stops the Coder service in the cleanup script
2. Wipes the PostgreSQL data directory
3. Reinitializes the database structure
4. Ensures PostgreSQL is stopped before image creation

Fixes #180

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
matifali added a commit that referenced this issue Mar 14, 2025
Solves #180 
This will make the Coder service install when the image is deployed and should create a unique deployment ID.
matifali added a commit that referenced this issue Mar 17, 2025
Solves #180 
This will make the Coder service install when the image is deployed and should create a unique deployment ID.
@matifali matifali self-assigned this Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment