From 0eca9a101f62b7dc830b615ea48dfb81fe47e254 Mon Sep 17 00:00:00 2001 From: Timo Knuth Date: Fri, 3 Apr 2026 19:54:32 +0200 Subject: [PATCH] feat: add production landing page service and remove Caddy in favor of external reverse proxy configuration --- README.md | 13 +++++++++---- docker-compose.yml | 29 ++++++++--------------------- greenlns-landing/Dockerfile | 2 +- greenlns-landing/README.md | 10 ++++++++-- greenlns-landing/docker-compose.yml | 29 ++++++++--------------------- greenlns-landing/nginx/default.conf | 2 +- 6 files changed, 35 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 3a542b5..e6f6ba0 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Optional integrations: For backend-only local infrastructure use [docker-compose.yml](/abs/path/C:/Users/a931627/Documents/apps/GreenLns/docker-compose.yml). -For the production-style self-hosted stack with landing page, Caddy, API, PostgreSQL, and MinIO use [greenlns-landing/docker-compose.yml](/abs/path/C:/Users/a931627/Documents/apps/GreenLns/greenlns-landing/docker-compose.yml). +For the production-style self-hosted stack with landing page, API, PostgreSQL, and MinIO behind an external reverse proxy use [greenlns-landing/docker-compose.yml](/abs/path/C:/Users/a931627/Documents/apps/GreenLns/greenlns-landing/docker-compose.yml). ## Server deployment @@ -87,18 +87,23 @@ What is not built locally, but pulled as ready-made images: - `postgres` uses `postgres:16-alpine` - `minio` uses `minio/minio:latest` -- `caddy` uses `caddy:2.8-alpine` So yes: `docker compose up --build -d` builds the landing page container and the API container, and it starts PostgreSQL as a container. PostgreSQL is not "built" from your code, it is started from the official Postgres image. This starts: -- `caddy` - `landing` - `api` - `postgres` - `minio` +Host ports for an external reverse proxy: + +- `3000` -> `landing` +- `3001` -> `api` +- `9000` -> `minio` S3 API +- `9001` -> `minio` console + ### 3. Useful server commands Check running containers: @@ -173,7 +178,7 @@ There, too: - `landing` is built from `greenlns-landing/Dockerfile` - `api` is built from `../server/Dockerfile` -- `postgres`, `minio`, and `caddy` are started from official images +- `postgres` and `minio` are started from official images ## iOS TestFlight diff --git a/docker-compose.yml b/docker-compose.yml index a5c733b..90fa64b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,27 +1,11 @@ services: - caddy: - image: caddy:2.8-alpine - restart: unless-stopped - ports: - - "80:80" - - "443:443" - environment: - SITE_DOMAIN: ${SITE_DOMAIN:-greenlenspro.com} - volumes: - - ./greenlns-landing/Caddyfile:/etc/caddy/Caddyfile:ro - - caddy_data:/data - - caddy_config:/config - depends_on: - landing: - condition: service_started - api: - condition: service_healthy - landing: build: context: ./greenlns-landing dockerfile: Dockerfile restart: unless-stopped + ports: + - "3000:3000" environment: NODE_ENV: production PORT: 3000 @@ -37,6 +21,8 @@ services: context: . dockerfile: server/Dockerfile restart: unless-stopped + ports: + - "3001:3000" environment: NODE_ENV: production PORT: 3000 @@ -89,10 +75,13 @@ services: minio: image: minio/minio:latest restart: unless-stopped + ports: + - "9000:9000" + - "9001:9001" environment: MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-greenlns-minio} MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:?MINIO_SECRET_KEY is required} - command: server /data + command: server /data --console-address ":9001" volumes: - minio_data:/data healthcheck: @@ -102,7 +91,5 @@ services: retries: 5 volumes: - caddy_config: - caddy_data: minio_data: postgres_data: diff --git a/greenlns-landing/Dockerfile b/greenlns-landing/Dockerfile index e7f4886..570fc7f 100644 --- a/greenlns-landing/Dockerfile +++ b/greenlns-landing/Dockerfile @@ -28,6 +28,6 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static USER nextjs -EXPOSE 3000 +EXPOSE 3000 CMD ["node", "server.js"] diff --git a/greenlns-landing/README.md b/greenlns-landing/README.md index 38ccded..89db917 100644 --- a/greenlns-landing/README.md +++ b/greenlns-landing/README.md @@ -1,8 +1,7 @@ # GreenLens Landing -Self-hosted Next.js landing page for GreenLens. The production stack in this directory runs: +Self-hosted Next.js landing page for GreenLens. The production stack in this directory runs behind an external reverse proxy and includes: -- `caddy` for TLS and reverse proxy - `landing` for the Next.js standalone app - `api` for the Express backend from `../server` - `postgres` for persistent app data @@ -23,6 +22,13 @@ From `greenlns-landing/docker-compose.yml`: docker compose up --build -d ``` +Published ports for the external reverse proxy: + +- `3000` for `landing` +- `3001` for `api` +- `9000` for MinIO object storage +- `9001` for the MinIO console + Required environment variables: - `SITE_DOMAIN` diff --git a/greenlns-landing/docker-compose.yml b/greenlns-landing/docker-compose.yml index 336b748..a61f870 100644 --- a/greenlns-landing/docker-compose.yml +++ b/greenlns-landing/docker-compose.yml @@ -1,27 +1,11 @@ services: - caddy: - image: caddy:2.8-alpine - restart: unless-stopped - ports: - - "80:80" - - "443:443" - environment: - SITE_DOMAIN: ${SITE_DOMAIN:-greenlenspro.com} - volumes: - - ./Caddyfile:/etc/caddy/Caddyfile:ro - - caddy_data:/data - - caddy_config:/config - depends_on: - landing: - condition: service_started - api: - condition: service_healthy - landing: build: context: . dockerfile: Dockerfile restart: unless-stopped + ports: + - "3000:3000" environment: NODE_ENV: production PORT: 3000 @@ -37,6 +21,8 @@ services: context: ../server dockerfile: Dockerfile restart: unless-stopped + ports: + - "3001:3000" environment: NODE_ENV: production PORT: 3000 @@ -89,10 +75,13 @@ services: minio: image: minio/minio:latest restart: unless-stopped + ports: + - "9000:9000" + - "9001:9001" environment: MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-greenlns-minio} MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:?MINIO_SECRET_KEY is required} - command: server /data + command: server /data --console-address ":9001" volumes: - minio_data:/data healthcheck: @@ -102,7 +91,5 @@ services: retries: 5 volumes: - caddy_config: - caddy_data: postgres_data: minio_data: diff --git a/greenlns-landing/nginx/default.conf b/greenlns-landing/nginx/default.conf index 68ce6e6..2c5fe85 100644 --- a/greenlns-landing/nginx/default.conf +++ b/greenlns-landing/nginx/default.conf @@ -17,7 +17,7 @@ server { ssl_ciphers HIGH:!aNULL:!MD5; location / { - proxy_pass http://app:3000; + proxy_pass http://app:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade';