Skip to content

docs: add template to provision docker image based workspaces on fly.io #6526

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

Merged
merged 13 commits into from
Mar 17, 2023
Prev Previous commit
Next Next commit
Update README.md
  • Loading branch information
matifali committed Mar 14, 2023
commit 03a28b22952156ec8fc0737f9870d9096f475dba
31 changes: 12 additions & 19 deletions examples/templates/fly-docker-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,24 @@ This template provisions a [code-server](https://github.com/coder/code-server) i
- [flyctl](https://fly.io/docs/getting-started/installing-flyctl/) installed.
- [Coder](https://coder.com/) already setup and running with coder-cli installed locally.

## Deploy
## Getting started

1. Clone this repo and cd into `fly-docker-image` directory.
2. Add a secret or environment variable to your Coder deployment with the name `FLY_API_TOKEN` and the value of your fly.io API token.
> This is needed to deploy the workspace to fly.io.
1. Run `coder templates init` and select this template. Follow the instructions that appear.
2. cd into the directory that was created. (e.g. `cd fly-docker-image`)
3. Create the new template by running the following command from the `fly-docker-image` directory:

```shell
flyctl auth login
export FLY_API_TOKEN=$(flyctl auth token)
```bash
coder templates create fly-docker-image --variable fly_api_token=$(flyctl auth token)
```

Add this to your Coder deployment's environment variables. (e.g. `/etc/coder.d/coder.env`)

Or, If Coder is running as a fly.io app, you can set the secret directly:

```shell
flyctl secrets set FLY_API_TOKEN=$(flyctl auth token) -a <coder-app-name>
# where <coder-app-name> is the name of the Coder app on fly.io
```
> If your Coder 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`
>
> ```bash
> flyctl secrets set FLY_API_TOKEN=$(flyctl auth token) --app <your-coder-app-name>
> ```

> Read our blog [post](coder.com/blog/deploying-coder-on-fly-io) to learn more about how to deploy Coder on fly.io.

3. Run `coder templates create fly-docker-image` to create a template in Coder.
4. Create a new workspace from the template.
4. Navigate to the Coder dashboard and create a new workspace using the template.

This is all. You should now have a code-server instance running on fly.io.

> Note: Change the image and the startup command to suit your needs.