I was facing difficulty in accessing data from the database with pgadmin4. So was thinking if we can change the container configuration and use a separate container to run postgres which can run behind nginx and will than be easy to access.
While creating a docker image i tried with that approach also … but i do remember that i was facing an issue of connecting API with database. So i left that approach !
By the way … for database connectivity issue … you can try manual installation … i never faced any problem with manual installation regarding database connectivity !
We have one example which is using multi-container approach … https://hasura.io/docs/1.0/graphql/manual/getting-started/docker-simple.html
giving below their docker compose file
version: ‘3.6’
services:
postgres:
image: postgres:12
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgrespassword
graphql-engine:
image: hasura/graphql-engine:v1.2.1
ports:
- “8080:8080”
depends_on:
- “postgres”
restart: always
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
HASURA_GRAPHQL_ENABLE_CONSOLE: “true” # set to “false” to disable console
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
## uncomment next line to set an admin secret
# HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
volumes:
db_data:
but when we start add service postgresql to docker-compose.yml file the nbs api also has a builtin posgresql running. If we stop the postgresql and restart the nbs api container it keeps on restarting.
What next?
We need to create a new docker image … we need to start everything from scratch !