Files
oc-deploy/docker/start-demo.sh
2026-04-13 16:35:42 +02:00

56 lines
1.7 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
server=$(grep 'server:' ~/.kube/config | awk '{print $2}')
host=$(ip -4 addr show $(ip route | awk '/default/ {print $5}') | awk '/inet / {print $2}' | cut -d/ -f1)
port=6443
ca=$(kubectl config view --raw --minify -o jsonpath='{.clusters[0].cluster.certificate-authority-data}')
cert=$(kubectl config view --raw --minify -o jsonpath='{.users[0].user.client-certificate-data}')
key=$(kubectl config view --raw --minify -o jsonpath='{.users[0].user.client-key-data}')
HOST=${2:-"http://localhost:8000"}
docker network create oc | true
docker compose down
cd ./tools && docker compose -f ./docker-compose.dev.yml down --force-recreate -d && docker compose -f ./docker-compose.traefik.yml down --force-recreate -d
docker compose -f ./docker-compose.dev.yml up --force-recreate -d && docker compose -f ./docker-compose.traefik.yml up --force-recreate -d && cd ..
# cd ./db && ./add.sh && cd ..
cd ../..
REPOS=(
"oc-auth"
"oc-catalog"
"oc-datacenter"
"oc-monitord"
"oc-peer"
"oc-shared"
"oc-scheduler"
"oc-schedulerd"
"oc-workflow"
"oc-workspace"
)
for i in "${REPOS[@]}"
do
echo "Building $i"
docker kill $i | true
docker rm $i | true
cd ./$i
cat <<EOT > ./env.env
KUBERNETES_SERVICE_HOST=$host
KUBE_CA="$ca"
KUBE_CERT="$cert"
KUBE_DATA="$key"
EOT
docker build . -t $i --build-arg=HOST=$HOST --build-arg=KUBERNETES_SERVICE_HOST=$host \
--build-arg=KUBERNETES_SERVICE_PORT=$port --build-arg=KUBE_CA=$ca --build-arg=KUBE_CERT=$cert \
--build-arg=KUBE_DATA=$key && docker compose up -d
cd ..
done
cd ./oc-deploy/docker/tools && docker compose -f ./docker-compose.dev.yml up hydra-client --force-recreate -d