From c2aa716ed8d3e7241bc350dfec4386fdf1e5082f Mon Sep 17 00:00:00 2001 From: Andriy Oblivantsev Date: Sun, 1 Mar 2026 12:12:44 +0000 Subject: [PATCH] Switch local API port to 8122 and keep DB internal. Update runtime defaults, compose mappings, frontend defaults, and developer docs to use port 8122 while keeping PostGIS reachable only via the internal compose network. Made-with: Cursor --- Dockerfile | 8 ++++---- README.md | 8 ++++---- cmd/api/main.go | 2 +- docker-compose.yml | 10 ++++------ docs/typescript-frontend-integration.md | 2 +- web/app.js | 2 +- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index a35bd05..f87212c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,8 +23,8 @@ RUN --mount=type=cache,target=/go/pkg/mod \ go build -p "$(nproc)" -trimpath -ldflags="-s -w" -o /out/api ./cmd/api FROM base AS dev -ENV ADDR=:8080 -EXPOSE 8080 +ENV ADDR=:8122 +EXPOSE 8122 CMD ["go", "run", "./cmd/api"] FROM gcr.io/distroless/static-debian12:nonroot AS runtime @@ -32,7 +32,7 @@ FROM gcr.io/distroless/static-debian12:nonroot AS runtime WORKDIR /app COPY --from=builder /out/api /app/api -ENV ADDR=:8080 -EXPOSE 8080 +ENV ADDR=:8122 +EXPOSE 8122 ENTRYPOINT ["/app/api"] diff --git a/README.md b/README.md index fe0fb3d..48cb4a9 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ go run ./cmd/api Primary deployed base URL: `https://momswap.produktor.duckdns.org/`. -Local default (for development): `http://localhost:8080`. +Local default (for development): `http://localhost:8122`. Optional environment variables: -- `ADDR` (default `:8080`) +- `ADDR` (default `:8122`) - `ADMIN_PUBLIC_KEY` (bootstrap initial inviter/admin user) ## Docker Compose @@ -40,7 +40,7 @@ COMPOSE_BAKE=true docker compose up --build -d This starts: - `db` (`postgis/postgis`) on `5432` -- `api` on `8080`, wired with `DATABASE_URL` to the `db` service +- `api` on `8122`, wired with `DATABASE_URL` to the `db` service Stop the service: @@ -74,7 +74,7 @@ go run ./cmd/api Then visit: - Production: `https://momswap.produktor.duckdns.org/web/` -- Local: `http://localhost:8080/web/` +- Local: `http://localhost:8122/web/` ## API client library diff --git a/cmd/api/main.go b/cmd/api/main.go index d345073..88af1b2 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -12,7 +12,7 @@ import ( ) func main() { - addr := getEnv("ADDR", ":8080") + addr := getEnv("ADDR", ":8122") adminPublicKey := os.Getenv("ADMIN_PUBLIC_KEY") memory := store.NewMemoryStore() diff --git a/docker-compose.yml b/docker-compose.yml index cd98195..2b65ce8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,8 +6,6 @@ services: POSTGRES_DB: "${POSTGRES_DB:-momswap}" POSTGRES_USER: "${POSTGRES_USER:-momswap}" POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-momswap}" - ports: - - "5432:5432" volumes: - ./var/posrgres:/var/lib/postgresql/data healthcheck: @@ -30,14 +28,14 @@ services: image: momswap-backend:latest container_name: momswap-backend-api environment: - ADDR: ":8080" + ADDR: ":8122" ADMIN_PUBLIC_KEY: "${ADMIN_PUBLIC_KEY:-}" DATABASE_URL: "postgres://${POSTGRES_USER:-momswap}:${POSTGRES_PASSWORD:-momswap}@db:5432/${POSTGRES_DB:-momswap}?sslmode=disable" depends_on: db: condition: service_healthy ports: - - "8080:8080" + - "8122:8122" restart: unless-stopped api-dev: @@ -53,14 +51,14 @@ services: image: momswap-backend:dev container_name: momswap-backend-api-dev environment: - ADDR: ":8080" + ADDR: ":8122" ADMIN_PUBLIC_KEY: "${ADMIN_PUBLIC_KEY:-}" DATABASE_URL: "postgres://${POSTGRES_USER:-momswap}:${POSTGRES_PASSWORD:-momswap}@db:5432/${POSTGRES_DB:-momswap}?sslmode=disable" depends_on: db: condition: service_healthy ports: - - "8080:8080" + - "8122:8122" restart: unless-stopped develop: watch: diff --git a/docs/typescript-frontend-integration.md b/docs/typescript-frontend-integration.md index 8fe704a..82b1f39 100644 --- a/docs/typescript-frontend-integration.md +++ b/docs/typescript-frontend-integration.md @@ -102,4 +102,4 @@ For no-bundler apps, import the built ESM file: The backend itself serves static UI at `/web/`, but this library can be consumed by any frontend runtime that supports `fetch`, `TextEncoder`, and ES modules. -For local development you can switch the client base URL to `http://localhost:8080`. +For local development you can switch the client base URL to `http://localhost:8122`. diff --git a/web/app.js b/web/app.js index 0c9008a..03062a5 100644 --- a/web/app.js +++ b/web/app.js @@ -4,7 +4,7 @@ const { createApp, ref, reactive, onMounted } = Vue; createApp({ setup() { - const apiBase = ref(localStorage.getItem("geo_api_base") || "http://localhost:8080"); + const apiBase = ref(localStorage.getItem("geo_api_base") || "http://localhost:8122"); const state = reactive({ publicKey: "", privateKey: "",