question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with bringing the app up with docker

See original GitHub issue

I just wanted to quickly test out the dockerized version of the app and I came across two issues. I solved the first but did not want to invest more time on the other.

First one was an error with postgres:

$ docker logs contextualise_db_1
Error: Database is uninitialized and superuser password is not specified.
       You must specify POSTGRES_PASSWORD to a non-empty value for the
       superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".

       You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
       connections without a password. This is *not* recommended.

       See PostgreSQL documentation about "trust":
       https://www.postgresql.org/docs/current/auth-trust.html

That fix was easy, I just added an environment section to the db services in docker-compose.yml:

  db:
    image: postgres:alpine
    volumes:
      - "./sql_init.sh:/docker-entrypoint-initdb.d/init_user_db.sh:ro"
      - "pg_data:/var/lib/postgresql/data"
    environment:
      - POSTGRES_PASSWORD=postgres

But then upon login in I got another:

[2020-05-11 09:34:24,629] ERROR in app: Exception on /maps/ [GET]
Traceback (most recent call last):
  File "/root/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/root/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/root/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/root/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/root/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/root/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/root/.local/lib/python3.8/site-packages/flask_login/utils.py", line 272, in decorated_view
    return func(*args, **kwargs)
  File "/usr/src/app/contextualise/map.py", line 24, in index
    maps = topic_store.get_topic_maps(current_user.id)
  File "/root/.local/lib/python3.8/site-packages/topicdb/core/store/topicstore.py", line 1579, in get_topic_maps
    cursor.execute(sql, (user_identifier,))
  File "/root/.local/lib/python3.8/site-packages/psycopg2/extras.py", line 143, in execute
    return super(DictCursor, self).execute(query, vars)
psycopg2.errors.UndefinedTable: relation "topicdb.user_topicmap" does not exist
LINE 13:             JOIN topicdb.user_topicmap ON topicdb.topicmap.i...
                          ^

As this seems to be more application specific I did not delve any further.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stratosgearcommented, May 11, 2020

Nothing wrong with the steps I took to fix the errors, there is nothing to improve here. I just listed the steps as a convenience to anyone else that came across the same issue.

1reaction
stratosgearcommented, May 11, 2020

Yes the new sql_init.sh fixes the issue.

Had to:

  • rebuild the docker image and
  • delete the previous docker volume (docker volume rm contextualize_pg_data)

before the changes would take effect, but they did right after I did the above.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview | Docker Documentation
This page contains information on: How to diagnose and troubleshoot Docker Desktop issues; Check the logs; Find workarounds for common problems ...
Read more >
How to Debug and Fix Common Docker Issues - DigitalOcean
In this troubleshooting guide aimed at people new to Docker, you'll troubleshoot problems when building Docker images, resolve naming collisions ...
Read more >
Error when trying to run docker-compose up. "oci runtime error ...
When trying to launch a built container with docker-compose up I'm getting an error: ERROR: for app Cannot start service app: invalid header ......
Read more >
Docker Containers - Rocket.Chat Docs
yml file, it will fail to bring up the Rocket.Chat app. Improperly formatted .yml will cause problems.
Read more >
Fixing permissions issues with Docker Compose and PHP
After spinning up the container network with docker-compose up -d ... and the big difference lied in how I was bringing the app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found