chore: improve development for non-Linux contributors (#5288)

* test: fix e2e against console dev server

* chore: get rid of network_mode host

* explain e2e commands

* chore: fix pipelines

* fix e2e paths

* fix dockerized e2e

* chore: map cypress run service ports

* simplify localhost

* access db via compose service

* access db via compose service

* fix npm run open:angular and e2e:angular

* docs: add empty line

* chore: remove unused file

* docs:  update contrib

---------

Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
This commit is contained in:
Elio Bischof
2023-02-28 18:49:19 +01:00
committed by GitHub
parent 273d3d85b9
commit abacb6c5aa
10 changed files with 192 additions and 70 deletions

View File

@@ -0,0 +1,44 @@
version: '3.8'
services:
zitadel:
extends:
file: '../localhost/docker-compose.yaml'
service: 'zitadel'
volumes:
- ./zitadel.yaml:/zitadel.yaml
db:
extends:
file: '../localhost/docker-compose.yaml'
service: 'db'
prepare:
image: node:18-alpine3.15
working_dir: /e2e
user: '$UID'
volumes:
- ../../:/e2e
command: 'sh -c "npm ci --omit=dev && npm run lint && npx wait-on http://zitadel:8080/debug/ready"'
e2e:
image: cypress/included:12.2.0
depends_on:
zitadel:
condition: 'service_started'
db:
condition: 'service_healthy'
prepare:
condition: 'service_completed_successfully'
working_dir: /e2e
user: '$UID'
volumes:
- ../../:/e2e
environment:
CYPRESS_BASE_URL: http://host.docker.internal:8080/ui/console
CYPRESS_WEBHOOK_HANDLER_HOST: host.docker.internal
CYPRESS_DATABASE_CONNECTION_URL: 'postgresql://root@db:26257/zitadel'
ports:
- "8900:8900"
extra_hosts:
- "host.docker.internal:host-gateway"

View File

@@ -0,0 +1,41 @@
ExternalDomain: host.docker.internal
ExternalSecure: false
Database:
cockroach:
Host: db
TLS:
Enabled: false
FirstInstance:
Org:
Human:
PasswordChangeRequired: false
LogStore:
Access:
Database:
Enabled: true
Debounce:
MinFrequency: 0s
MaxBulkSize: 0
Execution:
Database:
Enabled: true
Stdout:
Enabled: false
Quotas:
Access:
ExhaustedCookieKey: "zitadel.quota.limiting"
ExhaustedCookieMaxAge: "60s"
DefaultInstance:
LoginPolicy:
MfaInitSkipLifetime: "0"
SystemAPIUsers:
- cypress:
KeyData: "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF6aStGRlNKTDdmNXl3NEtUd3pnTQpQMzRlUEd5Y20vTStrVDBNN1Y0Q2d4NVYzRWFESXZUUUtUTGZCYUVCNDV6YjlMdGpJWHpEdzByWFJvUzJoTzZ0CmgrQ1lRQ3ozS0N2aDA5QzBJenhaaUIySVMzSC9hVCs1Qng5RUZZK3ZuQWtaamNjYnlHNVlOUnZtdE9sbnZJZUkKSDdxWjB0RXdrUGZGNUdFWk5QSlB0bXkzVUdWN2lvZmRWUVMxeFJqNzMrYU13NXJ2SDREOElkeWlBQzNWZWtJYgpwdDBWajBTVVgzRHdLdG9nMzM3QnpUaVBrM2FYUkYwc2JGaFFvcWRKUkk4TnFnWmpDd2pxOXlmSTV0eXhZc3duCitKR3pIR2RIdlczaWRPRGxtd0V0NUsycGFzaVJJV0syT0dmcSt3MEVjbHRRSGFidXFFUGdabG1oQ2tSZE5maXgKQndJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg=="

View File

@@ -0,0 +1,30 @@
version: '3.8'
services:
zitadel:
user: '$UID'
restart: 'always'
image: '${ZITADEL_IMAGE:-ghcr.io/zitadel/zitadel:latest}'
command: 'start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --tlsMode disabled --config /zitadel.yaml --steps /zitadel.yaml'
depends_on:
db:
condition: 'service_healthy'
volumes:
- ./zitadel.yaml:/zitadel.yaml
ports:
- "8080:8080"
extra_hosts:
- "host.docker.internal:host-gateway"
db:
restart: 'always'
image: 'cockroachdb/cockroach:v22.2.2'
command: 'start-single-node --insecure --http-addr :9090'
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:9090/health?ready=1']
interval: '10s'
timeout: '30s'
retries: 5
start_period: '20s'
ports:
- "26257:26257"

View File

@@ -1,3 +1,13 @@
ExternalDomain: localhost
ExternalSecure: false
Database:
cockroach:
Host: db
TLS:
Enabled: false
FirstInstance:
Org:
Human:
@@ -23,7 +33,7 @@ Quotas:
DefaultInstance:
LoginPolicy:
MfaInitSkipLifetime: 0
MfaInitSkipLifetime: "0"
SystemAPIUsers:
- cypress:

View File

@@ -58,7 +58,7 @@ export function login(
times: 1,
}).as('password');
cy.visit(loginUrl, { retryOnNetworkFailure: true });
cy.visit(Cypress.config('baseUrl'), { retryOnNetworkFailure: true });
onUsernameScreen ? onUsernameScreen() : null;
cy.get('#loginName').type(creds.username);
@@ -69,7 +69,7 @@ export function login(
cy.get('#submit-button').click();
cy.wait('@password').then((interception) => {
if (interception.response.body.indexOf('/ui/login/mfa/prompt') === -1) {
if (interception.response.body.indexOf(`${loginUrl}/mfa/prompt`) === -1) {
return;
}

View File

@@ -2,52 +2,11 @@ version: '3.8'
services:
zitadel:
user: '$UID'
restart: 'always'
image: '${ZITADEL_IMAGE:-ghcr.io/zitadel/zitadel:latest}'
command: 'start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --tlsMode disabled --config /zitadel.yaml --steps /zitadel.yaml'
depends_on:
db:
condition: 'service_healthy'
volumes:
- ./docker-compose-zitadel.yaml:/zitadel.yaml
network_mode: host
extends:
file: './config/localhost/docker-compose.yaml'
service: 'zitadel'
db:
restart: 'always'
image: 'cockroachdb/cockroach:v22.2.2'
command: 'start-single-node --insecure --http-addr :9090'
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:9090/health?ready=1']
interval: '10s'
timeout: '30s'
retries: 5
start_period: '20s'
network_mode: host
prepare:
image: node:18-alpine3.15
working_dir: /e2e
user: '$UID'
volumes:
- .:/e2e
command: 'sh -c "npm ci --omit=dev && npm run lint && npx wait-on http://localhost:8080/debug/ready"'
network_mode: host
e2e:
image: cypress/included:12.2.0
depends_on:
zitadel:
condition: 'service_started'
db:
condition: 'service_healthy'
prepare:
condition: 'service_completed_successfully'
working_dir: /e2e
user: '$UID'
volumes:
- .:/e2e
network_mode: host
networks:
zitadel:
extends:
file: './config/localhost/docker-compose.yaml'
service: 'db'

View File

@@ -4,8 +4,12 @@
"scripts": {
"open": "npx cypress open",
"e2e": "npx cypress run",
"open:dev": "CYPRESS_BASE_URL=http://localhost:4200 CYPRESS_BACKEND_URL=http://localhost:8080 npm run open --",
"e2e:dev": "CYPRESS_BASE_URL=http://localhost:4200 CYPRESS_BACKEND_URL=http://localhost:8080 npm run e2e --",
"open:golang": "npm run open --",
"e2e:golang": "npm run e2e --",
"open:golangangular": "CYPRESS_BASE_URL=http://localhost:4200 CYPRESS_BACKEND_URL=http://localhost:8080 npm run open --",
"e2e:golangangular": "CYPRESS_BASE_URL=http://localhost:4200 CYPRESS_BACKEND_URL=http://localhost:8080 npm run e2e --",
"open:angular": "CYPRESS_BASE_URL=http://localhost:4200 CYPRESS_BACKEND_URL=http://localhost:8080 CYPRESS_WEBHOOK_HANDLER_HOST=host.docker.internal npm run open --",
"e2e:angular": "CYPRESS_BASE_URL=http://localhost:4200 CYPRESS_BACKEND_URL=http://localhost:8080 CYPRESS_WEBHOOK_HANDLER_HOST=host.docker.internal npm run e2e --",
"lint": "prettier --check cypress",
"lint:fix": "prettier --write cypress"
},