Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
563d99d
remove ecs and podman as official templates
bpmct Sep 24, 2023
955a166
kubernetes example
bpmct Sep 24, 2023
143fb04
update frontmatter & remove docker-with-dotfiles
bpmct Sep 26, 2023
41accf0
move jfrog to examples/
bpmct Sep 26, 2023
b5de4e2
fix typo
bpmct Sep 26, 2023
2132a6b
fix icon path
bpmct Sep 26, 2023
e563e15
add aws docs
bpmct Sep 26, 2023
deabf17
add aws-windows
bpmct Sep 26, 2023
4342e05
add azure
bpmct Sep 26, 2023
0fc50b0
add azure windows
bpmct Sep 26, 2023
1bcfec2
add docker
bpmct Sep 26, 2023
ca0dc3b
add devcontainers
bpmct Sep 26, 2023
7efb54a
add devcontainer-k8s and move notes
bpmct Sep 26, 2023
a7cfec9
add digitalocean
bpmct Sep 26, 2023
68b1b2b
add fly.io
bpmct Sep 26, 2023
a9660c3
add gcp windows
bpmct Sep 26, 2023
72caf68
fmt
bpmct Sep 26, 2023
756fc4e
Fix gen
kylecarbs Sep 26, 2023
956af8d
fix icon
matifali Sep 28, 2023
eb0812c
fix icon
matifali Sep 28, 2023
2b867b7
remove unrelated content
matifali Sep 28, 2023
5306f35
Delete examples/templates/fly-docker-image directory
matifali Dec 16, 2023
1614bd3
Update README.md
matifali Dec 16, 2023
688093b
Merge remote-tracking branch 'origin/main' into betterexamples
matifali Dec 16, 2023
207fc07
`make fmt`
matifali Dec 16, 2023
24dd048
Fix AWS authentication typo and update user_data
matifali Dec 16, 2023
886837c
Update GCP VM to use persistent VM
matifali Dec 16, 2023
039028b
Add GCP VM devcontainer templates
matifali Dec 16, 2023
94da748
set count for code-server
matifali Dec 16, 2023
817b277
fix gcp-linux
matifali Dec 16, 2023
6153345
revert gcp-template
matifali Dec 16, 2023
b14aadb
Delete GCP VM Devcontainer template and main.tf
matifali Dec 16, 2023
023f914
`make update-golden-files`
matifali Dec 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/testdata/coder_templates_init_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ USAGE:
Get started with a templated template.

OPTIONS:
--id aws-ecs-container|aws-linux|aws-windows|azure-linux|do-linux|docker|docker-with-dotfiles|gcp-linux|gcp-vm-container|gcp-windows|kubernetes|nomad-docker
--id aws-linux|aws-windows|azure-linux|do-linux|docker|gcp-linux|gcp-vm-container|gcp-windows|kubernetes|nomad-docker
Specify a given example template by ID.

