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 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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user