chore(dev): linux dev support workaround (#2076)

This commit is contained in:
Florian Forster
2021-07-27 21:55:30 +02:00
committed by GitHub
parent adac3eaf2d
commit 291b04ee1e
6 changed files with 72 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
FROM ubuntu:latest AS started
#install dependencies
#install dependencies with a workaround for the 412 error
RUN apt-get update \
&& apt-get install curl -y

View File

@@ -6,11 +6,11 @@
clientid=""
while [ -z $clientid ]; do
echo "no from zitadel ==> retry"
sleep 2
echo "no from zitadel ==> retrying in 5 seconds"
sleep 5
clientid=$(curl -s http://${HOST}:${PORT}/clientID)
if [[ "$clientid" != *@zitadel* ]]; then
echo "invalid response from zitadel ==> retry"
echo "invalid response from zitadel ==> retrying in 5 seconds"
clientid=""
fi
done

View File

@@ -75,7 +75,7 @@ services:
- keys
build:
context: ../..
dockerfile: build/dockerfile
dockerfile: build/zitadel/Dockerfile
target: dev-go-build
args:
ENV: dev
@@ -126,10 +126,12 @@ services:
'start',
]
zitadel-setted-up:
zitadel-started-up:
profiles: ['setup']
networks:
- zitadel
extra_hosts:
host.docker.internal: host-gateway
build:
context: ../..
dockerfile: build/local/Dockerfile.started
@@ -170,7 +172,7 @@ services:
ENV: dev
volumes:
- ./environment.json:/console/src/assets/environment.json
command: sh -c "ng serve --host 0.0.0.0"
command: sh -c "ng serve --host 0.0.0.0 --disable-host-check"
ports:
- 4200:4200

View File

@@ -6,15 +6,31 @@
# ------------------------------
be_status=""
fe_status=""
env_status=""
console_status=""
while [[ $be_status -ne 200 || $fe_status -ne 200 ]]; do
while [[ $be_status != 200 && $env_status != 200 ]]; do
sleep 5
## This is a workaround for a race condition
if [[ $be_status -eq 412 ]]; then
echo "please restart the process once again to get rid of the 412 error!"
fi
be_status=$(curl -s -o /dev/null -I -w "%{http_code}" host.docker.internal:${BE_PORT}/clientID)
fe_status=$(curl -s -o /dev/null -I -w "%{http_code}" host.docker.internal:${FE_PORT}/assets/environment.json)
echo "backend (${be_status}) or frontend (${fe_status}) not ready yet"
env_status=$(curl -s -o /dev/null -I -w "%{http_code}" host.docker.internal:${FE_PORT}/assets/environment.json)
echo "backend (${be_status}) or environment (${env_status}) not ready yet ==> retrying in 5 seconds"
done
echo "backend and environment.json ready!"
while [[ $console_status != 200 ]]; do
sleep 15
console_status=$(curl -s -o /dev/null -I -w "%{http_code}" host.docker.internal:${FE_PORT}/index.html)
echo "console (${console_status}) not ready yet ==> retrying in 15 seconds"
done
echo "console ready - please wait shortly!"
sleep 15
echo -e "++=======================================================================================++
|| ||
|| ZZZZZZZZZZZZ II TTTTTTTTTTTT AAAA DDDDDD EEEEEEEEEE LL ||
@@ -35,3 +51,7 @@ echo -e "++=====================================================================
|| SSSSSSSSSS TT AA AA RR RR TT EEEEEEEEEE DDDDDD ||
|| ||
++=======================================================================================++"
echo "access the console here http://localhost:${FE_PORT}"
echo "access the login here http://localhost:50003/login"
echo "access the apis here http://localhost:50002"

View File

@@ -145,6 +145,12 @@ ARG BUILDARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${BUILDARCH} go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o zitadel-linux-${BUILDARCH} cmd/zitadel/main.go
#######################
## Go dev build
#######################
FROM go-base as dev-go-build
ENTRYPOINT [ "go", "run", "cmd/zitadel/main.go" ]
#######################
## Only Copy Assets
#######################