Skip to content
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

Provide instructions for testing on a local Minikube k8s cluster. #287

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ This will update the README.md file, make a commit, tag it, and then push both t

To create a _special_ release, simply tag it with a tag name of your choice with the exception that it cannot start with the character `v`.

### Deploy AiiDAlab on Kubernetes

Please see [here](k8s/README.md) for instructions on how to deploy AiiDAlab on Kubernetes.

## Deploy AiiDAlab with AiiDAlab Launch

The `aiidalab-launch` tool provides a convenient and robust method of both launching and managing one or multiple AiiDAlab instances on your computer.
Expand Down
14 changes: 14 additions & 0 deletions dodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@
}


def task_show_version():
"""Print the version for this repository."""

def show_version(version):
print(version)

return {
"basename": "show-version",
"actions": [show_version],
"params": [_VERSION_PARAM],
"verbosity": 2,
}


def task_build():
"""Build all docker images."""

Expand Down
38 changes: 38 additions & 0 deletions k8s/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# AiiDAlab on Kubernetes

## Deploy on a local Minikube (Kubernetes) cluster for testing

Here we provide instructions on how to run the stack on a local [Minikube Kubernetes cluster](https://minikube.sigs.k8s.io) for testing.

Using Minikube is one approach to deploy a small local Kubernetes cluster, however alternatives exist (e.g. [kind](https://kind.sigs.k8s.io/), k3s, colima).
If you are not using Minikube you may have to adjust the instructions provided here slightly.

First, [install Minikube](https://k8s-docs.netlify.app/en/docs/tasks/tools/install-minikube/) in your test environment and then start it, e.g., with `minikube start`.

If you want to test locally built images, make sure to build them within your test environment, with
```console
eval $(minikube docker-env)
doit build
```

Before installing the deployment for the first time, execute:

```console
helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/
helm repo update
```

Then execute `./k8s/helm-install.sh` to install AiiDAlab on the cluster.

To expose the web server, you need to create a tunnel with
```console
minikube tunnel
```

You should then be able to access the server at the address shown by
```console
kubectl get svc proxy-public
```

Tip: Use ngrok to forward the server to the internet and access it from a different machine.
**Please be advised that this approach carries significant security risk and should only be used for testing!**
13 changes: 13 additions & 0 deletions k8s/helm-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e
set -u

VERSION=$(dunamai from git --dirty | sed 's/+/_/g')

helm upgrade aiidalab \
jupyterhub/jupyterhub \
--version=1.1.4 \
--values k8s/values.dev.yml \
--set singleuser.image.tag="${VERSION}" \
--cleanup-on-fail \
--install $@
11 changes: 11 additions & 0 deletions k8s/values.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
singleuser:
image:
name: "aiidalab/full-stack"
tag: "latest"
pullPolicy: Never # To use locally built images
cmd: start-singleuser.sh
hub:
extraConfig:
myConfig: |
c.KubeSpawner.http_timeout = 60
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def notebook_service(docker_ip, docker_services):
port = docker_services.port_for("aiidalab", 8888)
url = f"http://{docker_ip}:{port}"
docker_services.wait_until_responsive(
timeout=30.0, pause=0.1, check=lambda: is_responsive(url)
timeout=60.0, pause=0.1, check=lambda: is_responsive(url)
)
return url

Expand Down