feat: implement database and storage abstractions

- Added `internal/db/store.go` to define the Store interface for database operations, including user, organization, app, channel, release, patch, and artifact management.
- Introduced `internal/models/models.go` changes to reflect updated organization and artifact response structures.
- Created `internal/storage/factory.go`, `local.go`, and `s3.go` to implement storage backends for local filesystem and S3-compatible services.
- Removed deprecated `internal/storage/storage.go` and refactored storage interface into `internal/storage/store.go`.
- Updated frontend JavaScript in `web/js/app.js` to display server health information, including storage and database backend details.
This commit is contained in:
Tony
2026-06-12 08:45:01 +08:00
parent 246260a8f5
commit 3bb4ab494e
31 changed files with 1698 additions and 509 deletions
+27 -14
View File
@@ -1,23 +1,36 @@
# Shorebird Self-Hosted Server Configuration
# Copy this file to .env and adjust values as needed
# Copy this file to .env and adjust values as needed.
# Server
# --- Server ---
SERVER_HOST=0.0.0.0
SERVER_PORT=8080
# Public-facing URL (used for download links in local storage mode)
SERVER_BASE_URL=http://localhost:8080
# PostgreSQL Database
DATABASE_URL=postgres://shorebird:shorebird@localhost:5432/shorebird?sslmode=disable
# --- Database ---
# Driver: "sqlite" (default, zero-dependency) or "postgres"
DB_DRIVER=sqlite
# SQLite path (relative to working directory; data/ is auto-created)
DB_PATH=data/shorebird.db
# PostgreSQL URL (only used when DB_DRIVER=postgres)
# DATABASE_URL=postgres://shorebird:shorebird@localhost:5432/shorebird?sslmode=disable
# Object Storage (MinIO / S3-compatible)
STORAGE_ENDPOINT=localhost:9000
STORAGE_ACCESS_KEY=minioadmin
STORAGE_SECRET_KEY=minioadmin
STORAGE_RELEASE_BUCKET=shorebird-releases
STORAGE_PATCH_BUCKET=shorebird-patches
# --- Storage ---
# Driver: "local" (default, zero-dependency) or "s3"
STORAGE_DRIVER=local
# Local storage directory (auto-created)
STORAGE_LOCAL_DIR=data/storage
# S3/MinIO settings (only used when STORAGE_DRIVER=s3)
# STORAGE_S3_ENDPOINT=localhost:9000
# STORAGE_S3_ACCESS_KEY=minioadmin
# STORAGE_S3_SECRET_KEY=minioadmin
# STORAGE_S3_USE_SSL=false
# STORAGE_S3_RELEASE_BUCKET=shorebird-releases
# STORAGE_S3_PATCH_BUCKET=shorebird-patches
# JWT Authentication
# --- Authentication ---
JWT_SECRET=change-me-in-production-use-a-long-random-string
# Redis (optional, for caching patch checks)
REDIS_ADDR=localhost:6379
REDIS_PASSWORD=
# --- Redis (optional) ---
# REDIS_ADDR=localhost:6379
# REDIS_PASSWORD=