Skip to content
On this page

Development Tutorial for envd-server

envd-server is the backend server for envd. It manages environments on Kubernetes and supports multiple concurrent users.

Workflow

Here is the workflow for how an envd environment is created on Kubernetes.

  • The user creates an environment using envd in the envd console.
  • envd-server validates the environment and prepares it for provisioning on Kubernetes.
  • envd-server provisions the environment on Kubernetes.
  • The user is notified that the environment is ready to use.
  • User attaches to the environment with ssh.
  • containerssh is a ssh proxy that captures and forwards the ssh connection to the desired pod.

Development Process

The steps below walk you through the setup process. If you have questions, you can ask on discord or post an issue that describes the place you are stuck, and we'll do our best to help.

First, you could run the command in envd-server to build and push the development image.

bash
$ BASE_REGISTRY_USER=<username in docker hub> make build-image

After that, you could use helm to install the envd-server with the new image:

bash
$ helm install --set image.repository=<username in docker hub>/envd-server --set image.tag=dev envd-server ./manifests

Then forward these two ports to localhost for debug purpose:

bash
$ export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=envd-server,app.kubernetes.io/instance=envd-server" -o jsonpath="{.items[0].metadata.name}")
$ kubectl --namespace default port-forward $POD_NAME 8080:8080
$ kubectl --namespace default port-forward $POD_NAME 2222:2222

Then login to the envd-server, and create the environment to test if it works.

bash
# Create the context to tell envd to use the envd-server to run the environments.
$ envd context create --name envd-server --use --builder docker-container --runner envd-server --runner-address localhost:2222
# Build the image, and push it to docker hub.
$ envd build --output type=image,name=docker.io/<username>/<image>,push=true
# login to the envd-server.
$ envd login
# Create the environment and attach to the the environment.
$ envd create --image <username>/<image>

References

Released under the Apache-2.0 License. Built with VitePress.