Skip to content

Commit

Permalink
Enable local Kubernetes deployment (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
memeToasty authored Mar 6, 2024
1 parent ef120dd commit f6dbc1d
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 6 deletions.
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kind-up:
./hacks/kind-up.sh

deploy:
./hacks/deploy.sh

kind-deploy:
docker compose -f ./docker-compose.build.yml build
kind load docker-image kioku-frontend:latest kioku-carddeck_service:latest kioku-frontend_proxy:latest kioku-srs_service:latest kioku-user_service:latest kioku-collaboration_service:latest kioku-notification_service:latest
./hacks/deploy.sh ./hacks/values_local.yaml
50 changes: 50 additions & 0 deletions docker-compose.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: "3"

services:
frontend_proxy:
container_name: kioku-frontend_proxy
restart: always
build:
context: backend
dockerfile: services/frontend/Dockerfile

user_service:
container_name: kioku-user_service
restart: always
build:
context: backend
dockerfile: services/user/Dockerfile

carddeck_service:
container_name: kioku-carddeck_service
restart: always
build:
context: backend
dockerfile: services/carddeck/Dockerfile

collaboration_service:
container_name: kioku-collaboration_service
restart: always
build:
context: backend
dockerfile: services/collaboration/Dockerfile

srs_service:
container_name: kioku-srs_service
restart: always
build:
context: backend
dockerfile: services/srs/Dockerfile

notification_service:
container_name: kioku-notification_service
restart: always
build:
context: backend
dockerfile: services/notification/Dockerfile

frontend:
container_name: kioku-frontend
restart: always
build:
context: frontend
10 changes: 7 additions & 3 deletions deploy.sh → hacks/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/bash
# This script allows to deploy kioku to an external Kubernetes cluster
# This script allows to deploy kioku to a Kubernetes cluster
# Assumptions:
# - KUBECONFIG already targets the cluster
# - Script is executed from kioku-repo root folder
VALUE_STRING=""
if ! [ -z "$1" ]; then
VALUE_STRING="-f $1"
echo "$1"
fi

# Get dependent repositories
helm repo add postgres-operator-charts https://opensource.zalando.com/postgres-operator/charts/postgres-operator
Expand All @@ -19,4 +23,4 @@ helm install postgres-operator postgres-operator-charts/postgres-operator
# --create-namespace

# Install Kioku
helm install kioku helm/kioku
helm upgrade --install kioku helm/kioku $VALUE_STRING
21 changes: 21 additions & 0 deletions hacks/kind-up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
EOF

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
101 changes: 101 additions & 0 deletions hacks/values_local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
mode: latestuction

vapidSecret: vapid-secret

cassandra:
username: cassandra
password: cassandra

database:
name: kioku-database

databaseName: kioku
userName: kioku

instances: 2

size: 10Gi
mountPath: /mnt/data

secret:
name: kioku-database-secret

frontend:
name: kioku-frontend
image: kioku-frontend
tag: latest
port: 80
containerPort: 3000

httpPath: /

autoscaler:
min: 1
max: 10
targetCPUUtilizationPercentage: 50

frontend_proxy:
name: kioku-frontend-proxy
image: kioku-frontend_proxy
tag: latest
httpPath: /api

keySecret: frontend-proxy-key-secret

port: 80
containerPort: 8090

autoscaler:
min: 1
max: 10
targetCPUUtilizationPercentage: 50

carddeck:
name: kioku-carddeck
image: kioku-carddeck_service
tag: latest

autoscaler:
min: 1
max: 10
targetCPUUtilizationPercentage: 50

srs:
name: kioku-srs
image: kioku-srs_service
tag: latest

autoscaler:
min: 1
max: 10
targetCPUUtilizationPercentage: 50

notification:
name: kioku-notification
image: kioku-notification_service
tag: latest

autoscaler:
min: 1
max: 10
targetCPUUtilizationPercentage: 50

user:
name: kioku-user
image: kioku-user_service
tag: latest

autoscaler:
min: 1
max: 10
targetCPUUtilizationPercentage: 50

collaboration:
name: kioku-collaboration
image: kioku-collaboration_service
tag: latest

autoscaler:
min: 1
max: 10
targetCPUUtilizationPercentage: 50
6 changes: 3 additions & 3 deletions helm/kioku/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ srs:
max: 10
targetCPUUtilizationPercentage: 50

notifications:
name: kioku-notifications
image: ghcr.io/kioku-project/kioku_notifications
notification:
name: kioku-notification
image: ghcr.io/kioku-project/kioku_notification
tag: prod

autoscaler:
Expand Down

0 comments on commit f6dbc1d

Please sign in to comment.