-
Couldn't load subscription status.
- Fork 76
feat: Add Scaleway Instance Template #449
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
Open
mossylion
wants to merge
9
commits into
coder:main
Choose a base branch
from
mossylion:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dbebedb
Add Scaleway-instance template for scaleway compute instances
mossylion 041e5ba
Scaleway template - Additional QoL fixes
mossylion 3662464
fix: export CODER_AGENT_TOKEN in scaleway template
mossylion 1e8fb43
Merge branch 'main' into main
DevelopmentCats 3eeaae9
Merge branch 'main' into main
DevelopmentCats a03dc03
Replace scaleway logo with just the icon
mossylion 9d8fd6a
Fix Scaleway Arch and more sensible instance default
mossylion 4661bfc
Scaleway make OS disk size configurable
mossylion 58a117e
Merge branch 'main' into main
matifali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| --- | ||
| display_name: "Mossy Lion" | ||
| bio: "Tinkerer, exploring European cloud providers" | ||
| avatar: "./.images/avatar.png" | ||
| github: "mossylion" | ||
| status: "community" | ||
| --- | ||
|
|
||
| # Mossy Lion | ||
|
|
||
| Exploring European cloud providers. Usually find me outdoors but if not, somewhere deep in Kubernetes and infra | ||
|
|
||
| ## Templates | ||
|
|
||
| - **scaleway-instance**: Scaleway workspace instance with persistent home directory |
156 changes: 156 additions & 0 deletions
156
registry/mossylion/templates/scaleway-instance/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| --- | ||
| display_name: "Scaleway Instance" | ||
| description: "A workspace spun up on a Scaleway Instance" | ||
| icon: "../../../../.icons/scaleway.svg" | ||
| verified: false | ||
| tags: ["scaleway", "dev", "tools"] | ||
| --- | ||
|
|
||
| # Scaleway Instance Template | ||
|
|
||
| This template provisions Coder workspaces on [Scaleway](https://www.scaleway.com/) cloud instances with full customization options for regions, instance types, operating systems, and storage configurations. | ||
|
|
||
| ## Features | ||
|
|
||
| - **Multi-region support**: Choose from France (Paris), Netherlands (Amsterdam), or Poland (Warsaw) | ||
| - **Flexible instance sizing**: Wide range of instance types from development to high-performance computing | ||
| - **Multiple OS options**: Debian 12/13, Ubuntu 24.04, and Fedora 41 | ||
| - **Customizable storage**: Adjustable disk size with configurable IOPS | ||
| - **IPv4 and IPv6 networking**: Dual-stack IP configuration for enhanced connectivity | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| ### Scaleway Account Setup | ||
|
|
||
| 1. Create a [Scaleway account](https://console.scaleway.com/) | ||
| 2. Create a new project or use an existing one | ||
| 3. Generate API credentials: | ||
| - Go to **IAM** > **API Keys** in the Scaleway Console | ||
| - Create a new API key | ||
| - Note down the **Access Key** and **Secret Key** | ||
| - Copy your **Project ID** from the project settings | ||
| - Give permissions for **BlockStorageFullAccess**, **ProjectReadOnly**, **InstancesFullAccess** as a starting point | ||
|
|
||
| ## Architecture | ||
|
|
||
| This template creates the following resources for each workspace: | ||
|
|
||
| ### Persistent Resources | ||
|
|
||
| - **Block Volume**: Mounted as user's home directory (preserves all data, configs, and projects) | ||
|
|
||
| ### Ephemeral Resources (destroyed when workspace stops) | ||
|
|
||
| - **Scaleway Instance**: Virtual machine created fresh on each workspace start | ||
| - **IPv4 Address**: Routed IPv4 address assigned dynamically | ||
| - **IPv6 Address**: Routed IPv6 address assigned dynamically | ||
| - **Cloud-init Configuration**: Automated setup of the Coder agent and persistent storage mounting | ||
|
|
||
| ## Configuration Options | ||
|
|
||
| ### Region Selection | ||
|
|
||
| Choose from three available regions: | ||
|
|
||
| - **France - Paris (fr-par)**: Default, lowest latency for European users | ||
| - **Netherlands - Amsterdam (nl-ams)**: Alternative European location | ||
| - **Poland - Warsaw (pl-waw)**: Eastern European option | ||
|
|
||
| ### Instance Types | ||
|
|
||
| The template supports a comprehensive range of Scaleway instance types: | ||
|
|
||
| #### Development Instances | ||
|
|
||
| - **STARDUST1-S**: 1 CPU, 1GB RAM - Basic development | ||
| - **DEV1-S/M/L/XL**: 2-4 CPUs, 2-12GB RAM - Standard development | ||
|
|
||
| #### Production Instances | ||
|
|
||
| - **ENT1 Series**: 2-96 CPUs, 8-384GB RAM - Enterprise workloads | ||
| - **GP1 Series**: 4-48 CPUs, 16-256GB RAM - General purpose | ||
| - **PRO2 Series**: 2-32 CPUs, 8-128GB RAM - Professional workloads | ||
|
|
||
| #### Specialized Instances | ||
|
|
||
| - **L4 Series**: GPU-enabled instances for AI/ML workloads | ||
| - **COPARM1 Series**: ARM64 architecture for specific use cases | ||
|
|
||
| ### Operating System Options | ||
|
|
||
| - **Debian 13 (Trixie)**: Latest Debian release | ||
| - **Debian 12 (Bookworm)**: Stable Debian LTS | ||
| - **Ubuntu 24.04 (Noble)**: Latest Ubuntu LTS | ||
| - **Fedora 41**: Cutting-edge features and packages | ||
|
|
||
| ### Storage Configuration | ||
|
|
||
| - **Home Directory Size**: 10-500GB adjustable via slider (your entire home directory) | ||
| - **IOPS**: 5,000 or 15,000 IOPS options for performance tuning | ||
|
|
||
| ## Template Components | ||
|
|
||
| ### Included Tools | ||
|
|
||
| - **VS Code Server**: Browser-based IDE with full extension support | ||
| - **System Monitoring**: CPU, RAM, and disk usage metrics | ||
| - **Dotfiles Support**: Automatic dotfiles synchronization on workspace start | ||
| - **Custom Environment Variables**: Pre-configured welcome message | ||
|
|
||
| ### Cloud-init Setup | ||
|
|
||
| The template uses cloud-init for: | ||
|
|
||
| - Automatic Coder agent installation and configuration | ||
| - User account setup with proper permissions | ||
| - Persistent home directory mounting (automatic disk partitioning and filesystem creation) | ||
| - Development tools initialization | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Creating a Workspace | ||
|
|
||
| 1. **Select Template**: Choose "Scaleway Instance" from your Coder templates | ||
| 2. **Configure Region**: Pick your preferred Scaleway region | ||
| 3. **Choose Instance**: Select instance type based on your performance needs | ||
| 4. **Select OS**: Pick your preferred operating system | ||
| 5. **Set Home Directory Size**: Adjust storage size (10-500GB) for your persistent home directory | ||
| 6. **Create**: Launch your workspace | ||
|
|
||
| ### Managing Costs | ||
|
|
||
| - **VM instances are destroyed** when workspace stops (zero compute costs when not in use) | ||
| - **IP addresses are released** when workspace stops (no static IP charges) | ||
| - **Home directory persists** on dedicated block volume (small storage cost only) | ||
| - **Fresh OS** on each workspace start with persistent user data | ||
| - Choose appropriate instance sizes for your workload requirements | ||
|
|
||
| ## Customization | ||
|
|
||
| ### Extending the Template | ||
|
|
||
| You can customize this template by: | ||
|
|
||
| 1. **Adding Software**: Modify cloud-init scripts to install additional tools | ||
| 2. **Custom Modules**: Include additional Coder modules from the registry | ||
| 3. **Network Configuration**: Adjust security groups or network settings | ||
| 4. **Startup Scripts**: Add custom initialization logic | ||
|
|
||
| ## Maintenance | ||
|
|
||
| ### Updating Instance Types | ||
|
|
||
| To update the available instance types, regenerate the `scaleway-config.json` file: | ||
|
|
||
| ```bash | ||
| scw instance server-type list -o json | jq 'map({name, cpu, gpu, ram, arch})' > scaleway-config.json.json | ||
| ``` | ||
|
|
||
| This pulls the latest instance types from Scaleway and formats them for use in the template. | ||
|
|
||
| ## References | ||
|
|
||
| - [Scaleway Documentation](https://www.scaleway.com/en/docs/) | ||
| - [Scaleway Instance Types](https://www.scaleway.com/en/pricing/#instances) | ||
| - [Coder Templates Documentation](https://coder.com/docs/templates) | ||
| - [Terraform Scaleway Provider](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs) |
35 changes: 35 additions & 0 deletions
35
registry/mossylion/templates/scaleway-instance/cloud-init/cloud-config.yaml.tftpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #cloud-config | ||
| cloud_final_modules: | ||
| - [scripts-user, always] | ||
| hostname: ${hostname} | ||
| users: | ||
| - name: ${linux_user} | ||
| sudo: ALL=(ALL) NOPASSWD:ALL | ||
| shell: /bin/bash | ||
|
|
||
| # Setup persistent storage disk | ||
| disk_setup: | ||
| /dev/sdb: | ||
| table_type: gpt | ||
| layout: true | ||
| overwrite: false | ||
|
|
||
| fs_setup: | ||
| - label: persistent-home | ||
| filesystem: ext4 | ||
| device: /dev/sdb1 | ||
| partition: auto | ||
|
|
||
| mounts: | ||
| - ["/dev/sdb1", "/home/${linux_user}", "ext4", "defaults", "0", "2"] | ||
|
|
||
| # Fix ownership after mounting | ||
| runcmd: | ||
| - chown -R ${linux_user}:${linux_user} /home/${linux_user} | ||
| - chmod 755 /home/${linux_user} | ||
|
|
||
| # Automatically grow the partition | ||
| growpart: | ||
| mode: auto | ||
| devices: ['/'] | ||
| ignore_growroot_disabled: false |
2 changes: 2 additions & 0 deletions
2
registry/mossylion/templates/scaleway-instance/cloud-init/userdata.sh.tftpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #!/bin/bash | ||
| sudo -u '${linux_user}' sh -c 'export CODER_AGENT_TOKEN="${coder_agent_token}"; ${init_script}' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.