Drop the local Postgres/Zitadel/SeaweedFS stack, use shared Infrastructure
This repo ran its own separate copy of Postgres, Zitadel and SeaweedFS, none of which are actually wired into the Go backend yet (auth and file storage are still unchecked TODOs in the README). Removed that unused duplicate stack (deploy/docker-compose.dev.yml, deploy/postgres-init/) in favor of the shared Infrastructure repo also used by Musify and Ping. make dev-infra now brings up Infrastructure instead, and backend/.env.example points at its ports (Postgres on dockermanager_db, Zitadel, SeaweedFS) as placeholders for when those features are implemented.
This commit is contained in:
@@ -1,10 +1,14 @@
|
|||||||
.PHONY: dev-infra dev-infra-down backend frontend migrate-up migrate-down lint test
|
.PHONY: dev-infra dev-infra-down backend frontend migrate-up migrate-down lint test
|
||||||
|
|
||||||
|
# Postgres, Zitadel and SeaweedFS are not run by this repo. They're shared
|
||||||
|
# infrastructure in a separate Infrastructure repo; ../../Infrastructure
|
||||||
|
# below assumes it's checked out as a sibling of Admin. Adjust the path if
|
||||||
|
# yours isn't. See that repo's own README.
|
||||||
dev-infra:
|
dev-infra:
|
||||||
docker compose -f deploy/docker-compose.dev.yml up -d
|
docker compose -f ../../Infrastructure/compose.yml -f ../../Infrastructure/compose.dev.yml up -d
|
||||||
|
|
||||||
dev-infra-down:
|
dev-infra-down:
|
||||||
docker compose -f deploy/docker-compose.dev.yml down
|
docker compose -f ../../Infrastructure/compose.yml -f ../../Infrastructure/compose.dev.yml down
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
cd backend && go run ./cmd/server
|
cd backend && go run ./cmd/server
|
||||||
|
|||||||
@@ -31,16 +31,17 @@ never reach the browser.
|
|||||||
|
|
||||||
**File storage** (planned): SeaweedFS, S3 compatible.
|
**File storage** (planned): SeaweedFS, S3 compatible.
|
||||||
|
|
||||||
Everything ships as Docker Compose for local development: Postgres, Zitadel
|
Postgres, Zitadel and SeaweedFS are not run by this repo: they're shared
|
||||||
and SeaweedFS run as infrastructure while the Go API and the SvelteKit app
|
infrastructure that lives in the separate `Infrastructure` git repository,
|
||||||
run directly on the host for fast iteration.
|
used by other projects too. This repo has no infrastructure containers of
|
||||||
|
its own. The Go API and the SvelteKit app run directly on the host for fast
|
||||||
|
iteration.
|
||||||
|
|
||||||
## Project layout
|
## Project layout
|
||||||
|
|
||||||
```
|
```
|
||||||
backend/ Go API: HTTP router, config, the Docker connector, SQL migrations
|
backend/ Go API: HTTP router, config, the Docker connector, SQL migrations
|
||||||
frontend/ SvelteKit app
|
frontend/ SvelteKit app
|
||||||
deploy/ docker-compose.dev.yml and Postgres init scripts
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running it locally
|
## Running it locally
|
||||||
@@ -52,20 +53,22 @@ make backend
|
|||||||
make frontend
|
make frontend
|
||||||
```
|
```
|
||||||
|
|
||||||
That brings up Postgres, Zitadel and SeaweedFS, then starts the API on
|
`make dev-infra` brings up the shared `Infrastructure` stack (Postgres,
|
||||||
`http://localhost:8090` and the frontend on `http://localhost:5173`. The API
|
Zitadel, SeaweedFS). Then `make backend` starts the API on
|
||||||
port is 8090 instead of the usual 8080 because that one is often already
|
`http://localhost:8090` and `make frontend` starts the frontend on
|
||||||
taken by something else on the same machine.
|
`http://localhost:5173`. The API port is 8090 instead of the usual 8080
|
||||||
|
because that one is often already taken by something else on the same
|
||||||
|
machine.
|
||||||
|
|
||||||
Useful endpoints while developing: `/healthz` and `/api/containers`.
|
Useful endpoints while developing: `/healthz` and `/api/containers`.
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
- [x] Monorepo layout (`backend/`, `frontend/`, `deploy/`)
|
- [x] Monorepo layout (`backend/`, `frontend/`)
|
||||||
- [x] Go backend: `chi` router, env based config, health check
|
- [x] Go backend: `chi` router, env based config, health check
|
||||||
- [x] `HostConnector` / `LocalConnector`: container listing via the Docker SDK
|
- [x] `HostConnector` / `LocalConnector`: container listing via the Docker SDK
|
||||||
- [x] Frontend consuming `/api/containers`
|
- [x] Frontend consuming `/api/containers`
|
||||||
- [x] Dev infrastructure with Postgres, Zitadel and SeaweedFS
|
- [x] Dev infrastructure (Postgres, Zitadel, SeaweedFS) via the shared `Infrastructure` repo
|
||||||
- [x] Initial schema (`hosts`, `services`, `audit_log`)
|
- [x] Initial schema (`hosts`, `services`, `audit_log`)
|
||||||
- [ ] OIDC login against Zitadel (BFF pattern)
|
- [ ] OIDC login against Zitadel (BFF pattern)
|
||||||
- [ ] Persisting hosts and services through the backend
|
- [ ] Persisting hosts and services through the backend
|
||||||
|
|||||||
+10
-3
@@ -2,14 +2,21 @@ APP_ENV=development
|
|||||||
PORT=8090
|
PORT=8090
|
||||||
CORS_ALLOWED_ORIGINS=http://localhost:5173
|
CORS_ALLOWED_ORIGINS=http://localhost:5173
|
||||||
|
|
||||||
DATABASE_URL=postgres://dockermanager:dockermanager@localhost:5432/dockermanager?sslmode=disable
|
# Postgres, Zitadel and SeaweedFS come from the shared ../../Infrastructure
|
||||||
|
# stack (`make dev-infra`), not from a container in this repo. Credentials
|
||||||
|
# must match Infrastructure's own .env.
|
||||||
|
DATABASE_URL=postgres://postgres:postgres@host.docker.internal:5432/dockermanager_db?sslmode=disable
|
||||||
|
|
||||||
ZITADEL_ISSUER=http://localhost:8081
|
# Not wired into the backend yet (see README). These point at Infrastructure's
|
||||||
|
# Zitadel for when OIDC login is implemented.
|
||||||
|
ZITADEL_ISSUER=http://host.docker.internal:8080
|
||||||
ZITADEL_CLIENT_ID=
|
ZITADEL_CLIENT_ID=
|
||||||
ZITADEL_CLIENT_SECRET=
|
ZITADEL_CLIENT_SECRET=
|
||||||
SESSION_SECRET=change-me-in-production
|
SESSION_SECRET=change-me-in-production
|
||||||
|
|
||||||
S3_ENDPOINT=http://localhost:8333
|
# Not wired into the backend yet. Points at Infrastructure's SeaweedFS for
|
||||||
|
# when file storage is implemented.
|
||||||
|
S3_ENDPOINT=http://host.docker.internal:8333
|
||||||
S3_BUCKET=dockermanager
|
S3_BUCKET=dockermanager
|
||||||
S3_ACCESS_KEY=
|
S3_ACCESS_KEY=
|
||||||
S3_SECRET_KEY=
|
S3_SECRET_KEY=
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
name: dockermanager-dev
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:17-alpine
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
POSTGRES_USER: dockermanager
|
|
||||||
POSTGRES_PASSWORD: dockermanager
|
|
||||||
POSTGRES_DB: dockermanager
|
|
||||||
ports:
|
|
||||||
- "5432:5432"
|
|
||||||
volumes:
|
|
||||||
- dm_postgres_data:/var/lib/postgresql/data
|
|
||||||
- ./postgres-init:/docker-entrypoint-initdb.d:ro
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -U dockermanager"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 10
|
|
||||||
|
|
||||||
zitadel:
|
|
||||||
image: ghcr.io/zitadel/zitadel:latest
|
|
||||||
restart: unless-stopped
|
|
||||||
command: start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --tlsMode disabled
|
|
||||||
environment:
|
|
||||||
ZITADEL_DATABASE_POSTGRES_HOST: postgres
|
|
||||||
ZITADEL_DATABASE_POSTGRES_PORT: 5432
|
|
||||||
ZITADEL_DATABASE_POSTGRES_DATABASE: zitadel
|
|
||||||
ZITADEL_DATABASE_POSTGRES_USER_USERNAME: dockermanager
|
|
||||||
ZITADEL_DATABASE_POSTGRES_USER_PASSWORD: dockermanager
|
|
||||||
ZITADEL_DATABASE_POSTGRES_USER_SSL_MODE: disable
|
|
||||||
ZITADEL_DATABASE_POSTGRES_ADMIN_USERNAME: dockermanager
|
|
||||||
ZITADEL_DATABASE_POSTGRES_ADMIN_PASSWORD: dockermanager
|
|
||||||
ZITADEL_DATABASE_POSTGRES_ADMIN_SSL_MODE: disable
|
|
||||||
ZITADEL_EXTERNALSECURE: "false"
|
|
||||||
ZITADEL_EXTERNALPORT: "8081"
|
|
||||||
ZITADEL_EXTERNALDOMAIN: localhost
|
|
||||||
ZITADEL_FIRSTINSTANCE_ORG_HUMAN_USERNAME: admin@dockermanager.local
|
|
||||||
ZITADEL_FIRSTINSTANCE_ORG_HUMAN_PASSWORD: Passw0rd!Change
|
|
||||||
ports:
|
|
||||||
- "8081:8080"
|
|
||||||
depends_on:
|
|
||||||
postgres:
|
|
||||||
condition: service_healthy
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "/app/zitadel", "ready"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 10
|
|
||||||
|
|
||||||
seaweedfs:
|
|
||||||
image: chrislusf/seaweedfs:latest
|
|
||||||
restart: unless-stopped
|
|
||||||
command: server -s3 -s3.port=8333 -dir=/data
|
|
||||||
ports:
|
|
||||||
- "8333:8333"
|
|
||||||
- "9333:9333"
|
|
||||||
volumes:
|
|
||||||
- dm_seaweed_data:/data
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
dm_postgres_data:
|
|
||||||
dm_seaweed_data:
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
CREATE DATABASE zitadel;
|
|
||||||
Reference in New Issue
Block a user