Skip to content

Commit

Permalink
Fix pg connection ssl errors (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
dqunbp authored Jul 25, 2023
1 parent bafc911 commit 801994b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
13 changes: 11 additions & 2 deletions catalog-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,19 @@ async function pgCreateConnection() {
}

const connection = new PgClient({
connectionString: `postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:${PGPORT}/${PGDATABASE}`,
user: PGUSER,
password: PGPASSWORD,
database: PGDATABASE,
port: 5432,
host: PGHOST,
ssl: true,
});

await connection.connect();
try {
await connection.connect();
} catch (error) {
console.error(error);
}

pgConnection = connection;
return pgConnection;
Expand Down
48 changes: 48 additions & 0 deletions docker-compose.staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: "2"

services:
app:
environment:
- NODE_ENV=production
- DB_URI=mongodb://mongo/oam-api
env_file: .env
build:
context: .
args:
- NODE_ENV=production
command: "false"

api:
restart: always
extends: app
environment:
- PORT=4000
- NODE_OPTIONS=--max_old_space_size=2048
command: node index.js
ports:
- 4000:4000

worker:
restart: always
extends: app
environment:
- DOT_ENV_FILENAME=.env
- NODE_TLS_REJECT_UNAUTHORIZED=0
command: node catalog-worker.js

mongo:
image: mongo:3
volumes:
- mongodb:/data/db

mongo-express:
image: mongo-express:1.0.0-alpha.4
ports:
- 8081:8081
links:
- mongo
environment:
ME_CONFIG_MONGODB_URL: mongodb://mongo:27017/

volumes:
mongodb: ~

0 comments on commit 801994b

Please sign in to comment.