How to install a modern Cloud Development Environment in your Public Cloud project

Whether you call it Cloud Development Environment, Developer Workspace Platform or Remote Ephemeral Workspaces, a new set of tools and services appeared in the last 10 year.
The idea is to define an environment through a container tool and manage it with all the needed security, user management, update management, templating tools and all the bells and whistles you can expect of a modern Software as a Service.

The use cases of these kind of services are numerous:
– shorter on-boarding time for new members of a project: newcomer will have all tools ready to work
– multiple development and tests environment: switch between versions and ecosystems easily
– leverage the power of cloud: share expensive resource like GPU instances

One of them is called Coder and has the advantage of being very versatile, open source and easy to deploy on a Kubernetes cluster.

Let’s discover how to deploy Coder in an OVHcloud Public Cloud project.

First step, create an OVHcloud Managed Kubernetes cluster following the dedicated documentation
Once you have your cluster, you can follow the guide to retrieve your configuration file then prepare your machine to use Helm.

From that point, you have a Managed Kubernetes Cluster, Helm and Kubectl configured and so you’re ready to go.

Before installing anything, it’s better to dedicate a namespace to your Coder adventure.

kubectl create namespace coder

Coder needs to use a database to store all its data. You have several options and you can of course use one of the Managed Databases.
To keep this article compact and easy to read, I will use another option and create a PostgreSQL database in the cluster itself.

helm repo add bitnami https://charts.bitnami.com/bitnami
helm install coder-db bitnami/postgresql \
--namespace coder \
--set auth.username=<your user. I'll use coder for the rest of the article> \
--set auth.password=<your password, I'll use coder> \
--set auth.database=coder \
--set persistence.size=10Gi

To be able to setup properly your Coder installation, you need to create a Kubernetes secret with the URL of this database.

kubectl create secret generic coder-db-url \
-n coder \
--from-literal=url="postgres://coder:coder@coder-db-postgresql.coder.svc.cluster.local:5432/coder?sslmode=disable"

Next, create a file values.yaml that will define the configuration of the Coder deployment were are going to use.
To have a complete setup, please follow our guide on how to install and secure a Nginx Ingress with cert-manager

coder:
  # You can specify any environment variables you'd like to pass to Coder
  # here. Coder consumes environment variables listed in
  # `coder server --help`, and these environment variables are also passed
  # to the workspace provisioner (so you can consume them in your Terraform
  # templates for auth keys etc.).
  #
  # Please keep in mind that you should not set `CODER_HTTP_ADDRESS`,
  # `CODER_TLS_ENABLE`, `CODER_TLS_CERT_FILE` or `CODER_TLS_KEY_FILE` as
  # they are already set by the Helm chart and will cause conflicts.
  env:
    - name: CODER_PG_CONNECTION_URL
      valueFrom:
        secretKeyRef:
          # You'll need to create a secret called coder-db-url with your
          # Postgres connection URL like:
          # postgres://coder:password@postgres:5432/coder?sslmode=disable
          name: coder-db-url
          key: url

    # (Optional) For production deployments the access URL should be set.
    # If you're just trying Coder, access the dashboard via the service IP.
    - name: CODER_ACCESS_URL
      value: "https://coder.example.com"

  ingress:
    enable: true
    className: "nginx"
    host: <your domain url>
    wildcardHost: ""
    annotations:
      cert-manager.io/cluster-issuer: letsencrypt-prod
      nginx.ingress.kubernetes.io/add-base-url: "true"
      ingress.kubernetes.io/force-ssl-redirect: "true"
      kubernetes.io/tls-acme: "true"
    tls:
      enable: true
      secretName: "coder-secret"
      wildcardSecretName: ""

This values.yaml file will then allow you to deploy the main piece of Coder.

helm install coder coder-v2/coder \
    --namespace coder \
    --values values.yaml \
    --version 2.14.3

From that point, you have a fully functional Coder deployment and you are ready to explore the capabilities of a cloud development environment solution.

Your next steps should a tour of the documentation and do not hesitate to join the Coder community.

+ posts

Geek, musician, coder and maker that loves sharing knowledge.

Currently DevRel @OVHcloud as day job. Also founder of Mixteen for the kids and Community Hero @gitpod

Curiosity and passion leads to micro:bit Champion