From b7d0496fea044de5c04e3dfe2d165be7644a894b Mon Sep 17 00:00:00 2001 From: Gianni Carafa Date: Tue, 3 Sep 2024 22:31:29 +0200 Subject: [PATCH] improve docker compose --- docker-compose.kind.yaml | 40 ++++++++++++++++++++++++++++++++++++++++ docker-compose.yaml | 28 +++++++++++----------------- 2 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 docker-compose.kind.yaml diff --git a/docker-compose.kind.yaml b/docker-compose.kind.yaml new file mode 100644 index 00000000..f1e13018 --- /dev/null +++ b/docker-compose.kind.yaml @@ -0,0 +1,40 @@ +services: + # Kubero usually runs in a Kubernetes cluster in the kubero namespace + # If you want to run it locally, you can use kind to create a local Kubernetes cluster + # 1) Find your cluster name [YOUR_CLUSTER_NAME] by running `kind get clusters` + # 2) Set the cluster name in the YOUR_CLUSTER_NAME environment variable `export YOUR_CLUSTER_NAME=...` + # 3) run `kind get kubeconfig --name ${YOUR_CLUSTER_NAME} > ./kubeconfig` to get the right config + # 4) replace localhost with the IP of your host machine in the extra_hosts section `sed -i'' -e "s/127.0.0.1/${YOUR_CLUSTER_NAME}-control-plane/g" ./kubeconfig` + kubero: + container_name: "kubero-ui" + build: + context: . + args: + - VERSION=Local-Build + dockerfile: Dockerfile + image: ghcr.io/kubero-dev/kubero/kubero:latest + #command: ["tail", "-f", "/dev/null"] + env_file: + # copy the .env.template file to .env and change the values to your needs + - server/.env + environment: + # change the KUBERO_CONTEXT to the name of your local kind cluster context + # you can find the name by running `kubectl config get-contexts` + # Must be the same as the context name in the kubeconfig file ! + #- KUBECONFIG_BASE64= + - KUBECONFIG_PATH=./kubeconfig + - KUBERO_CONTEXT=kind-${YOUR_CLUSTER_NAME} + - KUBERO_NAMESPACE=kubero + - KUBERO_SESSION_KEY=randomString + ports: + # the UI will be available on http://localhost:8000. Make sure the port is not used by another service + - "8000:2000" + extra_hosts: + # if you are using a local Kubernetes cluster, make sure you use the container name from your + # local kind cluster control plane. You can find the name by running `docker ps` and looking for the + # container name of the control plane. 192.168.65.254 is your host machine IP address. + - "${YOUR_CLUSTER_NAME}-control-plane:192.168.65.254" + volumes: + - ./kubeconfig:/app/server/kubeconfig + - ./server/config.yaml:/app/server/config.yaml + - ./server/db:/app/server/db \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 8acc949d..9ebf8ef4 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,9 @@ -version: "3" services: # Kubero usually runs in a Kubernetes cluster in the kubero namespace - # If you want to run it locally, you can use kind to create a local Kubernetes cluster + # In case you want to run it from a separate container, you can use the following configuration + # Make sure yourt cluster is accessible with the kubeconfig file or the KUBECONFIG_BASE64 environment variable + # To extract your kubeconfig file from a Kubernetes cluster, you can use the following command: + # kubectl config view --raw --minify | base64 kubero: container_name: "kubero-ui" build: @@ -15,24 +17,16 @@ services: # copy the .env.template file to .env and change the values to your needs - server/.env environment: - # change the KUBERO_CONTEXT to the name of your local kind cluster context - # you can find the name by running `kubectl config get-contexts` - # Must be the same as the context name in the kubeconfig file ! - #- KUBECONFIG_BASE64= - - KUBECONFIG_PATH=./kubeconfig - - KUBERO_CONTEXT=inClusterContext + - KUBECONFIG_BASE64=CHANGE_ME + #- KUBECONFIG_PATH=/app/server/kubeconfig + - KUBERO_CONTEXT= - KUBERO_NAMESPACE=kubero - KUBERO_SESSION_KEY=randomString ports: # the UI will be available on http://localhost:8000. Make sure the port is not used by another service - "8000:2000" - extra_hosts: - # if you are using a local Kubernetes cluster, make sure you use the container name from your - # local kind cluster control plane. You can find the name by running `docker ps` and looking for the - # container name of the control plane. 192.168.65.2 is your host machine IP address. - - "kubero-001-control-plane:192.168.65.2" volumes: - # run `kind get kubeconfig --internal --name kubero-001 > ./kubeconfig-docker` to get the right config - # modify the server in the config to use the external kubernetes port from your host machine - - ./kubeconfig:/app/server/kubeconfig - - ./server/config.yaml:/app/server/config.yaml \ No newline at end of file + # copy the config.yaml.template file to config.yaml + - ./server/config.yaml:/app/server/config.yaml + - ./server/db:/app/server/db + #- ./kubeconfig:/app/server/kubeconfig \ No newline at end of file