The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
feat: self host + docker overhaul + docs updated
ddux715791b519c3
diff --git a/DOCKER.md b/DOCKER.mdindex e4f20a2e..9a3fefa9 100644--- a/DOCKER.md+++ b/DOCKER.md@@ -1,20 +1,64 @@# Traceway Docker Deployment-This document covers two deployment options:-1. **Minimal Image** (Recommended) - Small image (~20-30MB) with external ClickHouse-2. **All-in-One Image** - Larger image with systemd, suitable for development+Two deployment options:+1. **All-in-One** (`Dockerfile`) — ClickHouse + PostgreSQL + Backend in one container+2. **Minimal** (`Dockerfile.minimal`) — Lightweight Alpine image for external database deployments----## Minimal Deployment (Recommended)+## All-in-One Deployment-Lightweight Docker image containing only the Go backend with embedded frontend. Designed for production deployments connecting to an external ClickHouse database.+Single container with ClickHouse, PostgreSQL, and the Go backend managed by supervisord.-### Features-- **Image size**: ~20-30MB (Alpine-based)-- **Single binary**: Go backend with embedded SvelteKit frontend-- **External ClickHouse**: Connect to any ClickHouse instance-- **Fast startup**: No init system overhead+### Build++```bash+docker build -t traceway:latest .+```++### Run++```bash+docker run -d --name traceway \+ -p 80:80 \+ -v traceway-ch:/var/lib/clickhouse \+ -v traceway-pg:/var/lib/postgresql/data \+ traceway:latest+```++### Environment Variables++All have working defaults for the all-in-one image. Override as needed:++| Variable | Default | Description |+|----------|---------|-------------|+| `CLICKHOUSE_SERVER` | `localhost:9000` | ClickHouse host:port |+| `CLICKHOUSE_DATABASE` | `traceway` | ClickHouse database name |+| `CLICKHOUSE_USERNAME` | `default` | ClickHouse username |+| `CLICKHOUSE_PASSWORD` | *(empty)* | ClickHouse password |+| `CLICKHOUSE_TLS` | `false` | Enable TLS for ClickHouse |+| `POSTGRES_HOST` | `localhost` | PostgreSQL host |+| `POSTGRES_PORT` | `5432` | PostgreSQL port |+| `POSTGRES_DATABASE` | `traceway` | PostgreSQL database name |+| `POSTGRES_USERNAME` | `traceway` | PostgreSQL username |+| `POSTGRES_PASSWORD` | *(empty)* | PostgreSQL password |+| `POSTGRES_SSLMODE` | `disable` | PostgreSQL SSL mode |+| `JWT_SECRET` | *(built-in default)* | JWT signing secret (min 32 chars) |+| `GIN_MODE` | `release` | Gin framework mode |++### Access Points++| URL | Description |+|-----|-------------|+| `http://localhost/` | Frontend dashboard |+| `http://localhost/api/*` | Backend API |+| `http://localhost/health` | Health check |++---++## Minimal Deployment++Lightweight Alpine image (~20-30MB) containing only the Go backend with embedded frontend. Connect to external ClickHouse and PostgreSQL instances.### Build@@ -26,45 +70,41 @@ docker build -f Dockerfile.minimal -t traceway:minimal .| Variable | Description | Example ||----------|-------------|---------|-| `APP_TOKEN` | Dashboard authentication token | `your-secret-token` |-| `CLICKHOUSE_SERVER` | ClickHouse host:port | `clickhouse.example.com:9000` |-| `CLICKHOUSE_DATABASE` | Database name | `traceway` |-| `CLICKHOUSE_USERNAME` | DB username | `default` |-| `CLICKHOUSE_PASSWORD` | DB password | `password` |-| `CLICKHOUSE_TLS` | Enable TLS connection | `true` or `false` |+| `CLICKHOUSE_SERVER` | ClickHouse host:port | `clickhouse:9000` |+| `CLICKHOUSE_DATABASE` | ClickHouse database | `traceway` |+| `CLICKHOUSE_USERNAME` | ClickHouse username | `default` |+| `CLICKHOUSE_PASSWORD` | ClickHouse password | `password` |+| `CLICKHOUSE_TLS` | Enable TLS | `false` |+| `POSTGRES_HOST` | PostgreSQL host | `postgres` |+| `POSTGRES_PORT` | PostgreSQL port | `5432` |+| `POSTGRES_DATABASE` | PostgreSQL database | `traceway` |+| `POSTGRES_USERNAME` | PostgreSQL username | `traceway` |+| `POSTGRES_PASSWORD` | PostgreSQL password | `password` |+| `POSTGRES_SSLMODE` | PostgreSQL SSL mode | `disable` |+| `JWT_SECRET` | JWT signing secret (min 32 chars) | `your-secret-here` |### Run-#### Basic-```bash-docker run -d --name traceway \- -p 80:80 \- -e APP_TOKEN="your-app-token" \- -e CLICKHOUSE_SERVER="your-clickhouse-host:9000" \- -e CLICKHOUSE_DATABASE="traceway" \- -e CLICKHOUSE_USERNAME="default" \- -e CLICKHOUSE_PASSWORD="your-password" \- traceway:minimal-```--#### With TLS```bashdocker run -d --name traceway \-p 80:80 \- -e APP_TOKEN="your-app-token" \- -e CLICKHOUSE_SERVER="your-clickhouse-host:9440" \+ -e CLICKHOUSE_SERVER="clickhouse-host:9000" \-e CLICKHOUSE_DATABASE="traceway" \-e CLICKHOUSE_USERNAME="default" \-e CLICKHOUSE_PASSWORD="your-password" \- -e CLICKHOUSE_TLS="true" \+ -e POSTGRES_HOST="postgres-host" \+ -e POSTGRES_PORT="5432" \+ -e POSTGRES_DATABASE="traceway" \+ -e POSTGRES_USERNAME="traceway" \+ -e POSTGRES_PASSWORD="your-password" \+ -e POSTGRES_SSLMODE="disable" \+ -e JWT_SECRET="your-jwt-secret-min-32-characters-long" \traceway:minimal```### Docker Compose Example```yaml-version: '3.8'-services:traceway:build:@@ -73,87 +113,74 @@ services:ports:- "80:80"environment:- APP_TOKEN: "your-app-token"CLICKHOUSE_SERVER: "clickhouse:9000"CLICKHOUSE_DATABASE: "traceway"CLICKHOUSE_USERNAME: "default"- CLICKHOUSE_PASSWORD: "your-password"+ CLICKHOUSE_PASSWORD: "clickhouse"+ CLICKHOUSE_TLS: "false"+ POSTGRES_HOST: "postgres"+ POSTGRES_PORT: "5432"+ POSTGRES_DATABASE: "traceway"+ POSTGRES_USERNAME: "traceway"+ POSTGRES_PASSWORD: "traceway"+ POSTGRES_SSLMODE: "disable"+ JWT_SECRET: "change-this-to-a-secure-secret-at-least-32-chars"depends_on:- - clickhouse+ clickhouse:+ condition: service_healthy+ postgres:+ condition: service_healthy+ restart: unless-stoppedclickhouse:- image: clickhouse/clickhouse-server:24.3- ports:- - "9000:9000"- - "8123:8123"+ image: clickhouse/clickhouse-server:24.8-alpine+ environment:+ CLICKHOUSE_DB: traceway+ CLICKHOUSE_PASSWORD: clickhousevolumes:- clickhouse-data:/var/lib/clickhouse+ healthcheck:+ test: ["CMD", "clickhouse-client", "--password", "clickhouse", "--query", "SELECT 1"]+ interval: 5s+ timeout: 3s+ start_period: 10s+ retries: 10+ restart: unless-stopped++ postgres:+ image: postgres:17+ environment:+ POSTGRES_USER: traceway+ POSTGRES_PASSWORD: traceway+ POSTGRES_DB: traceway+ volumes:+ - postgres-data:/var/lib/postgresql/data+ healthcheck:+ test: ["CMD-SHELL", "pg_isready -U traceway"]+ interval: 5s+ timeout: 3s+ start_period: 10s+ retries: 10+ restart: unless-stoppedvolumes:clickhouse-data:+ postgres-data:```-### Verify Image Size--```bash-docker images traceway:minimal-# Expected: ~20-30MB-```--### Access Points--| URL | Description |-|-----|-------------|-| `http://localhost/` | Frontend (SvelteKit SPA) |-| `http://localhost/api/*` | Backend API |-| `http://localhost/health` | Health check endpoint |-----## All-in-One Deployment (with systemd)--Larger Docker image using systemd for process management. Suitable for development or when you want built-in process supervision.--### Build+## Docker Compose Quick Start```bash-docker build -t traceway:latest .-```+# Start the full stack (builds images and starts all services)+docker compose up --build-### Run--#### Basic-```bash-docker run -d --name traceway -p 80:80 -p 8082:8082 traceway:latest+# Clean restart (removes volumes — resets all data)+docker compose down -v && docker compose up --build```-#### With Persistent Data (Recommended)-```bash-docker run -d --name traceway \- -p 80:80 \- -p 8082:8082 \- -v traceway-data:/var/lib/clickhouse \- traceway:latest-```--#### With Custom Tokens-```bash-docker run -d --name traceway \- -p 80:80 \- -p 8082:8082 \- -e TOKEN="your-client-token" \- -e APP_TOKEN="your-app-token" \- -v traceway-data:/var/lib/clickhouse \- traceway:latest-```--### Access Points--| URL | Description |-|-----|-------------|-| `http://localhost/` | Frontend (SvelteKit SPA) |-| `http://localhost/api/*` | Backend API (proxied through nginx) |-| `http://localhost:8082/api/*` | Direct backend access |+After starting, open `http://localhost/register` to create your first account.---@@ -162,28 +189,18 @@ docker run -d --name traceway \```bash# View logsdocker logs traceway--# Follow logsdocker logs -f traceway# Enter container shell-docker exec -it traceway sh # minimal image (alpine)-docker exec -it traceway bash # all-in-one image (debian)+docker exec -it traceway sh # minimal (alpine)+docker exec -it traceway bash # all-in-one (debian)-# Check health-curl http://localhost/health+# Check process status (all-in-one only)+docker exec traceway supervisorctl status-# Stop container-docker stop traceway+# Health check+curl http://localhost/health# Stop and removedocker stop traceway && docker rm traceway```-------## Notes--- Backend automatically runs database migrations on startup-- The minimal image starts in under 1 second-- For production, always use the minimal image with external ClickHouse for better reliability and scalabilitydiff --git a/Dockerfile b/Dockerfileindex e46fc06e..9ab9897a 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,7 +1,7 @@# ==============================================================================-# Traceway Standalone Docker Image-# Single binary serving both API and Frontend (no ClickHouse included)-# Uses systemd for process management with watchdog support+# Traceway All-in-One Docker Image+# Includes: Frontend (embedded), Backend (Go), ClickHouse, PostgreSQL+# Managed by supervisord# ==============================================================================# ==============================================================================@@ -11,15 +11,12 @@ FROM node:22-alpine AS frontend-builderWORKDIR /app/frontend-# Copy package files first for better cachingCOPY frontend/package.json frontend/package-lock.json ./--# Install dependenciesRUN npm ci-# Copy source and buildCOPY frontend/ ./+ENV CLOUD_MODE=falseRUN npm run build# ==============================================================================@@ -29,100 +26,79 @@ FROM golang:1.25-alpine AS backend-builderWORKDIR /app/backend-# Install build dependenciesRUN apk add --no-cache git-# Copy all backend sourceCOPY backend/ ./--# Copy built frontend to static/dist for embeddingCOPY --from=frontend-builder /app/frontend/build ./static/dist/-# Download dependencies+RUN go mod edit -dropreplace=go.tracewayapp.com -dropreplace=go.tracewayapp.com/tracewaygin+RUN go mod tidyRUN go mod download-# Build with embedded static filesRUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o /traceway .# ==============================================================================-# Stage 3: Final runtime image with systemd+# Stage 3: ClickHouse binary source+# ==============================================================================+FROM clickhouse/clickhouse-server:24.8-alpine AS clickhouse-source++# ==============================================================================+# Stage 4: Runtime image# ==============================================================================FROM debian:bookworm-slim-# Install systemd and minimal dependenciesRUN apt-get update && apt-get install -y --no-install-recommends \- systemd \- systemd-sysv \+ supervisor \ca-certificates \curl \+ musl \+ postgresql \+ postgresql-client \&& rm -rf /var/lib/apt/lists/* \- # Remove unnecessary systemd services- && rm -f /lib/systemd/system/multi-user.target.wants/* \- && rm -f /etc/systemd/system/*.wants/* \- && rm -f /lib/systemd/system/local-fs.target.wants/* \- && rm -f /lib/systemd/system/sockets.target.wants/*udev* \- && rm -f /lib/systemd/system/sockets.target.wants/*initctl* \- && rm -f /lib/systemd/system/basic.target.wants/* \- && rm -f /lib/systemd/system/anaconda.target.wants/*--# Copy the binary-COPY --from=backend-builder /traceway /usr/local/bin/traceway+ && mkdir -p /var/log/supervisor \+ && mkdir -p /var/lib/clickhouse \+ && mkdir -p /var/log/clickhouse-server \+ && mkdir -p /etc/clickhouse-server/config.d \+ && mkdir -p /etc/clickhouse-server/users.d-# Create app directory-RUN mkdir -p /app+# ClickHouse binary + symlinks+COPY --from=clickhouse-source /usr/bin/clickhouse /usr/bin/clickhouse+COPY --from=clickhouse-source /etc/clickhouse-server/config.xml /etc/clickhouse-server/config.xml+COPY --from=clickhouse-source /etc/clickhouse-server/users.xml /etc/clickhouse-server/users.xml-# Create systemd service file for traceway-RUN cat > /etc/systemd/system/traceway.service << 'EOF'-[Unit]-Description=Traceway Error Tracking Server-After=network.target+RUN ln -s /usr/bin/clickhouse /usr/bin/clickhouse-server \+ && ln -s /usr/bin/clickhouse /usr/bin/clickhouse-client-[Service]-Type=simple-ExecStart=/usr/local/bin/traceway-WorkingDirectory=/app-Restart=always-RestartSec=5--# Environment variables-Environment=ENABLE_PORT_80=true-Environment=GIN_MODE=release--# Watchdog - service must notify within 30s or it will be restarted-WatchdogSec=30--# Security hardening-NoNewPrivileges=true-ProtectSystem=strict-ProtectHome=true-ReadWritePaths=/app+# Go backend binary+COPY --from=backend-builder /traceway /usr/local/bin/traceway-# Logging-StandardOutput=journal-StandardError=journal-SyslogIdentifier=traceway+# Configuration files+COPY docker/supervisord.conf /etc/supervisor/supervisord.conf+COPY docker/clickhouse-config.xml /etc/clickhouse-server/config.d/docker.xml+COPY docker/clickhouse-users.xml /etc/clickhouse-server/users.d/docker.xml+COPY docker/wait-for-clickhouse.sh /usr/local/bin/wait-for-clickhouse.sh+COPY docker/start-backend.sh /usr/local/bin/start-backend.sh+COPY docker/init-postgres.sh /usr/local/bin/init-postgres.sh-[Install]-WantedBy=multi-user.target-EOF+RUN chmod +x /usr/local/bin/wait-for-clickhouse.sh \+ && chmod +x /usr/local/bin/start-backend.sh \+ && chmod +x /usr/local/bin/init-postgres.sh-# Enable the service-RUN systemctl enable traceway.service+# Create clickhouse user and set permissions+RUN useradd -r -s /bin/false clickhouse \+ && chown -R clickhouse:clickhouse /var/lib/clickhouse \+ && chown -R clickhouse:clickhouse /var/log/clickhouse-server-# Set working directoryWORKDIR /app+COPY backend/.env.docker /app/.env-# Environment variables (can be overridden at runtime)-ENV ENABLE_PORT_80=trueENV GIN_MODE=release-# Expose ports+VOLUME ["/var/lib/clickhouse", "/var/lib/postgresql/data"]+EXPOSE 80 8082-# Health check-HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \+HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \CMD curl -f http://localhost/health || exit 1-# Use systemd as init-STOPSIGNAL SIGRTMIN+3-CMD ["/lib/systemd/systemd"]+CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]diff --git a/Dockerfile.clickhouse b/Dockerfile.clickhousedeleted file mode 100644index 8db6e815..00000000--- a/Dockerfile.clickhouse+++ /dev/null@@ -1,113 +0,0 @@-# ==============================================================================-# Traceway All-in-One Docker Image-# Includes: Frontend (embedded in Go binary), Backend (Go), ClickHouse-# ==============================================================================--# ==============================================================================-# Stage 1: Build Frontend-# ==============================================================================-FROM node:22-alpine AS frontend-builder--WORKDIR /app/frontend--# Copy package files first for better caching-COPY frontend/package.json frontend/package-lock.json ./--# Install dependencies-RUN npm ci--# Copy source and build-COPY frontend/ ./--RUN npm run build--# ==============================================================================-# Stage 2: Build Backend with embedded frontend-# ==============================================================================-FROM golang:1.24-alpine AS backend-builder--WORKDIR /app/backend--# Install build dependencies-RUN apk add --no-cache git--# Copy all backend source-COPY backend/ ./--# Copy built frontend to static/dist for embedding-COPY --from=frontend-builder /app/frontend/build ./static/dist/--# Fix go version (1.25.1 doesn't exist yet, use 1.24) and download deps-RUN go mod edit -go=1.24 && go mod download--# Build with embedded static files-RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o /traceway-backend .--# ==============================================================================-# Stage 3: Extract ClickHouse binaries-# ==============================================================================-FROM clickhouse/clickhouse-server:24.8-alpine AS clickhouse-source--# ==============================================================================-# Stage 4: Final Runtime Image-# ==============================================================================-FROM debian:bookworm-slim--# Install runtime dependencies (no nginx needed - frontend embedded in binary)-RUN apt-get update && apt-get install -y --no-install-recommends \- supervisor \- ca-certificates \- curl \- && rm -rf /var/lib/apt/lists/* \- && mkdir -p /var/log/supervisor \- && mkdir -p /var/lib/clickhouse \- && mkdir -p /var/log/clickhouse-server \- && mkdir -p /etc/clickhouse-server/config.d \- && mkdir -p /etc/clickhouse-server/users.d--# Copy ClickHouse binaries and configs from official image-COPY --from=clickhouse-source /usr/bin/clickhouse /usr/bin/clickhouse-COPY --from=clickhouse-source /etc/clickhouse-server/config.xml /etc/clickhouse-server/config.xml-COPY --from=clickhouse-source /etc/clickhouse-server/users.xml /etc/clickhouse-server/users.xml--# Create ClickHouse symlinks (clickhouse is a multicall binary)-RUN ln -s /usr/bin/clickhouse /usr/bin/clickhouse-server \- && ln -s /usr/bin/clickhouse /usr/bin/clickhouse-client--# Copy built backend (with embedded frontend)-COPY --from=backend-builder /traceway-backend /usr/local/bin/traceway-backend--# Copy configuration files-COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf-COPY docker/clickhouse-config.xml /etc/clickhouse-server/config.d/docker.xml-COPY docker/clickhouse-users.xml /etc/clickhouse-server/users.d/docker.xml-COPY docker/wait-for-clickhouse.sh /usr/local/bin/wait-for-clickhouse.sh-COPY docker/start-backend.sh /usr/local/bin/start-backend.sh--# Make scripts executable-RUN chmod +x /usr/local/bin/wait-for-clickhouse.sh \- && chmod +x /usr/local/bin/start-backend.sh--# Create clickhouse user and set permissions-RUN useradd -r -s /bin/false clickhouse \- && chown -R clickhouse:clickhouse /var/lib/clickhouse \- && chown -R clickhouse:clickhouse /var/log/clickhouse-server--# Create app directory for backend and copy env file-WORKDIR /app-COPY backend/.env.docker /app/.env--# Environment variables-ENV ENABLE_PORT_80=true--# Expose ports-# Port 80: backend serves frontend + API-# Port 8082: direct backend access (optional)-EXPOSE 80 8082--# Health check-HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \- CMD curl -f http://localhost/health || exit 1--# Start supervisord-CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]diff --git a/Dockerfile.minimal b/Dockerfile.minimalindex 801a93c0..5c3b4863 100644--- a/Dockerfile.minimal+++ b/Dockerfile.minimal@@ -21,6 +21,7 @@ RUN npm ci# Copy source and buildCOPY frontend/ ./+ENV CLOUD_MODE=falseRUN npm run build# ==============================================================================@@ -39,7 +40,9 @@ COPY backend/ ./# Copy built frontend to static/dist for embeddingCOPY --from=frontend-builder /app/frontend/build ./static/dist/-# Download dependencies+# Strip local replace directives and download dependencies+RUN go mod edit -dropreplace=go.tracewayapp.com -dropreplace=go.tracewayapp.com/tracewaygin+RUN go mod tidyRUN go mod download# Build with embedded static files@@ -63,10 +66,9 @@ WORKDIR /app# Environment variables (can be overridden at runtime)ENV GIN_MODE=release-ENV ENABLE_PORT_80=true# Expose ports-# 80: Frontend + API (when ENABLE_PORT_80=true)+# 80: Frontend + API# 8082: Direct API accessEXPOSE 80 8082diff --git a/backend/.env.docker b/backend/.env.dockerindex 3665f077..303cfa02 100644--- a/backend/.env.docker+++ b/backend/.env.docker@@ -1,6 +1,13 @@-APP_TOKEN="nice"CLICKHOUSE_SERVER=localhost:9000CLICKHOUSE_DATABASE=tracewayCLICKHOUSE_USERNAME=defaultCLICKHOUSE_PASSWORD=CLICKHOUSE_TLS=false+POSTGRES_HOST=localhost+POSTGRES_PORT=5432+POSTGRES_DATABASE=traceway+POSTGRES_USERNAME=traceway+POSTGRES_PASSWORD=+POSTGRES_SSLMODE=disable+JWT_SECRET=Xt7Kj2mP9qLwNc4rVb8sYd3hFgAeZuCpDnRoWxMvBa5k+GIN_MODE=releasediff --git a/docker-compose.yml b/docker-compose.ymlnew file mode 100644index 00000000..c2bb33e7--- /dev/null+++ b/docker-compose.yml@@ -0,0 +1,61 @@+services:+ traceway:+ build:+ context: .+ dockerfile: Dockerfile.minimal+ ports:+ - "80:80"+ environment:+ CLICKHOUSE_SERVER: "clickhouse:9000"+ CLICKHOUSE_DATABASE: "traceway"+ CLICKHOUSE_USERNAME: "default"+ CLICKHOUSE_PASSWORD: "clickhouse"+ CLICKHOUSE_TLS: "false"+ POSTGRES_HOST: "postgres"+ POSTGRES_PORT: "5432"+ POSTGRES_DATABASE: "traceway"+ POSTGRES_USERNAME: "traceway"+ POSTGRES_PASSWORD: "traceway"+ POSTGRES_SSLMODE: "disable"+ JWT_SECRET: "change-this-to-a-secure-secret-at-least-32-chars"+ depends_on:+ clickhouse:+ condition: service_healthy+ postgres:+ condition: service_healthy+ restart: unless-stopped++ clickhouse:+ image: clickhouse/clickhouse-server:24.8-alpine+ environment:+ CLICKHOUSE_DB: traceway+ CLICKHOUSE_PASSWORD: clickhouse+ volumes:+ - clickhouse-data:/var/lib/clickhouse+ healthcheck:+ test: ["CMD", "clickhouse-client", "--password", "clickhouse", "--query", "SELECT 1"]+ interval: 5s+ timeout: 3s+ start_period: 10s+ retries: 10+ restart: unless-stopped++ postgres:+ image: postgres:17+ environment:+ POSTGRES_USER: traceway+ POSTGRES_PASSWORD: traceway+ POSTGRES_DB: traceway+ volumes:+ - postgres-data:/var/lib/postgresql/data+ healthcheck:+ test: ["CMD-SHELL", "pg_isready -U traceway"]+ interval: 5s+ timeout: 3s+ start_period: 10s+ retries: 10+ restart: unless-stopped++volumes:+ clickhouse-data:+ postgres-data:diff --git a/docker/init-postgres.sh b/docker/init-postgres.shnew file mode 100644index 00000000..06bb37e0--- /dev/null+++ b/docker/init-postgres.sh@@ -0,0 +1,49 @@+#!/bin/bash+set -e++PG_DATA="/var/lib/postgresql/data"+PG_BIN=$(ls -d /usr/lib/postgresql/*/bin | head -1)++if [ -z "$PG_BIN" ]; then+ echo "ERROR: Could not find PostgreSQL binaries"+ exit 1+fi++echo "Using PostgreSQL binaries from: $PG_BIN"++if [ ! -s "$PG_DATA/PG_VERSION" ]; then+ echo "Initializing PostgreSQL data directory..."++ mkdir -p "$PG_DATA"+ chown postgres:postgres "$PG_DATA"+ chmod 700 "$PG_DATA"++ runuser -u postgres -- "$PG_BIN/initdb" -D "$PG_DATA"++ cat > "$PG_DATA/pg_hba.conf" << 'EOF'+local all all trust+host all all 127.0.0.1/32 trust+host all all ::1/128 trust+EOF++ cat >> "$PG_DATA/postgresql.conf" << 'EOF'+listen_addresses = '127.0.0.1'+port = 5432+max_connections = 100+shared_buffers = 128MB+log_destination = 'stderr'+logging_collector = off+EOF++ runuser -u postgres -- "$PG_BIN/pg_ctl" -D "$PG_DATA" -w start++ runuser -u postgres -- psql -c "CREATE USER traceway WITH PASSWORD '';"+ runuser -u postgres -- psql -c "CREATE DATABASE traceway OWNER traceway;"++ runuser -u postgres -- "$PG_BIN/pg_ctl" -D "$PG_DATA" -w stop++ echo "PostgreSQL initialized successfully."+fi++echo "Starting PostgreSQL..."+exec runuser -u postgres -- "$PG_BIN/postgres" -D "$PG_DATA"diff --git a/docker/nginx.conf b/docker/nginx.confdeleted file mode 100644index 27b81521..00000000--- a/docker/nginx.conf+++ /dev/null@@ -1,93 +0,0 @@-user www-data;-worker_processes auto;-pid /run/nginx.pid;-error_log /var/log/nginx/error.log warn;--events {- worker_connections 1024;- use epoll;- multi_accept on;-}--http {- include /etc/nginx/mime.types;- default_type application/octet-stream;-- log_format main '$remote_addr - $remote_user [$time_local] "$request" '- '$status $body_bytes_sent "$http_referer" '- '"$http_user_agent" "$http_x_forwarded_for"';-- access_log /var/log/nginx/access.log main;-- sendfile on;- tcp_nopush on;- tcp_nodelay on;- keepalive_timeout 65;- types_hash_max_size 2048;-- # Gzip compression- gzip on;- gzip_vary on;- gzip_proxied any;- gzip_comp_level 6;- gzip_types text/plain text/css text/xml application/json application/javascript- application/xml application/xml+rss text/javascript image/svg+xml;-- # Upstream for backend- upstream backend {- server 127.0.0.1:8082;- keepalive 32;- }-- server {- listen 80;- server_name _;- root /var/www/html;- index index.html;-- # Security headers- add_header X-Frame-Options "SAMEORIGIN" always;- add_header X-Content-Type-Options "nosniff" always;- add_header X-XSS-Protection "1; mode=block" always;-- # API proxy - all /api requests go to backend- location /api {- proxy_pass http://backend;- proxy_http_version 1.1;- proxy_set_header Host $host;- proxy_set_header X-Real-IP $remote_addr;- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;- proxy_set_header X-Forwarded-Proto $scheme;- proxy_set_header Connection "";-- # Timeouts- proxy_connect_timeout 60s;- proxy_send_timeout 60s;- proxy_read_timeout 60s;-- # Buffering settings- proxy_buffering on;- proxy_buffer_size 4k;- proxy_buffers 8 4k;- }-- # Static assets with caching- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {- expires 1y;- add_header Cache-Control "public, immutable";- try_files $uri =404;- }-- # SPA fallback - serve index.html for all other routes- location / {- try_files $uri $uri/ /index.html;- }-- # Health check endpoint- location /health {- access_log off;- return 200 "OK\n";- add_header Content-Type text/plain;- }- }-}diff --git a/docker/start-backend.sh b/docker/start-backend.shindex 915b09b1..9acb42d3 100644--- a/docker/start-backend.sh+++ b/docker/start-backend.sh@@ -1,10 +1,32 @@#!/bin/bashset -e-if [[ "$CLICKHOUSE_SERVER" == localhost* ]]; then+set -a+source /app/.env+set +a++if [[ "$CLICKHOUSE_SERVER" == localhost* ]] || [[ "$CLICKHOUSE_SERVER" == 127.0.0.1* ]]; thenecho "Waiting for ClickHouse to be ready..."/usr/local/bin/wait-for-clickhouse.shfi+if [[ "$POSTGRES_HOST" == "localhost" ]] || [[ "$POSTGRES_HOST" == "127.0.0.1" ]]; then+ echo "Waiting for PostgreSQL to be ready..."+ MAX_RETRIES=30+ RETRY_INTERVAL=2+ for i in $(seq 1 $MAX_RETRIES); do+ if pg_isready -h 127.0.0.1 -p 5432 > /dev/null 2>&1; then+ echo "PostgreSQL is ready!"+ break+ fi+ if [ $i -eq $MAX_RETRIES ]; then+ echo "ERROR: PostgreSQL failed to become ready after $MAX_RETRIES attempts"+ exit 1+ fi+ echo "Attempt $i/$MAX_RETRIES: PostgreSQL not ready yet, waiting ${RETRY_INTERVAL}s..."+ sleep $RETRY_INTERVAL+ done+fi+echo "Starting Traceway backend..."-exec /usr/local/bin/traceway-backend+exec /usr/local/bin/tracewaydiff --git a/docker/supervisord.conf b/docker/supervisord.confindex dbd9f787..f6193e06 100644--- a/docker/supervisord.conf+++ b/docker/supervisord.conf@@ -29,7 +29,20 @@ stderr_logfile=/var/log/supervisor/clickhouse-stderr.logstdout_logfile_maxbytes=10MBstderr_logfile_maxbytes=10MB-; Backend - starts after ClickHouse (priority 20)+; PostgreSQL - starts in parallel with ClickHouse (priority 10)+[program:postgresql]+command=/usr/local/bin/init-postgres.sh+autostart=true+autorestart=true+priority=10+startsecs=10+startretries=3+stdout_logfile=/var/log/supervisor/postgresql-stdout.log+stderr_logfile=/var/log/supervisor/postgresql-stderr.log+stdout_logfile_maxbytes=10MB+stderr_logfile_maxbytes=10MB++; Backend - starts after databases (priority 20)[program:backend]command=/usr/local/bin/start-backend.shdirectory=/app@@ -42,4 +55,3 @@ stdout_logfile=/var/log/supervisor/backend-stdout.logstderr_logfile=/var/log/supervisor/backend-stderr.logstdout_logfile_maxbytes=10MBstderr_logfile_maxbytes=10MB-diff --git a/docs/components/DeploymentCards.jsx b/docs/components/DeploymentCards.jsxnew file mode 100644index 00000000..f91fca95--- /dev/null+++ b/docs/components/DeploymentCards.jsx@@ -0,0 +1,52 @@+import Link from "next/link";++const DEPLOYMENTS = [+ {+ title: "All-in-One Container",+ badge: "Recommended",+ href: "/server/all-in-one",+ subtitle: "ClickHouse + PostgreSQL + Backend + Frontend",+ description:+ "Everything in a single Docker container managed by supervisord. No external dependencies needed.",+ },+ {+ title: "Docker Compose",+ href: "/server/docker-compose",+ subtitle: "Backend + Frontend + ClickHouse + PostgreSQL",+ description:+ "Each component runs as its own container, orchestrated with a single command.",+ },+ {+ title: "Minimal Container",+ href: "/server/minimal",+ subtitle: "Backend + Frontend only",+ description:+ "Lightweight Alpine image (~20-30MB). Connect to your own external ClickHouse and PostgreSQL.",+ },+ {+ title: "Local Setup",+ href: "/server/local-setup",+ subtitle: "Backend + Frontend from source",+ description:+ "Development setup with Go and Node.js. Requires local ClickHouse and PostgreSQL.",+ },+];++export function DeploymentCards() {+ return (+ <div className="deployment-grid">+ {DEPLOYMENTS.map((d) => (+ <Link key={d.href} href={d.href} className="deployment-card">+ <div className="deployment-card-top">+ <span className="deployment-card-title">{d.title}</span>+ {d.badge && (+ <span className="deployment-card-badge">{d.badge}</span>+ )}+ </div>+ <span className="deployment-card-subtitle">{d.subtitle}</span>+ <span className="deployment-card-desc">{d.description}</span>+ </Link>+ ))}+ </div>+ );+}diff --git a/docs/pages/server/_meta.json b/docs/pages/server/_meta.jsonindex 50fdc858..2ede9799 100644--- a/docs/pages/server/_meta.json+++ b/docs/pages/server/_meta.json@@ -1,5 +1,7 @@{"index": "Overview",- "local-setup": "Local Setup",- "docker": "Docker Deployment"+ "all-in-one": "All-in-One Container",+ "docker-compose": "Docker Compose",+ "minimal": "Minimal Container",+ "local-setup": "Local Setup"}diff --git a/docs/pages/server/all-in-one.mdx b/docs/pages/server/all-in-one.mdxnew file mode 100644index 00000000..d363d681--- /dev/null+++ b/docs/pages/server/all-in-one.mdx@@ -0,0 +1,69 @@+# All-in-One Container++Single Docker container with ClickHouse, PostgreSQL, and the Go backend managed by supervisord. Best for simple setups where you want everything in one place.++## Build++```bash+docker build -t traceway:latest .+```++## Run++```bash+docker run -d --name traceway \+ -p 80:80 \+ -v traceway-ch:/var/lib/clickhouse \+ -v traceway-pg:/var/lib/postgresql/data \+ traceway:latest+```++After starting, open `http://localhost/register` to create your first account.++## Environment Variables++All environment variables have working defaults, no configuration required. Override as needed:++| Variable | Default | Description |+|----------|---------|-------------|+| `CLICKHOUSE_SERVER` | `localhost:9000` | ClickHouse host:port |+| `CLICKHOUSE_DATABASE` | `traceway` | ClickHouse database name |+| `CLICKHOUSE_USERNAME` | `default` | ClickHouse username |+| `CLICKHOUSE_PASSWORD` | *(empty)* | ClickHouse password |+| `CLICKHOUSE_TLS` | `false` | Enable TLS for ClickHouse |+| `POSTGRES_HOST` | `localhost` | PostgreSQL host |+| `POSTGRES_PORT` | `5432` | PostgreSQL port |+| `POSTGRES_DATABASE` | `traceway` | PostgreSQL database name |+| `POSTGRES_USERNAME` | `traceway` | PostgreSQL username |+| `POSTGRES_PASSWORD` | *(empty)* | PostgreSQL password |+| `POSTGRES_SSLMODE` | `disable` | PostgreSQL SSL mode |+| `JWT_SECRET` | *(built-in default)* | JWT signing secret (min 32 chars) |+| `GIN_MODE` | `release` | Gin framework mode |++## Access Points++| URL | Description |+|-----|-------------|+| `http://localhost/` | Frontend dashboard |+| `http://localhost/api/*` | Backend API |+| `http://localhost/health` | Health check |++## Useful Commands++```bash+# View logs+docker logs traceway+docker logs -f traceway++# Enter container shell+docker exec -it traceway bash++# Check process status+docker exec traceway supervisorctl status++# Health check+curl http://localhost/health++# Stop and remove+docker stop traceway && docker rm traceway+```diff --git a/docs/pages/server/docker-compose.mdx b/docs/pages/server/docker-compose.mdxnew file mode 100644index 00000000..459e9a2f--- /dev/null+++ b/docs/pages/server/docker-compose.mdx@@ -0,0 +1,58 @@+# Docker Compose++Runs Traceway, ClickHouse, and PostgreSQL as separate services. Uses the [Minimal Container](/server/minimal) image with databases managed by Docker Compose.++## Quick Start++```bash+# Start the full stack (builds images and starts all services)+docker compose up --build++# Clean restart (removes volumes, resets all data)+docker compose down -v && docker compose up --build+```++After starting, open `http://localhost/register` to create your first account.++## Configuration++The `docker-compose.yml` in the repository root is ready to use out of the box. To customize, edit the environment variables in the file directly:++| Variable | Default | Description |+|----------|---------|-------------|+| `CLICKHOUSE_SERVER` | `clickhouse:9000` | ClickHouse host:port |+| `CLICKHOUSE_DATABASE` | `traceway` | ClickHouse database name |+| `CLICKHOUSE_USERNAME` | `default` | ClickHouse username |+| `CLICKHOUSE_PASSWORD` | `clickhouse` | ClickHouse password |+| `CLICKHOUSE_TLS` | `false` | Enable TLS for ClickHouse |+| `POSTGRES_HOST` | `postgres` | PostgreSQL host |+| `POSTGRES_PORT` | `5432` | PostgreSQL port |+| `POSTGRES_DATABASE` | `traceway` | PostgreSQL database name |+| `POSTGRES_USERNAME` | `traceway` | PostgreSQL username |+| `POSTGRES_PASSWORD` | `traceway` | PostgreSQL password |+| `POSTGRES_SSLMODE` | `disable` | PostgreSQL SSL mode |+| `JWT_SECRET` | `change-this-to-a-secure-secret-at-least-32-chars` | JWT signing secret (min 32 chars) |++## Access Points++| URL | Description |+|-----|-------------|+| `http://localhost/` | Frontend dashboard |+| `http://localhost/api/*` | Backend API |+| `http://localhost/health` | Health check |++## Useful Commands++```bash+# View logs for all services+docker compose logs -f++# View logs for a specific service+docker compose logs -f traceway++# Stop all services+docker compose down++# Stop and remove all data+docker compose down -v+```diff --git a/docs/pages/server/docker.mdx b/docs/pages/server/docker.mdxdeleted file mode 100644index 160f1759..00000000--- a/docs/pages/server/docker.mdx+++ /dev/null@@ -1,87 +0,0 @@-# Docker Deployment--Deploy Traceway using a single minimal Docker image that bundles both the frontend and backend.--## Prerequisites--- Docker installed-- Node.js and npm (for building the frontend)-- Go 1.25+ (for building the backend)--## Build the Image--### 1. Bundle the Frontend--From the repository root, run the build script that compiles the frontend and bundles it into the backend:--```bash-./script/build-and-bundle-frontend.sh-```--This script:--- Builds the SvelteKit frontend-- Copies the static files into the backend's embedded assets--### 2. Build the Docker Image--Build the minimal Docker image:--```bash-docker build -f Dockerfile.minimal -t traceway:minimal .-```--## Run the Container--Run Traceway with the required port bindings:--```bash-docker run -d \- --name traceway \- -p 80:80 \- -p 8082:8082 \- -e JWT_SECRET="your-secret-key-minimum-32-characters-long" \- -e CLICKHOUSE_SERVER="host.docker.internal:9000" \- -e CLICKHOUSE_DATABASE="traceway" \- -e CLICKHOUSE_USERNAME="default" \- -e CLICKHOUSE_PASSWORD="" \- -e POSTGRES_HOST="host.docker.internal" \- -e POSTGRES_PORT="5432" \- -e POSTGRES_DATABASE="traceway" \- -e POSTGRES_USERNAME="traceway" \- -e POSTGRES_PASSWORD="your-postgres-password" \- traceway:minimal-```--### Port Reference--| Port | Purpose |-| ------ | --------------------------------------------- |-| `80` | Dashboard (frontend) |-| `8082` | API server (backend + SDK telemetry endpoint) |--## Environment Variables--| Variable | Description | Required |-| --------------------- | ------------------------------------------------ | -------- |-| `JWT_SECRET` | Secret key for JWT signing (min 32 characters) | Yes |-| `CLICKHOUSE_SERVER` | ClickHouse server address | Yes |-| `CLICKHOUSE_DATABASE` | ClickHouse database name | Yes |-| `CLICKHOUSE_USERNAME` | ClickHouse username | Yes |-| `CLICKHOUSE_PASSWORD` | ClickHouse password | No |-| `CLICKHOUSE_TLS` | Enable TLS for ClickHouse (`true`/`false`) | No |-| `POSTGRES_HOST` | PostgreSQL host | Yes |-| `POSTGRES_PORT` | PostgreSQL port | Yes |-| `POSTGRES_DATABASE` | PostgreSQL database name | Yes |-| `POSTGRES_USERNAME` | PostgreSQL username | Yes |-| `POSTGRES_PASSWORD` | PostgreSQL password | Yes |-| `POSTGRES_SSLMODE` | PostgreSQL SSL mode (`disable`, `require`, etc.) | No |--## Verify the Deployment--Once running, access:--- **Dashboard**: http://localhost-- **API**: http://localhost:8082/api--Configure your Go SDK to send telemetry to `http://localhost:8082/api/report`.diff --git a/docs/pages/server/index.mdx b/docs/pages/server/index.mdxindex 496f5d5c..3218a7c3 100644--- a/docs/pages/server/index.mdx+++ b/docs/pages/server/index.mdx@@ -1,8 +1,9 @@+import { DeploymentCards } from "../../components/DeploymentCards";+# Self Host-Traceway is fully self-hosted — you run the entire platform on your own infrastructure. This section covers how to get Traceway up and running.+Traceway is fully self-hosted. You run the entire platform on your own infrastructure. This section covers how to get Traceway up and running.## Deployment Options-- [Local Setup](/server/local-setup) — Set up Traceway on your local machine for development-- [Docker Deployment](/server/docker) — Deploy Traceway as a single Docker container+<DeploymentCards />diff --git a/docs/pages/server/minimal.mdx b/docs/pages/server/minimal.mdxnew file mode 100644index 00000000..d6d88dcd--- /dev/null+++ b/docs/pages/server/minimal.mdx@@ -0,0 +1,72 @@+# Minimal Container++Lightweight Alpine image (~20-30MB) containing only the Go backend with the embedded frontend. Requires external ClickHouse and PostgreSQL instances.++## Build++```bash+docker build -f Dockerfile.minimal -t traceway:minimal .+```++## Run++```bash+docker run -d --name traceway \+ -p 80:80 \+ -e CLICKHOUSE_SERVER="clickhouse-host:9000" \+ -e CLICKHOUSE_DATABASE="traceway" \+ -e CLICKHOUSE_USERNAME="default" \+ -e CLICKHOUSE_PASSWORD="your-password" \+ -e POSTGRES_HOST="postgres-host" \+ -e POSTGRES_PORT="5432" \+ -e POSTGRES_DATABASE="traceway" \+ -e POSTGRES_USERNAME="traceway" \+ -e POSTGRES_PASSWORD="your-password" \+ -e POSTGRES_SSLMODE="disable" \+ -e JWT_SECRET="your-jwt-secret-min-32-characters-long" \+ traceway:minimal+```++After starting, open `http://localhost/register` to create your first account.++## Required Environment Variables++| Variable | Description | Example |+|----------|-------------|---------|+| `CLICKHOUSE_SERVER` | ClickHouse host:port | `clickhouse:9000` |+| `CLICKHOUSE_DATABASE` | ClickHouse database | `traceway` |+| `CLICKHOUSE_USERNAME` | ClickHouse username | `default` |+| `CLICKHOUSE_PASSWORD` | ClickHouse password | `password` |+| `CLICKHOUSE_TLS` | Enable TLS | `false` |+| `POSTGRES_HOST` | PostgreSQL host | `postgres` |+| `POSTGRES_PORT` | PostgreSQL port | `5432` |+| `POSTGRES_DATABASE` | PostgreSQL database | `traceway` |+| `POSTGRES_USERNAME` | PostgreSQL username | `traceway` |+| `POSTGRES_PASSWORD` | PostgreSQL password | `password` |+| `POSTGRES_SSLMODE` | PostgreSQL SSL mode | `disable` |+| `JWT_SECRET` | JWT signing secret (min 32 chars) | `your-secret-here` |++## Access Points++| URL | Description |+|-----|-------------|+| `http://localhost/` | Frontend dashboard |+| `http://localhost/api/*` | Backend API |+| `http://localhost/health` | Health check |++## Useful Commands++```bash+# View logs+docker logs traceway+docker logs -f traceway++# Enter container shell+docker exec -it traceway sh++# Health check+curl http://localhost/health++# Stop and remove+docker stop traceway && docker rm traceway+```diff --git a/docs/styles/custom.css b/docs/styles/custom.cssindex 32555ee3..97add4a0 100644--- a/docs/styles/custom.css+++ b/docs/styles/custom.css@@ -263,6 +263,101 @@ li:has(> .sdk-selector) > span:first-child {color: #9ca3af;}+/* Deployment Cards */+.deployment-grid {+ display: grid;+ grid-template-columns: repeat(2, 1fr);+ gap: 16px;+ margin-top: 24px;+}++@media (max-width: 768px) {+ .deployment-grid {+ grid-template-columns: 1fr;+ }+}++.deployment-card {+ display: flex;+ flex-direction: column;+ gap: 8px;+ padding: 24px;+ border: 1px solid #e5e7eb;+ border-radius: 12px;+ background: #fff;+ text-decoration: none;+ transition:+ border-color 0.15s,+ box-shadow 0.15s;+}++.deployment-card:hover {+ border-color: #3b82f6;+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);+}++.deployment-card-top {+ display: flex;+ align-items: center;+ justify-content: space-between;+}++.deployment-card-title {+ font-size: 16px;+ font-weight: 600;+ color: #111827;+}++.deployment-card-badge {+ font-size: 11px;+ font-weight: 600;+ padding: 2px 8px;+ border-radius: 4px;+ background: #3b82f6;+ color: white;+ letter-spacing: 0.02em;+ line-height: 1.5;+}++.deployment-card-subtitle {+ font-size: 13px;+ font-weight: 500;+ color: #374151;+}++.deployment-card-desc {+ font-size: 14px;+ color: #6b7280;+ line-height: 1.5;+}++:is(html[class~="dark"]) .deployment-card {+ background: #1a1a2e;+ border-color: #374151;+}++:is(html[class~="dark"]) .deployment-card:hover {+ border-color: #3b82f6;+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);+}++:is(html[class~="dark"]) .deployment-card-title {+ color: #e5e7eb;+}++:is(html[class~="dark"]) .deployment-card-badge {+ background: rgba(59, 130, 246, 0.15);+ color: #93bbfd;+}++:is(html[class~="dark"]) .deployment-card-subtitle {+ color: #d1d5db;+}++:is(html[class~="dark"]) .deployment-card-desc {+ color: #9ca3af;+}+/* Dark mode */:is(html[class~="dark"]) .sdk-selector-trigger {background: #1a1a2e;diff --git a/frontend/src/routes/register/+page.svelte b/frontend/src/routes/register/+page.svelteindex 1d748457..7af1bb95 100644--- a/frontend/src/routes/register/+page.svelte+++ b/frontend/src/routes/register/+page.svelte@@ -42,10 +42,9 @@.then(response => response.json()).then((response) => {if (response.hasOrganizations) {- loading = false- } else {- goto("/register")+ goto("/login")}+ loading = false}).catch(() => {toast.error("An unexpected error has occured. The page will refresh in 5 seconds.")setTimeout(() => {diff --git a/frontend/vite.config.ts b/frontend/vite.config.tsindex 97063d03..d11b0144 100644--- a/frontend/vite.config.ts+++ b/frontend/vite.config.ts@@ -11,6 +11,24 @@ const billingPath = process.env.BILLING_PATH;const resolvedBillingPath = billingPath ? path.resolve(import.meta.dirname, billingPath) : null;const billingExists = resolvedBillingPath && existsSync(resolvedBillingPath);+function stubBillingImports(): Plugin {+ if (billingExists) return { name: 'stub-billing-imports' };+ return {+ name: 'stub-billing-imports',+ enforce: 'pre',+ resolveId(id) {+ if (id.startsWith('$billing/')) {+ return '\0virtual:billing-stub';+ }+ },+ load(id) {+ if (id === '\0virtual:billing-stub') {+ return 'export default {}';+ }+ }+ };+}+function injectBillingSource(): Plugin {return {name: 'inject-billing-source',@@ -31,7 +49,7 @@ export default defineConfig(({ mode }) => {const env = loadEnv(mode, process.cwd(), '');return {- plugins: [injectBillingSource(), tailwindcss(), sveltekit()],+ plugins: [stubBillingImports(), injectBillingSource(), tailwindcss(), sveltekit()],define: {__APP_VERSION__: JSON.stringify(env.PUBLIC_APP_VERSION || pkg.version),__CLOUD_MODE__: env.CLOUD_MODE,