Skip to content

The only tool you need to know what is happening and how to fix it.

lighter builds

dduxb7424a0ed795
diff --git a/Dockerfile b/Dockerfile
index de7cc231..7486d408 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,7 @@
# ==============================================================================
-# Traceway All-in-One Docker Image
-# Includes: Frontend (SvelteKit), Backend (Go), ClickHouse
+# Traceway Standalone Docker Image
+# Single binary serving both API and Frontend (no ClickHouse included)
+# Uses systemd for process management with watchdog support
# ==============================================================================
# ==============================================================================
@@ -19,13 +20,10 @@ RUN npm ci
# Copy source and build
COPY frontend/ ./
-# Set the API URL for the frontend build (baked in at build time)
-ENV VITE_API_URL=https://tracewayapp.com
-
RUN npm run build
# ==============================================================================
-# Stage 2: Build Backend
+# Stage 2: Build Backend with embedded frontend
# ==============================================================================
FROM golang:1.24-alpine AS backend-builder
@@ -37,80 +35,94 @@ RUN apk add --no-cache git
# Copy all backend source
COPY backend/ ./
-# 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
+# Copy built frontend to static/dist for embedding
+COPY --from=frontend-builder /app/frontend/build ./static/dist/
-# Build
-RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o /traceway-backend .
+# Fix go version and download deps
+RUN go mod edit -go=1.24 && go mod download
-# ==============================================================================
-# Stage 3: Extract ClickHouse binaries
-# ==============================================================================
-FROM clickhouse/clickhouse-server:24.8-alpine AS clickhouse-source
+# Build with embedded static files
+RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o /traceway .
# ==============================================================================
-# Stage 4: Final Runtime Image
+# Stage 3: Final runtime image with systemd
# ==============================================================================
FROM debian:bookworm-slim
-# Install runtime dependencies
+# Install systemd and minimal dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
- nginx \
- supervisor \
+ systemd \
+ systemd-sysv \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/* \
- && mkdir -p /var/log/supervisor \
- && mkdir -p /var/log/nginx \
- && 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 frontend
-COPY --from=frontend-builder /app/frontend/build /var/www/html
-
-# Copy built backend
-COPY --from=backend-builder /traceway-backend /usr/local/bin/traceway-backend
-
-# Copy configuration files
-COPY docker/nginx.conf /etc/nginx/nginx.conf
-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
+ # 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
+
+# Create app directory
+RUN mkdir -p /app
+
+# Create systemd service file for traceway
+RUN cat > /etc/systemd/system/traceway.service << 'EOF'
+[Unit]
+Description=Traceway Error Tracking Server
+After=network.target
+
+[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
+
+# Logging
+StandardOutput=journal
+StandardError=journal
+SyslogIdentifier=traceway
+
+[Install]
+WantedBy=multi-user.target
+EOF
+
+# Enable the service
+RUN systemctl enable traceway.service
+
+# Set working directory
WORKDIR /app
-COPY backend/.env.docker /app/.env
+
+# Environment variables (can be overridden at runtime)
+ENV ENABLE_PORT_80=true
+ENV GIN_MODE=release
# Expose ports
-# Port 80: nginx (frontend + API proxy)
-# Port 8082: direct backend access (optional)
EXPOSE 80 8082
# Health check
-HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
+HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD curl -f http://localhost/health || exit 1
-# Start supervisord
-CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
+# Use systemd as init
+STOPSIGNAL SIGRTMIN+3
+CMD ["/lib/systemd/systemd"]
diff --git a/Dockerfile.clickhouse b/Dockerfile.clickhouse
new file mode 100644
index 00000000..8db6e815
--- /dev/null
+++ b/Dockerfile.clickhouse
@@ -0,0 +1,113 @@
+# ==============================================================================
+# 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/backend/app/models/project.model.go b/backend/app/models/project.model.go
index 94c196c0..0d5ef464 100644
--- a/backend/app/models/project.model.go
+++ b/backend/app/models/project.model.go
@@ -1,11 +1,20 @@
package models
import (
+ "os"
"time"
"github.com/google/uuid"
)
+// getBackendUrl returns the BACKEND_URL env var or default
+func getBackendUrl() string {
+ if url := os.Getenv("BACKEND_URL"); url != "" {
+ return url
+ }
+ return "https://tracewayapp.com"
+}
+
type Project struct {
Id uuid.UUID `json:"id" ch:"id"`
Name string `json:"name" ch:"name"`
@@ -16,38 +25,42 @@ type Project struct {
// ProjectResponse omits the token for security in listing endpoints
type ProjectResponse struct {
- Id uuid.UUID `json:"id"`
- Name string `json:"name"`
- Framework string `json:"framework"`
- CreatedAt time.Time `json:"createdAt"`
+ Id uuid.UUID `json:"id"`
+ Name string `json:"name"`
+ Framework string `json:"framework"`
+ CreatedAt time.Time `json:"createdAt"`
+ BackendUrl string `json:"backendUrl"`
}
// ProjectWithToken includes token - used when creating or viewing connection details
type ProjectWithToken struct {
- Id uuid.UUID `json:"id"`
- Name string `json:"name"`
- Token string `json:"token"`
- Framework string `json:"framework"`
- CreatedAt time.Time `json:"createdAt"`
+ Id uuid.UUID `json:"id"`
+ Name string `json:"name"`
+ Token string `json:"token"`
+ Framework string `json:"framework"`
+ CreatedAt time.Time `json:"createdAt"`
+ BackendUrl string `json:"backendUrl"`
}
// ToResponse converts a Project to ProjectResponse (without token)
func (p *Project) ToResponse() ProjectResponse {
return ProjectResponse{
- Id: p.Id,
- Name: p.Name,
- Framework: p.Framework,
- CreatedAt: p.CreatedAt,
+ Id: p.Id,
+ Name: p.Name,
+ Framework: p.Framework,
+ CreatedAt: p.CreatedAt,
+ BackendUrl: getBackendUrl(),
}
}
// ToWithToken converts a Project to ProjectWithToken
func (p *Project) ToWithToken() ProjectWithToken {
return ProjectWithToken{
- Id: p.Id,
- Name: p.Name,
- Token: p.Token,
- Framework: p.Framework,
- CreatedAt: p.CreatedAt,
+ Id: p.Id,
+ Name: p.Name,
+ Token: p.Token,
+ Framework: p.Framework,
+ CreatedAt: p.CreatedAt,
+ BackendUrl: getBackendUrl(),
}
}
diff --git a/backend/go.mod b/backend/go.mod
index 776c9d31..b6200baf 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -2,6 +2,8 @@ module backend
go 1.25.1
+require github.com/coreos/go-systemd/v22 v22.6.0
+
require (
github.com/ClickHouse/ch-go v0.69.0 // indirect
github.com/andybalholm/brotli v1.2.0 // indirect
@@ -53,7 +55,7 @@ require (
github.com/ClickHouse/clickhouse-go/v2 v2.42.0
github.com/gin-gonic/gin v1.11.0
github.com/golang-migrate/migrate/v4 v4.19.1
- github.com/google/uuid v1.6.0 // indirect
+ github.com/google/uuid v1.6.0
github.com/joho/godotenv v1.5.1
golang.org/x/crypto v0.46.0 // indirect
golang.org/x/sync v0.19.0 // indirect
diff --git a/backend/go.sum b/backend/go.sum
index 1e3e7a21..42d3a520 100644
--- a/backend/go.sum
+++ b/backend/go.sum
@@ -24,6 +24,8 @@ github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG
github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M=
github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE=
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
+github.com/coreos/go-systemd/v22 v22.6.0 h1:aGVa/v8B7hpb0TKl0MWoAavPDmHvobFe5R5zn0bCJWo=
+github.com/coreos/go-systemd/v22 v22.6.0/go.mod h1:iG+pp635Fo7ZmV/j14KUcmEyWF+0X7Lua8rrTWzYgWU=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
diff --git a/backend/main.go b/backend/main.go
index 6b5bab04..3eb51cd1 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -6,9 +6,16 @@ import (
"backend/app/controllers"
"backend/app/middleware"
"backend/app/migrations"
+ "backend/static"
"context"
+ "io/fs"
"log"
+ "net/http"
+ "os"
+ "strings"
+ "time"
+ "github.com/coreos/go-systemd/v22/daemon"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
)
@@ -43,6 +50,11 @@ func main() {
router.Use(gin.Recovery())
+ // Health endpoint
+ router.GET("/health", func(c *gin.Context) {
+ c.String(200, "OK")
+ })
+
apiRouterGroup := router.Group("/api")
controllers.RegisterControllers(apiRouterGroup)
@@ -50,7 +62,188 @@ func main() {
ctx.JSON(200, gin.H{"version": "0.0.1"})
})
+ // Check if running in API-only mode (no static file serving)
+ apiOnly := os.Getenv("API_ONLY") != ""
+
+ if apiOnly {
+ log.Println("Running in API-only mode, static files disabled")
+ // Return 404 JSON for all unmatched routes
+ router.NoRoute(func(c *gin.Context) {
+ c.JSON(404, gin.H{"error": "Not found"})
+ })
+ } else {
+ // Set up static file serving and SPA fallback
+ staticFS, err := static.GetStaticFS()
+ if err != nil {
+ log.Printf("Warning: Could not load static files: %v", err)
+ staticFS = nil
+ }
+
+ if staticFS != nil {
+ // Serve static files
+ router.StaticFS("/assets", http.FS(mustSubFS(staticFS, "assets")))
+ router.StaticFS("/_app", http.FS(mustSubFS(staticFS, "_app")))
+
+ // Serve root static files (favicon.ico, etc.)
+ router.GET("/favicon.ico", serveStaticFile(staticFS, "favicon.ico"))
+ router.GET("/robots.txt", serveStaticFile(staticFS, "robots.txt"))
+ }
+
+ // SPA fallback handler for all unmatched routes
+ router.NoRoute(createSPAHandler(staticFS))
+ }
+
+ // Check if we should also listen on port 80
+ enablePort80 := os.Getenv("ENABLE_PORT_80") == "true"
+
+ if enablePort80 {
+ // Run port 80 server in a goroutine
+ go func() {
+ log.Println("Starting server on :80")
+ if err := router.Run(":80"); err != nil {
+ log.Printf("Error starting server on port 80: %v", err)
+ }
+ }()
+ }
+
+ // Notify systemd that we're ready and start watchdog
+ notifySystemd()
+
+ // Run main server on port 8082
+ log.Println("Starting server on :8082")
if err := router.Run(":8082"); err != nil {
panic(err)
}
}
+
+// notifySystemd sends the ready notification and starts the watchdog goroutine
+func notifySystemd() {
+ // Notify systemd that the service is ready
+ sent, err := daemon.SdNotify(false, daemon.SdNotifyReady)
+ if err != nil {
+ log.Printf("Failed to notify systemd: %v", err)
+ } else if sent {
+ log.Println("Notified systemd that service is ready")
+ }
+
+ // Start watchdog goroutine - notify every 15 seconds (half of WatchdogSec=30)
+ go func() {
+ ticker := time.NewTicker(15 * time.Second)
+ defer ticker.Stop()
+ for range ticker.C {
+ daemon.SdNotify(false, daemon.SdNotifyWatchdog)
+ }
+ }()
+}
+
+// mustSubFS returns a sub-filesystem or panics
+func mustSubFS(fsys fs.FS, dir string) fs.FS {
+ sub, err := fs.Sub(fsys, dir)
+ if err != nil {
+ // Return empty FS if subdirectory doesn't exist
+ return emptyFS{}
+ }
+ return sub
+}
+
+type emptyFS struct{}
+
+func (emptyFS) Open(name string) (fs.File, error) {
+ return nil, fs.ErrNotExist
+}
+
+// serveStaticFile returns a handler that serves a specific static file
+func serveStaticFile(staticFS fs.FS, filename string) gin.HandlerFunc {
+ return func(c *gin.Context) {
+ data, err := fs.ReadFile(staticFS, filename)
+ if err != nil {
+ c.Status(404)
+ return
+ }
+
+ // Determine content type
+ contentType := "application/octet-stream"
+ if strings.HasSuffix(filename, ".ico") {
+ contentType = "image/x-icon"
+ } else if strings.HasSuffix(filename, ".txt") {
+ contentType = "text/plain"
+ }
+
+ c.Data(200, contentType, data)
+ }
+}
+
+// createSPAHandler returns a handler for SPA fallback routing
+func createSPAHandler(staticFS fs.FS) gin.HandlerFunc {
+ return func(c *gin.Context) {
+ path := c.Request.URL.Path
+ accept := c.GetHeader("Accept")
+
+ // API routes always return 404 JSON
+ if strings.HasPrefix(path, "/api") {
+ c.JSON(404, gin.H{"error": "Not found"})
+ return
+ }
+
+ // If Accept header is application/json without text/html or */*, return 404 JSON
+ if strings.Contains(accept, "application/json") &&
+ !strings.Contains(accept, "text/html") &&
+ !strings.Contains(accept, "*/*") {
+ c.JSON(404, gin.H{"error": "Not found"})
+ return
+ }
+
+ // If no static files embedded, return 404
+ if staticFS == nil {
+ c.JSON(404, gin.H{"error": "Not found"})
+ return
+ }
+
+ // Try to serve the exact file first (for things like /favicon.ico that might not be registered)
+ cleanPath := strings.TrimPrefix(path, "/")
+ if cleanPath != "" {
+ if data, err := fs.ReadFile(staticFS, cleanPath); err == nil {
+ contentType := detectContentType(cleanPath)
+ c.Data(200, contentType, data)
+ return
+ }
+ }
+
+ // Serve index.html for SPA routing
+ indexData, err := fs.ReadFile(staticFS, "index.html")
+ if err != nil {
+ c.JSON(404, gin.H{"error": "Not found"})
+ return
+ }
+
+ c.Data(200, "text/html; charset=utf-8", indexData)
+ }
+}
+
+// detectContentType returns the content type based on file extension
+func detectContentType(filename string) string {
+ switch {
+ case strings.HasSuffix(filename, ".html"):
+ return "text/html; charset=utf-8"
+ case strings.HasSuffix(filename, ".css"):
+ return "text/css; charset=utf-8"
+ case strings.HasSuffix(filename, ".js"):
+ return "application/javascript; charset=utf-8"
+ case strings.HasSuffix(filename, ".json"):
+ return "application/json"
+ case strings.HasSuffix(filename, ".png"):
+ return "image/png"
+ case strings.HasSuffix(filename, ".jpg"), strings.HasSuffix(filename, ".jpeg"):
+ return "image/jpeg"
+ case strings.HasSuffix(filename, ".svg"):
+ return "image/svg+xml"
+ case strings.HasSuffix(filename, ".ico"):
+ return "image/x-icon"
+ case strings.HasSuffix(filename, ".woff"):
+ return "font/woff"
+ case strings.HasSuffix(filename, ".woff2"):
+ return "font/woff2"
+ default:
+ return "application/octet-stream"
+ }
+}
diff --git a/backend/static/dist/.gitkeep b/backend/static/dist/.gitkeep
new file mode 100644
index 00000000..ecbe9c7a
--- /dev/null
+++ b/backend/static/dist/.gitkeep
@@ -0,0 +1,3 @@
+# This directory holds the frontend build output.
+# During Docker build, frontend files are copied here before the Go binary is built.
+# This file ensures the directory exists for local development.
diff --git a/backend/static/static.go b/backend/static/static.go
new file mode 100644
index 00000000..8f702a2f
--- /dev/null
+++ b/backend/static/static.go
@@ -0,0 +1,14 @@
+package static
+
+import (
+ "embed"
+ "io/fs"
+)
+
+//go:embed all:dist
+var staticFiles embed.FS
+
+// GetStaticFS returns the embedded static filesystem rooted at dist/
+func GetStaticFS() (fs.FS, error) {
+ return fs.Sub(staticFiles, "dist")
+}
diff --git a/docker/supervisord.conf b/docker/supervisord.conf
index 601673e1..dbd9f787 100644
--- a/docker/supervisord.conf
+++ b/docker/supervisord.conf
@@ -43,15 +43,3 @@ stderr_logfile=/var/log/supervisor/backend-stderr.log
stdout_logfile_maxbytes=10MB
stderr_logfile_maxbytes=10MB
-; Nginx - starts last (priority 30)
-[program:nginx]
-command=/usr/sbin/nginx -g "daemon off;"
-autostart=true
-autorestart=true
-priority=30
-startsecs=2
-startretries=3
-stdout_logfile=/var/log/supervisor/nginx-stdout.log
-stderr_logfile=/var/log/supervisor/nginx-stderr.log
-stdout_logfile_maxbytes=10MB
-stderr_logfile_maxbytes=10MB
diff --git a/frontend/.env.example b/frontend/.env.example
index bf2e66a6..27f2a049 100644
--- a/frontend/.env.example
+++ b/frontend/.env.example
@@ -1,2 +1,2 @@
-# Backend API URL (used for the connection string display and vite proxy in dev)
-VITE_API_URL=http://localhost:8082
+# Example environment file for frontend development
+# Copy this to .env and customize as needed
diff --git a/frontend/src/app.d.ts b/frontend/src/app.d.ts
index 0deed93c..da08e6da 100644
--- a/frontend/src/app.d.ts
+++ b/frontend/src/app.d.ts
@@ -10,14 +10,4 @@ declare global {
}
}
-/// <reference types="vite/client" />
-
-interface ImportMetaEnv {
- readonly VITE_API_URL: string;
-}
-
-interface ImportMeta {
- readonly env: ImportMetaEnv;
-}
-
export {};
diff --git a/frontend/src/lib/state/projects.svelte.ts b/frontend/src/lib/state/projects.svelte.ts
index 65c89d5b..78879b62 100644
--- a/frontend/src/lib/state/projects.svelte.ts
+++ b/frontend/src/lib/state/projects.svelte.ts
@@ -7,6 +7,7 @@ export interface Project {
name: string;
framework: Framework;
createdAt: string;
+ backendUrl: string;
}
export interface ProjectWithToken extends Project {
diff --git a/frontend/src/routes/connection/+page.svelte b/frontend/src/routes/connection/+page.svelte
index fa58dbd0..34aed6f3 100644
--- a/frontend/src/routes/connection/+page.svelte
+++ b/frontend/src/routes/connection/+page.svelte
@@ -61,11 +61,10 @@
}
// Framework-specific code snippets
- function getFrameworkCode(framework: Framework, token: string): string {
- const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:8082';
+ function getFrameworkCode(framework: Framework, token: string, backendUrl: string): string {
const connectionString = token
- ? `${token}@${apiUrl}/api/report`
- : `YOUR_TOKEN@${apiUrl}/api/report`;
+ ? `${token}@${backendUrl}/api/report`
+ : `YOUR_TOKEN@${backendUrl}/api/report`;
switch (framework) {
case 'gin':
@@ -145,7 +144,9 @@ func main() {
}
const sdkCode = $derived(
- projectWithToken ? getFrameworkCode(projectWithToken.framework, projectWithToken.token) : ''
+ projectWithToken
+ ? getFrameworkCode(projectWithToken.framework, projectWithToken.token, projectWithToken.backendUrl)
+ : ''
);
const installCommand = $derived(