integration

This commit is contained in:
Elio Bischof
2025-07-21 17:13:29 +00:00
parent 8d5b282092
commit e992610c3b
11 changed files with 50 additions and 93 deletions

9
.devcontainer/Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu
RUN apt-get update
RUN apt-get --no-install-recommends install -y \
libgtk2.0-0t64 libgtk-3-0t64 libgbm-dev libnotify-dev libnss3 libxss1 libasound2t64 libxtst6 xauth xvfb && \
# clean up
rm -rf /var/lib/apt/lists/* && \
apt-get clean

View File

@@ -2,7 +2,7 @@
"name": "zitadel",
"dockerComposeFile": "docker-compose.yml",
"service": "devcontainer",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"workspaceFolder": "/workspaces",
"features": {
"ghcr.io/devcontainers/features/go:1": {
"version": "1.24"
@@ -11,12 +11,21 @@
"version": "lts/iron"
},
"ghcr.io/guiyomh/features/golangci-lint:0": {},
"ghcr.io/jungaretti/features/make:1": {}
"ghcr.io/jungaretti/features/make:1": {},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
"forwardPorts": [
3000,
3001,
4200,
8080
],
"onCreateCommand": "npm install -g sass@1.64.1"
"onCreateCommand": "npm install -g sass@1.64.1",
"customizations": {
"jetbrains": {
"settings": {
"com.intellij:app:HttpConfigurable.use_proxy_pac": true
}
}
}
}

View File

@@ -1,13 +1,19 @@
services:
devcontainer:
image: mcr.microsoft.com/devcontainers/base:ubuntu
build:
context: .
volumes:
- ..:/workspaces:cached
- /tmp/.X11-unix:/tmp/.X11-unix:cached
- ~/.cache:/home/vscode/.cache:delegated
command: sleep infinity
working_dir: /workspaces
environment:
ZITADEL_DATABASE_POSTGRES_HOST: db
ZITADEL_EXTERNALSECURE: false
ports:
- 3001:3001
db:
container_name: db
@@ -35,6 +41,18 @@ services:
- 22220:22220
- 22222:22222
login-integration:
container_name: login-integration
image: "${LOGIN_TAG:-ghcr.io/zitadel/zitadel-login:v4.0.0-rc.2}"
volumes:
- ../apps/login/apps/login/.env.test:/env-files/.env:cached
network_mode: service:devcontainer
environment:
PORT: 3001
depends_on:
mock-zitadel:
condition: service_started
zitadel:
image: "${ZITADEL_TAG:-ghcr.io/zitadel/zitadel:v4.0.0-rc.2}"
container_name: zitadel
@@ -68,7 +86,7 @@ services:
WRITE_ENVIRONMENT_FILE: /login-env/.env.test.local
SINK_EMAIL_INTERNAL_URL: http://sink:3333/email
SINK_SMS_INTERNAL_URL: http://sink:3333/sms
SINK_NOTIFICATION_URL: http://localhost:3333/notification
SINK_NOTIFICATION_URL: http://sink:3333/notification
LOGIN_BASE_URL: http://localhost:3000/ui/v2/login/
ZITADEL_API_DOMAIN: localhost
ZITADEL_ADMIN_USER: zitadel-admin@zitadel.localhost

3
.gitignore vendored
View File

@@ -94,3 +94,6 @@ load-test/output/*
# Turbo
.turbo/
**/.turbo/
# PNPM
.pnpm-store

View File

@@ -1,5 +1,5 @@
NEXT_PUBLIC_BASE_PATH=""
ZITADEL_API_URL=http://localhost:22222
NEXT_PUBLIC_BASE_PATH="/ui/v2/login"
ZITADEL_API_URL=http://mock-zitadel:22222
ZITADEL_SERVICE_USER_TOKEN="yolo"
EMAIL_VERIFICATION=true
DEBUG=true

View File

@@ -1,54 +0,0 @@
# Dockerfile for standalone ZITADEL Login UI
FROM node:18-alpine AS base
# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Prepare standalone and install dependencies
COPY prepare-standalone.sh package*.json ./
COPY *.standalone.* ./
RUN ./prepare-standalone.sh
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Prepare standalone configs
RUN ./prepare-standalone.sh --no-install
# Build application
ENV NEXT_TELEMETRY_DISABLED 1
RUN npm run build:standalone
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Automatically leverage output traces to reduce image size
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
CMD ["node", "server.js"]

View File

@@ -62,3 +62,4 @@ Database:
User.Password: zitadel
Logstore.Access.Stdout.Enabled: true
Log.Formatter.Format: json

View File

@@ -4,7 +4,7 @@ export default defineConfig({
reporter: "list",
e2e: {
baseUrl: process.env.LOGIN_BASE_URL || "http://localhost:3000",
baseUrl: process.env.LOGIN_BASE_URL || "http://localhost:3001/ui/v2/login",
specPattern: "integration/**/*.cy.{js,jsx,ts,tsx}",
supportFile: "support/e2e.{js,jsx,ts,tsx}",
setupNodeEvents(on, config) {

View File

@@ -1,30 +0,0 @@
services:
core-mock:
image: "${LOGIN_CORE_MOCK_TAG:-login-core-mock:local}"
container_name: integration-core-mock
ports:
- 22220:22220
- 22222:22222
login:
image: "${LOGIN_TAG:-login:local}"
container_name: integration-login
ports:
- 3001:3001
environment:
- PORT=3001
- ZITADEL_API_URL=http://core-mock:22222
- ZITADEL_SERVICE_USER_TOKEN="yolo"
- EMAIL_VERIFICATION=true
integration:
image: "${LOGIN_TEST_INTEGRATION_TAG:-login-test-integration:local}"
container_name: integration
environment:
- LOGIN_BASE_URL=http://login:3001/ui/v2/login
- CYPRESS_CORE_MOCK_STUBS_URL=http://core-mock:22220/v1/stubs
depends_on:
login:
condition: service_started
core-mock:
condition: service_started

View File

@@ -1,6 +1,7 @@
{
"name": "login-test-integration",
"private": true,
"type": "module",
"scripts": {
"test:integration": "DISPLAY='' dotenv -e ../../apps/login/.env.test cypress",
"test:integration:setup": "cd .. && make login_test_integration_dev"

View File

@@ -1,4 +1,4 @@
const url = Cypress.env("CORE_MOCK_STUBS_URL") || "http://localhost:22220/v1/stubs";
const url = Cypress.env("CORE_MOCK_STUBS_URL") || "http://mock-zitadel:22220/v1/stubs";
function removeStub(service: string, method: string) {
return cy.request({