I recently tried to use docker-compose to test with the ZWS API and eventually host it on my own website.
However, the API Container keeps restarting in an attempt of finding PostgreSQL:
[debug] [config] characters { characters: [ 'a', 'b', 'c' ], length: 12, rewrites: { d: 'a', e: 'b', f: 'c' } }
[debug] [config] env Prod
[info] [config] Using API key to restrict access to routes
[info] [http] Listening at http://0.0.0.0:3000
[info] [db] Starting a postgresql pool with 13 connections.
[info] [db] Encountered error during initialization:
[warn] [db] Prisma.LogEvent.target was undefined
[error] [db]
Can't reach database server at `localhost`:`5432`
Please make sure your database server is running at `localhost`:`5432`.
[fatal] [db] Failed to connect to database Can't reach database server at `localhost`:`5432`
Please make sure your database server is running at `localhost`:`5432`.
Please make sure your database server is running at `localhost`:`5432`.
at LineStream.<anonymous> (node_modules/@prisma/client/runtime/index.js:29704:31)
at LineStream.emit (node:events:394:28)
at LineStream.emit (node:domain:475:12)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at LineStream.Readable.push (node:internal/streams/readable:228:10)
at LineStream._pushBuffer (node_modules/@prisma/client/runtime/index.js:26457:19)
at LineStream._transform (node_modules/@prisma/client/runtime/index.js:26451:10)
at LineStream.Transform._write (node:internal/streams/transform:184:23)
at writeOrBuffer (node:internal/streams/writable:389:12)
I already checked the firewall for localhost loopbacks to be accepted, as well of attempting it among different systems. I would either require to point the API towards an openly exposed PostgreSQL Database in the internet or making use of the docker-machine ip which not survives a restart of the server or container. Both not really feels intended.
At the other side i don't have enough experience with Docker to say if that is a "bug" or if i just oversee some Basic Docker 101 here that prevents the containers from communicating to each other despite sharing the same network inside docker.