Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: make DB password configurable without breaking existing deployments

Adam Eivy028aaed1a4a0
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000000..53efc87fce
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,18 @@
+# PortOS Environment Variables
+# Copy to .env and customize for your deployment.
+# Default values match docker-compose.yml for zero-config local development.
+
+# PostgreSQL (must match docker-compose.yml POSTGRES_PASSWORD)
+PGPASSWORD=portos
+
+# Optional overrides (defaults match docker-compose.yml)
+# PGHOST=localhost
+# PGPORT=5561
+# PGDATABASE=portos
+# PGUSER=portos
+
+# CDP browser automation host
+# CDP_HOST=127.0.0.1
+
+# Server host binding
+# HOST=0.0.0.0
diff --git a/docker-compose.yml b/docker-compose.yml
index 0a33c9edaa..63de9acfd5 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -16,7 +16,7 @@ services:
environment:
POSTGRES_DB: portos
POSTGRES_USER: portos
- POSTGRES_PASSWORD: portos
+ POSTGRES_PASSWORD: ${PGPASSWORD:-portos}
volumes:
- portos-pgdata:/var/lib/postgresql/data
- ./server/scripts/init-db.sql:/docker-entrypoint-initdb.d/01-init.sql
diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs
index fe5ce8dbdb..cc0bbffe9e 100644
--- a/ecosystem.config.cjs
+++ b/ecosystem.config.cjs
@@ -38,6 +38,7 @@ module.exports = {
PORT: PORTS.API,
HOST: '0.0.0.0',
PGPORT: PORTS.POSTGRES,
+ PGPASSWORD: process.env.PGPASSWORD || 'portos',
PATH: process.env.PATH // Inherit PATH for git/node access in child processes
},
watch: ['server'],
diff --git a/server/lib/db.js b/server/lib/db.js
index cc95302209..ba0056324d 100644
--- a/server/lib/db.js
+++ b/server/lib/db.js
@@ -10,16 +10,16 @@ import pg from 'pg';
const { Pool } = pg;
if (!process.env.PGPASSWORD) {
- console.warn('⚠️ PGPASSWORD not set — database queries will fail until it is configured');
+ console.warn('⚠️ PGPASSWORD not set — using default. Set PGPASSWORD env var for production.');
}
-// Connection config from environment or defaults
+// Connection config from environment or defaults matching docker-compose.yml
const pool = new Pool({
host: process.env.PGHOST || 'localhost',
port: parseInt(process.env.PGPORT || '5561', 10),
database: process.env.PGDATABASE || 'portos',
user: process.env.PGUSER || 'portos',
- password: process.env.PGPASSWORD,
+ password: process.env.PGPASSWORD || 'portos',
max: 10,
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 2000
diff --git a/server/services/backup.js b/server/services/backup.js
index 7cdf81fb54..1be27a1993 100644
--- a/server/services/backup.js
+++ b/server/services/backup.js
@@ -160,8 +160,7 @@ export async function dumpPostgres(outputPath) {
const pgUser = process.env.PGUSER || 'portos';
if (!process.env.PGPASSWORD) {
- console.error('❌ PGPASSWORD not set — skipping pg_dump');
- return { success: false, error: 'PGPASSWORD environment variable must be set' };
+ console.warn('⚠️ PGPASSWORD not set for pg_dump — using default');
}
return new Promise((resolve) => {
@@ -175,7 +174,7 @@ export async function dumpPostgres(outputPath) {
'-f', outputPath
], {
shell: false,
- env: { ...process.env, PGPASSWORD: process.env.PGPASSWORD }
+ env: { ...process.env, PGPASSWORD: process.env.PGPASSWORD || 'portos' }
});
let stderr = '';