Start demo improved

This commit is contained in:
mr
2025-11-06 16:43:52 +01:00
parent 140bd63559
commit 9e1686a78d
6 changed files with 85 additions and 34 deletions

View File

@@ -1,12 +1,21 @@
#!/bin/bash
KUBERNETES_ENV_FILE=$(realpath ${1:-"./kube.exemple.env"})
server=$(grep 'server:' ~/.kube/config | awk '{print $2}')
host=$(echo "$server" | sed -E 's#https://([^:]+):([0-9]+)#\1#')
port=$(echo "$server" | sed -E 's#https://([^:]+):([0-9]+)#\2#')
ca=$(grep 'certificate-authority-data:' ~/.kube/config | awk '{print $2}')
cert=$(grep 'client-certificate-data:' ~/.kube/config | awk '{print $2}')
key=$(grep 'client-key-data:' ~/.kube/config | awk '{print $2}')
HOST=${2:-"http://localhost:8000"}
docker network create oc | true
docker compose down
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 ..
cd ./db && ./add.sh && cd ..
cd ../..
@@ -30,7 +39,15 @@ do
docker kill $i | true
docker rm $i | true
cd ./$i
cp $KUBERNETES_ENV_FILE ./env.env
cat > ./env.env <<EOF
KUBERNETES_SERVICE_HOST=$host
KUBERNETES_SERVICE_PORT=$port
KUBE_CA="$ca"
KUBE_CERT="$cert"
KUBE_DATA="$key"
EOF
docker build . -t $i --build-arg=HOST=$HOST && docker compose up -d
cd ..
done
done
docker compose up hydra-client -d

View File

@@ -1,5 +1,12 @@
#!/bin/bash
export KUBERNETES_ENV_FILE=$(realpath ${KUBERNETES_ENV_FILE=:-"./kube.exemple.env"})
server=$(grep 'server:' ~/.kube/config | awk '{print $2}')
host=$(echo "$server" | sed -E 's#https://([^:]+):([0-9]+)#\1#')
port=$(echo "$server" | sed -E 's#https://([^:]+):([0-9]+)#\2#')
ca=$(grep 'certificate-authority-data:' ~/.kube/config | awk '{print $2}')
cert=$(grep 'client-certificate-data:' ~/.kube/config | awk '{print $2}')
key=$(grep 'client-key-data:' ~/.kube/config | awk '{print $2}')
export HOST=${HOST:-"http://localhost:8000"}
docker network create oc | true
@@ -7,6 +14,7 @@ docker compose down
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 ..
cd ../..
REPOS=(
@@ -28,7 +36,15 @@ do
docker kill $i | true
docker rm $i | true
cd ./$i
cp $KUBERNETES_ENV_FILE ./env.env
cat > ./env.env <<EOF
KUBERNETES_SERVICE_HOST=$host
KUBERNETES_SERVICE_PORT=$port
KUBE_CA="$ca"
KUBE_CERT="$cert"
KUBE_DATA="$key"
EOF
make run-docker
cd ..
done
docker compose up hydra-client -d

View File

@@ -90,6 +90,33 @@ services:
deploy:
restart_policy:
condition: on-failure
ldap:
image: pgarrett/ldap-alpine
container_name: ldap
volumes:
- "./ldap.ldif:/ldif/ldap.ldif"
networks:
- oc
ports:
- "390:389"
deploy:
restart_policy:
condition: on-failure
keto:
image: oryd/keto:v0.7.0-alpha.1-sqlite
ports:
- "4466:4466"
- "4467:4467"
command: serve -c /home/ory/keto.yml
restart: on-failure
volumes:
- type: bind
source: .
target: /home/ory
container_name: keto
networks:
- oc
hydra-client:
image: oryd/hydra:v2.2.0
container_name: hydra-client
@@ -127,32 +154,6 @@ services:
interval: 10s
timeout: 10s
retries: 10
ldap:
image: pgarrett/ldap-alpine
container_name: ldap
volumes:
- "./ldap.ldif:/ldif/ldap.ldif"
networks:
- oc
ports:
- "390:389"
deploy:
restart_policy:
condition: on-failure
keto:
image: oryd/keto:v0.7.0-alpha.1-sqlite
ports:
- "4466:4466"
- "4467:4467"
command: serve -c /home/ory/keto.yml
restart: on-failure
volumes:
- type: bind
source: .
target: /home/ory
container_name: keto
networks:
- oc
volumes:
oc-data: