feat: add production landing page service and remove Caddy in favor of external reverse proxy configuration
This commit is contained in:
13
README.md
13
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 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
|
## Server deployment
|
||||||
|
|
||||||
@@ -87,18 +87,23 @@ What is not built locally, but pulled as ready-made images:
|
|||||||
|
|
||||||
- `postgres` uses `postgres:16-alpine`
|
- `postgres` uses `postgres:16-alpine`
|
||||||
- `minio` uses `minio/minio:latest`
|
- `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.
|
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:
|
This starts:
|
||||||
|
|
||||||
- `caddy`
|
|
||||||
- `landing`
|
- `landing`
|
||||||
- `api`
|
- `api`
|
||||||
- `postgres`
|
- `postgres`
|
||||||
- `minio`
|
- `minio`
|
||||||
|
|
||||||
|
Host ports for an external reverse proxy:
|
||||||
|
|
||||||
|
- `3000` -> `landing`
|
||||||
|
- `3001` -> `api`
|
||||||
|
- `9000` -> `minio` S3 API
|
||||||
|
- `9001` -> `minio` console
|
||||||
|
|
||||||
### 3. Useful server commands
|
### 3. Useful server commands
|
||||||
|
|
||||||
Check running containers:
|
Check running containers:
|
||||||
@@ -173,7 +178,7 @@ There, too:
|
|||||||
|
|
||||||
- `landing` is built from `greenlns-landing/Dockerfile`
|
- `landing` is built from `greenlns-landing/Dockerfile`
|
||||||
- `api` is built from `../server/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
|
## iOS TestFlight
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,11 @@
|
|||||||
services:
|
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:
|
landing:
|
||||||
build:
|
build:
|
||||||
context: ./greenlns-landing
|
context: ./greenlns-landing
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
PORT: 3000
|
PORT: 3000
|
||||||
@@ -37,6 +21,8 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: server/Dockerfile
|
dockerfile: server/Dockerfile
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3001:3000"
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
PORT: 3000
|
PORT: 3000
|
||||||
@@ -89,10 +75,13 @@ services:
|
|||||||
minio:
|
minio:
|
||||||
image: minio/minio:latest
|
image: minio/minio:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "9000:9000"
|
||||||
|
- "9001:9001"
|
||||||
environment:
|
environment:
|
||||||
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-greenlns-minio}
|
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-greenlns-minio}
|
||||||
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:?MINIO_SECRET_KEY is required}
|
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:?MINIO_SECRET_KEY is required}
|
||||||
command: server /data
|
command: server /data --console-address ":9001"
|
||||||
volumes:
|
volumes:
|
||||||
- minio_data:/data
|
- minio_data:/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -102,7 +91,5 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
caddy_config:
|
|
||||||
caddy_data:
|
|
||||||
minio_data:
|
minio_data:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
# GreenLens Landing
|
# 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
|
- `landing` for the Next.js standalone app
|
||||||
- `api` for the Express backend from `../server`
|
- `api` for the Express backend from `../server`
|
||||||
- `postgres` for persistent app data
|
- `postgres` for persistent app data
|
||||||
@@ -23,6 +22,13 @@ From `greenlns-landing/docker-compose.yml`:
|
|||||||
docker compose up --build -d
|
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:
|
Required environment variables:
|
||||||
|
|
||||||
- `SITE_DOMAIN`
|
- `SITE_DOMAIN`
|
||||||
|
|||||||
@@ -1,27 +1,11 @@
|
|||||||
services:
|
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:
|
landing:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
PORT: 3000
|
PORT: 3000
|
||||||
@@ -37,6 +21,8 @@ services:
|
|||||||
context: ../server
|
context: ../server
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3001:3000"
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
PORT: 3000
|
PORT: 3000
|
||||||
@@ -89,10 +75,13 @@ services:
|
|||||||
minio:
|
minio:
|
||||||
image: minio/minio:latest
|
image: minio/minio:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "9000:9000"
|
||||||
|
- "9001:9001"
|
||||||
environment:
|
environment:
|
||||||
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-greenlns-minio}
|
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-greenlns-minio}
|
||||||
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:?MINIO_SECRET_KEY is required}
|
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:?MINIO_SECRET_KEY is required}
|
||||||
command: server /data
|
command: server /data --console-address ":9001"
|
||||||
volumes:
|
volumes:
|
||||||
- minio_data:/data
|
- minio_data:/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -102,7 +91,5 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
caddy_config:
|
|
||||||
caddy_data:
|
|
||||||
postgres_data:
|
postgres_data:
|
||||||
minio_data:
|
minio_data:
|
||||||
|
|||||||
Reference in New Issue
Block a user