From 5de5d20808bd46d9ed51dc35baf4896c825bde7c Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Sun, 17 Sep 2023 18:13:36 +0100 Subject: [PATCH] fix: remove broken fly.io template from starter templates (#9711) Co-authored-by: Atif Ali --- cli/testdata/coder_templates_init_--help.golden | 2 +- docs/cli/templates_init.md | 4 ++-- examples/examples.gen.json | 12 ------------ examples/examples.go | 1 - 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/cli/testdata/coder_templates_init_--help.golden b/cli/testdata/coder_templates_init_--help.golden index 249887f73c..94a244a85a 100644 --- a/cli/testdata/coder_templates_init_--help.golden +++ b/cli/testdata/coder_templates_init_--help.golden @@ -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|fly-docker-image|gcp-linux|gcp-vm-container|gcp-windows|kubernetes + --id aws-ecs-container|aws-linux|aws-windows|azure-linux|do-linux|docker|docker-with-dotfiles|gcp-linux|gcp-vm-container|gcp-windows|kubernetes Specify a given example template by ID. ——— diff --git a/docs/cli/templates_init.md b/docs/cli/templates_init.md index a128d3533c..3d9f0e24fe 100644 --- a/docs/cli/templates_init.md +++ b/docs/cli/templates_init.md @@ -15,7 +15,7 @@ coder templates init [flags] [directory] ### --id | | | -| ---- | ---------------------------- | --------- | ----------- | ----------- | -------- | ------ | -------------------- | ---------------- | --------- | ---------------- | ----------- | ------------------ | -| Type | enum[aws-ecs-container | aws-linux | aws-windows | azure-linux | do-linux | docker | docker-with-dotfiles | fly-docker-image | gcp-linux | gcp-vm-container | gcp-windows | kubernetes] | +| ---- | ---------------------------- | --------- | ----------- | ----------- | -------- | ------ | -------------------- | --------- | ---------------- | ----------- | ------------------ | +| Type | enum[aws-ecs-container | aws-linux | aws-windows | azure-linux | do-linux | docker | docker-with-dotfiles | gcp-linux | gcp-vm-container | gcp-windows | kubernetes] | Specify a given example template by ID. diff --git a/examples/examples.gen.json b/examples/examples.gen.json index 84164b6e31..ec4f5e5906 100644 --- a/examples/examples.gen.json +++ b/examples/examples.gen.json @@ -133,17 +133,5 @@ "kubernetes" ], "markdown": "\n# Getting started\n\nThis template creates a deplyment running the `codercom/enterprise-base:ubuntu` image.\n\n## Prerequisites\n\nThis template uses [`kubernetes_deployment`](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/deployment) terraform resource, which requires the `coder` service account to have permission to create deploymnets. For example if you are using [helm](https://coder.com/docs/v2/latest/install/kubernetes#install-coder-with-helm) to install Coder, you should set `coder.serviceAccount.enableDeployments=true` in your `values.yaml`\n\n```diff\ncoder:\nserviceAccount:\n workspacePerms: true\n- enableDeployments: false\n+ enableDeployments: true\n annotations: {}\n name: coder\n```\n\n\u003e Note: This is only required for Coder versions \u003c 0.28.0, as this will be the default value for Coder versions \u003e= 0.28.0\n\n## Authentication\n\nThis template can authenticate using in-cluster authentication, or using a kubeconfig local to the\nCoder host. For additional authentication options, consult the [Kubernetes provider\ndocumentation](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs).\n\n### kubeconfig on Coder host\n\nIf the Coder host has a local `~/.kube/config`, you can use this to authenticate\nwith Coder. Make sure this is done with same user that's running the `coder` service.\n\nTo use this authentication, set the parameter `use_kubeconfig` to true.\n\n### In-cluster authentication\n\nIf the Coder host runs in a Pod on the same Kubernetes cluster as you are creating workspaces in,\nyou can use in-cluster authentication.\n\nTo use this authentication, set the parameter `use_kubeconfig` to false.\n\nThe Terraform provisioner will automatically use the service account associated with the pod to\nauthenticate to Kubernetes. Be sure to bind a [role with appropriate permission](#rbac) to the\nservice account. For example, assuming the Coder host runs in the same namespace as you intend\nto create workspaces:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: coder\n\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n name: coder\nsubjects:\n - kind: ServiceAccount\n name: coder\nroleRef:\n kind: Role\n name: coder\n apiGroup: rbac.authorization.k8s.io\n```\n\nThen start the Coder host with `serviceAccountName: coder` in the pod spec.\n\n### Authenticate against external clusters\n\nYou may want to deploy workspaces on a cluster outside of the Coder control plane. Refer to the [Coder docs](https://coder.com/docs/v2/latest/platforms/kubernetes/additional-clusters) to learn how to modify your template to authenticate against external clusters.\n\n## Namespace\n\nThe target namespace in which the deployment will be deployed is defined via the `coder_workspace`\nvariable. The namespace must exist prior to creating workspaces.\n\n## Persistence\n\nThe `/home/coder` directory in this example is persisted via the attached PersistentVolumeClaim.\nAny data saved outside of this directory will be wiped when the workspace stops.\n\nSince most binary installations and environment configurations live outside of\nthe `/home` directory, we suggest including these in the `startup_script` argument\nof the `coder_agent` resource block, which will run each time the workspace starts up.\n\nFor example, when installing the `aws` CLI, the install script will place the\n`aws` binary in `/usr/local/bin/aws`. To ensure the `aws` CLI is persisted across\nworkspace starts/stops, include the following code in the `coder_agent` resource\nblock of your workspace template:\n\n```terraform\nresource \"coder_agent\" \"main\" {\n startup_script = \u003c\u003c-EOT\n set -e\n # install AWS CLI\n curl \"https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip\" -o \"awscliv2.zip\"\n unzip awscliv2.zip\n sudo ./aws/install\n EOT\n}\n```\n\n## code-server\n\n`code-server` is installed via the `startup_script` argument in the `coder_agent`\nresource block. The `coder_app` resource is defined to access `code-server` through\nthe dashboard UI over `localhost:13337`.\n\n## Deployment logs\n\nTo stream kubernetes pods events from the deployment, you can use Coder's [`coder-logstream-kube`](https://github.com/coder/coder-logstream-kube) tool. This can stream logs from the deployment to Coder's workspace startup logs. You just need to install the `coder-logstream-kube` helm chart on the cluster where the deployment is running.\n\n```shell\nhelm repo add coder-logstream-kube https://helm.coder.com/logstream-kube\nhelm install coder-logstream-kube coder-logstream-kube/coder-logstream-kube \\\n --namespace coder \\\n --set url=\u003cyour-coder-url-including-http-or-https\u003e\n```\n\nFor detailed instructions, see [Deployment logs](https://coder.com/docs/v2/latest/platforms/kubernetes/deployment-logs)\n" - }, - { - "id": "fly-docker-image", - "url": "", - "name": "Develop on a Fly.io container", - "description": "Run workspaces as Firecracker VMs on Fly.io", - "icon": "/icon/fly.io.svg", - "tags": [ - "docker", - "fly.io" - ], - "markdown": "\n# Coder Fly.io Template\n\nThis template provisions a [code-server](https://github.com/coder/code-server) instance on [fly.io](https://fly.io) using the [codercom/code-server](https://hub.docker.com/r/codercom/code-server) image.\n\n## Prerequisites\n\n- [flyctl](https://fly.io/docs/getting-started/installing-flyctl/) installed.\n- [Coder](https://coder.com/) already setup and running with coder-cli installed locally.\n\n## Getting started\n\n1. Run `coder templates init` and select this template. Follow the instructions that appear.\n2. cd into the directory that was created. (e.g. `cd fly-docker-image`)\n3. Create the new template by running the following command from the `fly-docker-image` directory:\n\n```bash\ncoder templates create fly-docker-image \\\n --var fly_api_token=$(flyctl auth token) \\\n --var fly_org=personal\n```\n\n\u003e If the Coder server is also running as a fly.io app, then instead of setting variable `fly_api_token` you can also set a fly.io secret with the name `FLY_API_TOKEN`\n\u003e\n\u003e ```bash\n\u003e flyctl secrets set FLY_API_TOKEN=$(flyctl auth token) --app \u003cyour-coder-app-name\u003e\n\u003e ```\n\n\u003e Read our blog [post](coder.com/blog/deploying-coder-on-fly-io) to learn more about how to deploy Coder on fly.io.\n\n4. Navigate to the Coder dashboard and create a new workspace using the template.\n\nThis is all. You should now have a code-server instance running on fly.io.\n" } ] diff --git a/examples/examples.go b/examples/examples.go index 669b123552..5a8c00052a 100644 --- a/examples/examples.go +++ b/examples/examples.go @@ -34,7 +34,6 @@ var ( //go:embed templates/gcp-vm-container //go:embed templates/gcp-windows //go:embed templates/kubernetes - //go:embed templates/fly-docker-image files embed.FS exampleBasePath = "https://github.com/coder/coder/tree/main/examples/templates/"