feat: Initial OPHION structure

- Go backend with Fiber framework
- Agent for metrics collection
- Docker Compose for self-hosted
- Auth middleware (JWT + API Keys)
- Rate limiting
- Install script
This commit is contained in:
2026-02-05 21:35:47 -03:00
parent 268ff690df
commit 5b662cf12f
8 changed files with 449 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
FROM golang:1.22-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o ophion-server ./cmd/server
FROM alpine:3.19
RUN apk --no-cache add ca-certificates
WORKDIR /app
COPY --from=builder /app/ophion-server .
EXPOSE 8080
CMD ["./ophion-server"]

View File

@@ -0,0 +1,58 @@
version: '3.8'
services:
ophion-server:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.server
ports:
- "8080:8080"
environment:
- DATABASE_URL=postgres://ophion:ophion@postgres:5432/ophion
- CLICKHOUSE_URL=clickhouse://clickhouse:9000/ophion
- REDIS_URL=redis://redis:6379
- JWT_SECRET=${JWT_SECRET:-change-me-in-production}
depends_on:
- postgres
- clickhouse
- redis
restart: unless-stopped
ophion-web:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.web
ports:
- "3000:3000"
environment:
- API_URL=http://ophion-server:8080
depends_on:
- ophion-server
restart: unless-stopped
postgres:
image: postgres:16-alpine
environment:
- POSTGRES_USER=ophion
- POSTGRES_PASSWORD=ophion
- POSTGRES_DB=ophion
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
clickhouse:
image: clickhouse/clickhouse-server:24.1
volumes:
- clickhouse_data:/var/lib/clickhouse
restart: unless-stopped
redis:
image: redis:7-alpine
volumes:
- redis_data:/data
restart: unless-stopped
volumes:
postgres_data:
clickhouse_data:
redis_data: