Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Fix PostgreSQL port exposure in docker-compose (#2530)

Abimael Martell8e5acd85d610
diff --git a/SELF_HOST.md b/SELF_HOST.md
index 6f599f253..9c132c5a3 100644
--- a/SELF_HOST.md
+++ b/SELF_HOST.md
@@ -99,9 +99,9 @@ BULL_AUTH_KEY=CHANGEME
## === PostgreSQL Database Configuration ===
# Configure PostgreSQL credentials. These should match the credentials used by the nuq-postgres container.
# If you change these, ensure all three are set consistently.
-# POSTGRES_USER=postgres
-# POSTGRES_PASSWORD=postgres
-# POSTGRES_DB=postgres
+# POSTGRES_USER=firecrawl
+# POSTGRES_PASSWORD=firecrawl_password
+# POSTGRES_DB=firecrawl
# Set if you have a llamaparse key you'd like to use to parse pdfs
# LLAMAPARSE_API_KEY=
@@ -122,8 +122,14 @@ BULL_AUTH_KEY=CHANGEME
# ALLOW_LOCAL_WEBHOOKS=true
```
+### Security considerations
+
+- **Use strong PostgreSQL credentials.** The defaults in the `.env` template are for local development only. When deploying to a server, set `POSTGRES_USER`, `POSTGRES_PASSWORD`, and `POSTGRES_DB` to secure values and ensure they match the database service configuration.
+- **Keep the database port internal.** The provided `docker-compose.yaml` does not expose PostgreSQL to the host or the internet. Avoid adding a `ports` mapping for `nuq-postgres` unless you are restricting access with a firewall. To access the database for maintenance, prefer using `docker compose exec nuq-postgres psql` or a temporary, firewalled tunnel.
+- **Protect the admin UI.** Set `BULL_AUTH_KEY` to a strong secret, especially on any deployment reachable from untrusted networks.
+
3. Build and run the Docker containers:
-
+
```bash
docker compose build
docker compose up
diff --git a/docker-compose.yaml b/docker-compose.yaml
index ffea02ec1..146c9dada 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -25,12 +25,12 @@ x-common-env: &common-env
REDIS_URL: ${REDIS_URL:-redis://redis:6379}
REDIS_RATE_LIMIT_URL: ${REDIS_URL:-redis://redis:6379}
PLAYWRIGHT_MICROSERVICE_URL: ${PLAYWRIGHT_MICROSERVICE_URL:-http://playwright-service:3000/scrape}
- POSTGRES_USER: ${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-postgres}"
- POSTGRES_DB: ${POSTGRES_DB:-postgres}
+ POSTGRES_USER: ${POSTGRES_USER:-firecrawl}
+ POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-firecrawl_password}"
+ POSTGRES_DB: ${POSTGRES_DB:-firecrawl}
POSTGRES_HOST: ${POSTGRES_HOST:-nuq-postgres}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
- USE_DB_AUTHENTICATION: ${USE_DB_AUTHENTICATION}
+ USE_DB_AUTHENTICATION: ${USE_DB_AUTHENTICATION:-false}
NUM_WORKERS_PER_QUEUE: ${NUM_WORKERS_PER_QUEUE:-8}
CRAWL_CONCURRENT_REQUESTS: ${CRAWL_CONCURRENT_REQUESTS:-10}
MAX_CONCURRENT_JOBS: ${MAX_CONCURRENT_JOBS:-5}
@@ -125,13 +125,11 @@ services:
nuq-postgres:
build: apps/nuq-postgres
environment:
- POSTGRES_USER: ${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
- POSTGRES_DB: ${POSTGRES_DB:-postgres}
+ POSTGRES_USER: ${POSTGRES_USER:-firecrawl}
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-firecrawl_password}
+ POSTGRES_DB: ${POSTGRES_DB:-firecrawl}
networks:
- backend
- ports:
- - "5432:5432"
logging:
driver: "json-file"
options: