Files
oc-deploy/docker/start-demo.sh

54 lines
1.4 KiB
Bash
Raw Normal View History

2025-04-28 09:45:54 +02:00
#!/bin/bash
2025-11-06 16:43:52 +01:00
server=$(grep 'server:' ~/.kube/config | awk '{print $2}')
2025-11-07 10:37:11 +01:00
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}')
2025-11-06 16:43:52 +01:00
2025-04-28 14:11:18 +02:00
HOST=${2:-"http://localhost:8000"}
2025-04-28 09:45:54 +02:00
docker network create oc | true
docker compose down
2025-11-06 16:43:52 +01:00
2025-04-28 09:45:54 +02:00
cd ./tools && docker compose -f ./docker-compose.dev.yml up --force-recreate -d
docker compose -f ./docker-compose.traefik.yml up --force-recreate -d && cd ..
2025-11-06 16:43:52 +01:00
2025-04-28 09:45:54 +02:00
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"
"oc-front"
)
for i in "${REPOS[@]}"
do
echo "Building $i"
docker kill $i | true
docker rm $i | true
cd ./$i
2025-11-06 16:43:52 +01:00
cat > ./env.env <<EOF
KUBERNETES_SERVICE_HOST=$host
KUBERNETES_SERVICE_PORT=$port
KUBE_CA="$ca"
KUBE_CERT="$cert"
KUBE_DATA="$key"
EOF
2025-04-28 09:45:54 +02:00
docker build . -t $i --build-arg=HOST=$HOST && docker compose up -d
cd ..
2025-11-06 16:43:52 +01:00
done
2025-11-07 10:37:11 +01:00
cd ./oc-deploy/docker/tools && docker compose -f ./docker-compose.dev.yml up hydra-client --force-recreate -d