Issues with bringing the app up with dockerSee 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
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.
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
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.
Yes the new
sql_init.sh fixes the issue.
- 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.