This is the docker compose file. The only thing I have changed is adding a command so that hasura would wait until the website is up before spinning up the image.
version: "3.8"
services:
graphql-engine:
container_name: "prm_graphql_engine"
image: hasura/graphql-engine:v1.3.0
ports:
- "8080:8080"
command: >
sh -c "
until wget --spider host.docker.internal:8000; do
>&2 echo 'Django is unavailable - sleeping'
sleep 5
done;
echo 'Django is up'
"
depends_on:
- "db"
- "web"
restart: always
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@db:5432/$POSTGRES_NAME
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
When I run docker-compose up verbose, here is the error message.
prm_graphql_engine exited with code 0
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.38/containers/d3be369d69af7de6cd5dc84f0056dda49fce7f474b827e78e518144dca8e03d5/wait HTTP/1.1" 200 None
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.38/containers/d3be369d69af7de6cd5dc84f0056dda49fce7f474b827e78e518144dca8e03d5/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
'Args': ['-c',
' until wget --spider host.docker.internal:8000; do\n'
" >&2 echo 'Django is unavailable - sleeping'\n"
' sleep 5\n'
'done;\n'
" echo 'Django is up'\n"],
'Config': {'AttachStderr': False,
'AttachStdin': False,
'AttachStdout': False,
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('d3be369d69af7de6cd5dc84f0056dda49fce7f474b827e78e518144dca8e03d5')
Is there something I missed? I do need to wait for another container to run first but I don't see why the command would cause any error.