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

Skip to content

example: added hetzner cloud workspace #1884

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

ntimo
Copy link
Contributor

@ntimo ntimo commented May 29, 2022

This PR adds an example for Hetzner Cloud.
The general idea is to let the user create a cloud instance and mount a persistent volume to it. And when the workspace is stopped to unmount the volume and delete the instance to save costs (only the volume will be paid during the stopped time).

In summary this template does:

  • Creates a Hetzner Cloud instance
  • Create a Hetzner Cloud volume
  • Create a default block inbound firewall policy
  • Add volumes and firewall policy to the instance
  • Ask the user if code-server should be installed and if so installs it

Note: I had to create a new PR because the fork relation of my fork from #1044 broke.

@ntimo
Copy link
Contributor Author

ntimo commented May 29, 2022

Note: For some reason coder ssh <name>.dev does not work with version 0.6.0 of coder with this template yet.

@bpmct
Copy link
Member

bpmct commented May 29, 2022

Note: For some reason coder ssh <name>.dev does not work with version 0.6.0 of coder with this template yet.

@kylecarbs any idea why the agent is showing up for the non-server resources?

┌─────────────────────────────────────────────────────────────────────────────────────────┐
│ RESOURCE                                   STATUS              ACCESS                   │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ hcloud_firewall.root                       ephemeral                                    │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ hcloud_firewall_attachment.root_fw_attach  ephemeral                                    │
│ └─ dev (linux, amd64)                      ⦾ connecting [15s]   coder ssh hetztest.dev  │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ hcloud_server.root                         ephemeral                                    │
│ └─ dev (linux, amd64)                      ⦾ connecting [15s]   coder ssh hetztest.dev  │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ hcloud_volume.root                         ephemeral                                    │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ hcloud_volume_attachment.root              ephemeral                                    │
│ └─ dev (linux, amd64)                      ⦿ connected          coder ssh hetztest.dev  │
└─────────────────────────────────────────────────────────────────────────────────────────┘

@kylecarbs
Copy link
Member

kylecarbs commented May 29, 2022

Hmm, I'll check this out. I think the DAG needs adjustment to use the closest node, and not work its way entirely up the tree.

Copy link
Member

@mafredri mafredri 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, thanks for your contribution @ntimo!

@ntimo ntimo force-pushed the task/hetzner-cloud-workspace-template branch from 49ff3a3 to be89a0e Compare May 30, 2022 16:23
@ntimo ntimo requested a review from mafredri May 30, 2022 16:31
@ntimo
Copy link
Contributor Author

ntimo commented Jun 9, 2022

I just tested this again with coder version 0.6.5 and coder detects the wrong terraform resource as the server (the firewall attachment resource is detected) @kylecarbs @bpmct
Screenshot from 2022-06-09 20-14-47

@kylecarbs
Copy link
Member

@ntimo this is certainly a bug on our end. I'll pull the template and try it out.

@kylecarbs
Copy link
Member

@ntimo found the bug! Pushing a fix in ~1hr

@ntimo
Copy link
Contributor Author

ntimo commented Jun 9, 2022

Thanks @kylecarbs you are awesome

@ntimo ntimo force-pushed the task/hetzner-cloud-workspace-template branch from bf9af6e to dd57b0e Compare June 9, 2022 19:31
@ntimo
Copy link
Contributor Author

ntimo commented Jun 9, 2022

I just added the option to chose if code-server should be installed or not when creating the workspace. This is done by using if statements inside of the cloud init file and a counter to add the coder_app resource if needed.

@ntimo
Copy link
Contributor Author

ntimo commented Jun 9, 2022

I will still need to "workarround" a "issue" where hetzner is going to send the admin an email for every server that gets created. Because the server has no ssh key.

kylecarbs added a commit that referenced this pull request Jun 9, 2022
This cleans up agent association code to explicitly map a single
agent to a single resource. This will fix #1884, and unblock
a prospect from beginning a POC.
@ntimo ntimo force-pushed the task/hetzner-cloud-workspace-template branch from 714bb9c to db360b6 Compare June 9, 2022 21:26
kylecarbs added a commit that referenced this pull request Jun 9, 2022
This cleans up agent association code to explicitly map a single
agent to a single resource. This will fix #1884, and unblock
a prospect from beginning a POC.
kylecarbs added a commit that referenced this pull request Jun 9, 2022
This cleans up agent association code to explicitly map a single
agent to a single resource. This will fix #1884, and unblock
a prospect from beginning a POC.
kylecarbs added a commit that referenced this pull request Jun 9, 2022
This cleans up agent association code to explicitly map a single
agent to a single resource. This will fix #1884, and unblock
a prospect from beginning a POC.
kylecarbs added a commit that referenced this pull request Jun 9, 2022
This cleans up agent association code to explicitly map a single
agent to a single resource. This will fix #1884, and unblock
a prospect from beginning a POC.
kylecarbs added a commit that referenced this pull request Jun 10, 2022
This cleans up agent association code to explicitly map a single
agent to a single resource. This will fix #1884, and unblock
a prospect from beginning a POC.
@mafredri
Copy link
Member

I think this one got closed by accident, reopening.

@mafredri mafredri reopened this Jun 10, 2022
@kylecarbs
Copy link
Member

Oh, it certainly was! It was deleted by linking it to the commit 😅.

Thanks @mafredri!

@ntimo try now, it should just work!

kylecarbs added a commit that referenced this pull request Jun 10, 2022
This cleans up agent association code to explicitly map a single
agent to a single resource. This will fix #1884, and unblock
a prospect from beginning a POC.
@ntimo
Copy link
Contributor Author

ntimo commented Jun 13, 2022

@kylecarbs looks good thank you :)

@ntimo
Copy link
Contributor Author

ntimo commented Jun 14, 2022

I guess this is ready for merge @mafredri :) What do you think?

@mafredri
Copy link
Member

Great work on this template @ntimo, love that you even included code-server! We've decided to showcase community templates by linking to them in the examples readme. Would you mind turning this PR into a personal repo that we can link to?

I'll make a PR today for adding a community templates section.

@ntimo
Copy link
Contributor Author

ntimo commented Jun 16, 2022

@mafredri
Copy link
Member

Thanks @ntimo! I've added it to #2401 and I'm leaving this open until that one is merged.

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.

5 participants