These instructions assume a Debian development environment.
No considerations are made in these instructions and notes around system security.
It is possible to run HDS on Kubernetes. This is an ideal way to test-run the system because it is ultimately deployed in Kubernetes.
- Install the necessary software
- Docker
- Kubernetes in Docker (KIND)
- Create a directory on your local disk to store data such as the data for the Postgres database used by HDS; we refer to this as
${K8S_DATA_DIRECTORY}
.
Edit the file support/k8s-development/haikudepotserver-kind-cluster.yaml
value ...extraMounts.hostPath
to point to your ${K8S_DATA_DIRECTORY}
. Now create the cluster;
kind create cluster --name haikudepotserver \
--config support/local-k8s-kind-development/haikudepotserver-kind-cluster.yaml
Check that the cluster is operational;
kubectl cluster-info --context kind-haikudepotserver
Load the manifest YAML files into the Kubernetes cluster in order to stand up the resources required to run the Postgres database server.
kubectl --context kind-haikudepotserver apply \
-f ./support/local-k8s-kind-development/haikudepotserver-pg-configmap.yaml \
-f ./support/local-k8s-kind-development/haikudepotserver-pg-volume.yaml \
-f ./support/local-k8s-kind-development/haikudepotserver-pg-app.yaml \
Wait a short while for the system to settle and then check that the database is running.
kubectl --context kind-haikudepotserver get pods
A pod with prefix haikudepotserver-pg
should be listed and eventually 1/1
should be up.
Later when you wish to import the packages from a repository, the process can be time-consuming and require a large volume of traffic. To reduce the quantity of packages imported, an additional environment variable HDS_REPOSITORY_IMPORT_ALLOWEDPKGNAMEPATTERN
can be set in the file ./support/local-k8s-kind-development/haikudepotserver-webapp.yaml
to something like ^.[Aa].+$
in order to only import those packages that have the second character as "A" in their name.
Also in the same YAML file, the image
key should be upgraded to the latest release of the HDS application. You can find the latest version here.
Now we deploy the application into the Kubernetes cluster.
kubectl --context kind-haikudepotserver apply \
-f ./support/local-k8s-kind-development/haikudepotserver-webapp.yaml
Wait a short while for the system to settle and then check that the application is running.
kubectl --context kind-haikudepotserver get pods
A pod with prefix haikudepotserver-webapp
should be listed and eventually 1/1
should be up.
The application can be accessed on http://localhost:8089
on the development host. Login as root
with password zimmer
.
kubectl --context kind-haikudepotserver exec -it haikudepotserver-pg-f6d69987b-lsjkc -- \
psql --password -U haikudepotserver haikudepotserver
kubectl --context kind-haikudepotserver logs deployment/haikudepotserver-webapp -f
In the sample file haikudepotserver-webapp.yaml
you will see that a remote image is specified for the HDS application. For example, ghcr.io/haiku/haikudepotserver:1.0.160
. If you want to run a locally build container image, first build and tag the image;
docker build --tag haikudepotserver:999.999.999 .
Once this build is complete, make the image available in the cluster;
kind load docker-image haikudepotserver:999.999.999 --name haikudepotserver
Now change the image in the haikudepotserver-webapp.yaml
file to haikudepotserver:999.999.999
and then re-apply the file to the cluster.
- Authenticate as
root
to the web interface - Visit the list of repositories
- Add a new repository with code
haikuports
, nameHaikuPorts
- Add a new repository source with code
haikuports_x86_64
- Add a new repository source mirror with URL
https://eu.hpkg.haiku-os.org:443/haikuports/master/x86_64/current
- Choose the "Trigger import" link on the repository source view
- Observe the logs from the HDS application
kubectl --context kind-haikudepotserver logs deployment/haikudepotserver-webapp -f
- Wait for the import process to complete with the message
...(repositoryhpkringress); finish
in the logs - View the web interface home page and observe that packages are listed
kind delete cluster --name haikudepotserver