Initial dashboard service scaffold
Infrastructure files for standalone dashboard service. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Use Unix timestamp for cache busting
|
||||
TS=$(date +%s)
|
||||
|
||||
# Update CSS and JS cache-busting versions
|
||||
sed -i '' "s/dashboard\\.css?v=[0-9]*/dashboard.css?v=${TS}/" templates.go
|
||||
sed -i '' "s/dashboard\\.js?v=[0-9]*/dashboard.js?v=${TS}/" templates.go
|
||||
|
||||
echo "Cache bust: ${TS}"
|
||||
|
||||
~/apps/.launch.sh "$@"
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
FROM golang:latest AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Copy shared module first
|
||||
COPY shared/ ./shared/
|
||||
|
||||
# Copy dashboard module
|
||||
COPY dashboard/ ./dashboard/
|
||||
|
||||
# Build the binary
|
||||
WORKDIR /build/dashboard
|
||||
RUN go mod download
|
||||
RUN CGO_ENABLED=0 go build -o dashboard .
|
||||
|
||||
# Runtime stage
|
||||
FROM ubuntu:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apt-get update && apt-get install -y ca-certificates tzdata curl wget && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /build/dashboard/dashboard .
|
||||
|
||||
# Copy static files
|
||||
COPY --from=builder /build/dashboard/static ./static
|
||||
|
||||
EXPOSE 4321
|
||||
|
||||
CMD ["./dashboard"]
|
||||
@@ -0,0 +1,56 @@
|
||||
services:
|
||||
dashboard:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: dashboard/Dockerfile
|
||||
image: atproto-1440news-dashboard
|
||||
container_name: atproto-1440news-dashboard
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 30s
|
||||
env_file:
|
||||
- oauth.env
|
||||
environment:
|
||||
DB_HOST: infra-postgres
|
||||
DB_PORT: 5432
|
||||
DB_USER: dba_1440_news
|
||||
DB_PASSWORD_FILE: /run/secrets/db_password
|
||||
DB_NAME: db_1440_news
|
||||
OAUTH_BASE_URL: https://app.1440.news
|
||||
secrets:
|
||||
- db_password
|
||||
networks:
|
||||
- proxy
|
||||
- atproto
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# Production: HTTPS with Let's Encrypt for app.1440.news
|
||||
- "traefik.http.routers.dashboard-1440.rule=Host(`app.1440.news`)"
|
||||
- "traefik.http.routers.dashboard-1440.entrypoints=https"
|
||||
- "traefik.http.routers.dashboard-1440.tls.certresolver=letsencrypt-dns"
|
||||
# Production: HTTPS for 1440.news root (accounts directory) - lower priority than PDS API paths
|
||||
- "traefik.http.routers.root-1440.rule=Host(`1440.news`)"
|
||||
- "traefik.http.routers.root-1440.entrypoints=https"
|
||||
- "traefik.http.routers.root-1440.tls.certresolver=letsencrypt-dns"
|
||||
- "traefik.http.routers.root-1440.priority=10"
|
||||
# Production: HTTP to HTTPS redirect
|
||||
- "traefik.http.routers.dashboard-1440-redirect.rule=Host(`app.1440.news`) || Host(`1440.news`)"
|
||||
- "traefik.http.routers.dashboard-1440-redirect.entrypoints=http"
|
||||
- "traefik.http.routers.dashboard-1440-redirect.middlewares=https-redirect"
|
||||
- "traefik.http.routers.dashboard-1440-redirect.priority=10"
|
||||
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
|
||||
- "traefik.http.middlewares.https-redirect.redirectscheme.permanent=true"
|
||||
# Local development
|
||||
- "traefik.http.routers.dashboard-1440-local.rule=Host(`app.1440.localhost`)"
|
||||
- "traefik.http.routers.dashboard-1440-local.entrypoints=http"
|
||||
# Shared service
|
||||
- "traefik.http.services.dashboard-1440.loadbalancer.server.port=4321"
|
||||
|
||||
secrets:
|
||||
db_password:
|
||||
file: ../../../infra/postgres/secrets/dba_1440_news_password.txt
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
atproto:
|
||||
external: true
|
||||
@@ -0,0 +1,12 @@
|
||||
module github.com/1440news/dashboard
|
||||
|
||||
go 1.24.0
|
||||
|
||||
require (
|
||||
github.com/1440news/shared v0.0.0
|
||||
github.com/haileyok/atproto-oauth-golang v0.0.0-20250101000000-000000000000
|
||||
github.com/jackc/pgx/v5 v5.7.5
|
||||
github.com/lestrrat-go/jwx/v2 v2.1.6
|
||||
)
|
||||
|
||||
replace github.com/1440news/shared => ../shared
|
||||
Reference in New Issue
Block a user