———
Expand Down
6 changes: 3 additions & 3 deletions docs/cli/templates_init.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions docs/dotfiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ resource "coder_agent" "main" {
}
```

[Here's a complete example.](https://github.com/coder/coder/tree/main/examples/templates/docker-with-dotfiles#how-it-works)

## Persistent Home

Sometimes you want to support personalization without requiring dotfiles.
Expand Down
4 changes: 2 additions & 2 deletions docs/platforms/jfrog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ within a workspace. We'll use Docker as the underlying compute. But, these
concepts apply to any compute platform.

The full example template can be found
[here](https://github.com/coder/coder/tree/main/examples/templates/jfrog/docker).
[here](https://github.com/coder/coder/tree/main/examples/jfrog/docker).

## Requirements

Expand Down Expand Up @@ -249,7 +249,7 @@ for more information.
## More reading

- See the full example template
[here](https://github.com/coder/coder/tree/main/examples/templates/jfrog/docker).
[here](https://github.com/coder/coder/tree/main/examples/jfrog/docker).
- To serve extensions from your own VS Code Marketplace, check out
[code-marketplace](https://github.com/coder/code-marketplace#artifactory-storage).
- To store templates in Artifactory, check out our
Expand Down
4 changes: 2 additions & 2 deletions docs/templates/docker-in-workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ Before using Podman, please review the following documentation:
3. For systems running SELinux (typically Fedora-, CentOS-, and Red Hat-based
systems), you might need to disable SELinux or set it to permissive mode.

4. Import our
[kubernetes-with-podman](https://github.com/coder/coder/tree/main/examples/templates/kubernetes-with-podman)
4. Use this
[kubernetes-with-podman](https://github.com/coder/community-templates/tree/main/kubernetes-podman)
example template, or make your own.

```shell
Expand Down
130 changes: 56 additions & 74 deletions examples/examples.gen.json

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions examples/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ var (
// Only some templates are embedded that we want to display inside the UI.
// The metadata in examples.gen.json is generated via scripts/examplegen.
//go:embed examples.gen.json
//go:embed templates/aws-ecs-container
//go:embed templates/aws-linux
//go:embed templates/aws-windows
//go:embed templates/azure-linux
//go:embed templates/do-linux
//go:embed templates/docker
//go:embed templates/docker-with-dotfiles
//go:embed templates/gcp-linux
//go:embed templates/gcp-vm-container
//go:embed templates/gcp-windows
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions examples/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ List template examples in our CLI with `coder templates init`.

## Getting Started

Clone this repository to create a project from any example listed here:
Clone this repository to create a template from any example listed here:

```console
git clone https://github.com/coder/coder
cd examples/templates/aws-macos
cd examples/templates/aws-linux
coder templates create
```

Expand Down
24 changes: 0 additions & 24 deletions examples/templates/aws-ecs-container/README.md

This file was deleted.

135 changes: 0 additions & 135 deletions examples/templates/aws-ecs-container/main.tf

This file was deleted.

41 changes: 29 additions & 12 deletions examples/templates/aws-linux/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
---
name: Develop in Linux on AWS EC2
description: Get started with Linux development on AWS EC2.
tags: [cloud, aws]
icon: /icon/aws.png
display_name: AWS EC2 (Linux)
description: Provision AWS EC2 VMs as Coder workspaces
icon: ../../../site/static/icon/aws.png
maintainer_github: coder
verified: true
tags: [vm, linux, aws, persistent-vm]
---

# aws-linux
# Remote Development on AWS EC2 VMs (Linux)

To get started, run `coder templates init`. When prompted, select this template.
Follow the on-screen instructions to proceed.
Provision AWS EC2 VMs as [Coder workspaces](https://coder.com/docs/coder-v2/latest) with this example template.

## Authentication
<!-- TODO: Add screenshot -->

This template assumes that coderd is run in an environment that is authenticated
with AWS. For example, run `aws configure import` to import credentials on the
system and user running coderd. For other ways to authenticate [consult the
Terraform docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration).
## Prerequisites

### Authentication

By default, this template authenticates to AWS using the provider's default [authentication methods](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration).

The simplest way (without making changes to the template) is via environment variables (e.g. `AWS_ACCESS_KEY_ID`) or a [credentials file](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-format). If you are running Coder on a VM, this file must be in `/home/coder/aws/credentials`.

To use another [authentication method](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication), edit the template.

## Required permissions / policy

Expand Down Expand Up @@ -71,6 +77,17 @@ instances provisioned by Coder:
}
```

## Architecture

This template provisions the following resources:

- AWS Instance

Coder uses `aws_ec2_instance_state` to start and stop the VM. This example template is fully persistent, meaning the full filesystem is preserved when the workspace restarts. See this [community example](https://github.com/bpmct/coder-templates/tree/main/aws-linux-ephemeral) of an ephemeral AWS instance.

> **Note**
> This template is designed to be a starting point! Edit the Terraform to extend the template to support your use case.

## code-server

`code-server` is installed via the `startup_script` argument in the `coder_agent`
Expand Down
51 changes: 25 additions & 26 deletions examples/templates/aws-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -212,36 +212,35 @@ resource "coder_app" "code-server" {

locals {
linux_user = "coder"
user_data = data.coder_workspace.me.start_count > 0 ? trimspace(<<EOT
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
user_data = <<-EOT
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0

--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"

#cloud-config
cloud_final_modules:
- [scripts-user, always]
hostname: ${lower(data.coder_workspace.me.name)}
users:
- name: ${local.linux_user}
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
#cloud-config
cloud_final_modules:
- [scripts-user, always]
hostname: ${lower(data.coder_workspace.me.name)}
users:
- name: ${local.linux_user}
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash

--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"
--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"

#!/bin/bash
sudo -u ${local.linux_user} sh -c '${coder_agent.dev[0].init_script}'
--//--
EOT
) : ""
#!/bin/bash
sudo -u ${local.linux_user} sh -c '${try(coder_agent.dev[0].init_script, "")}'
--//--
EOT
}

resource "aws_instance" "dev" {
Expand Down
Loading