Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot initialize database in docker container. #4839

Open
dmcfarland930 opened this issue Jun 13, 2019 · 4 comments
Open

Cannot initialize database in docker container. #4839

dmcfarland930 opened this issue Jun 13, 2019 · 4 comments
Assignees

Comments

@dmcfarland930
Copy link

dmcfarland930 commented Jun 13, 2019

I'm in need of a fresh database schema for CKAN 2.82, I'd also like to have the clean schema as a backup to use as a clean slate for testing. However, when I follow the instructions to clean and init the database, it seems as thought the new schema isn't created as I was expecting.

CKAN Version if known (or site URL)

2.82

Please describe the expected behaviour

The database is not re-initializing despite seeing the "Initialising DB: SUCCESS" message.

Please describe the actual behaviour

SQL Alchemy errors occur due to no relations existing in the cleaned database.

What steps can be taken to reproduce the issue?

Start Docker containers.
Enter docker container using "docker exec -ti [container name or id] bash"
Start virtual environment inside container.
In the virtual environment run "paster db clean -c [path to production.ini]"
Run "paster db init -c [path to production.ini]"
Experience server errors when exploring your ckan instance.

@wardi wardi self-assigned this Jun 18, 2019
@mbocevski
Copy link
Contributor

@dmcfarland930 if you are using docker compose, then there is no need to run paster on the container itself. There are several docker volumes created where data is persisted as part of the docker-compose.yml, those are for the database, SOLR indexes, and CKAN filestore: pg_data, solr_data and ckan_storage respectively.

Startup docker-compose and then stop all containers, run a backup on the docker volumes and then start things up again.

@wardi
Copy link
Contributor

wardi commented Jun 18, 2019

Is this specific to docker? These commands should work the same with a source install. Can you share any more errors or logs from the database?

@dmcfarland930
Copy link
Author

dmcfarland930 commented Jun 18, 2019

@mbocevski Removing the contents of the pg data volume and running docker compose has reinitialized the database.

@wardi I'm not sure if it's specific to docker. I should note I have two CKAN instances, one built from the docker install found in the docs, and another docker instance that I have uniquely made so that I can run CKAN with apache. My plan is to create a dump of the fresh database and keep it as a backup to ingest into my second postgres container when needed.

Here's a relationship error found, likely caused by having a wiped database when using the db clean command:
[ckan.config.middleware.flask_app] (psycopg2.ProgrammingError) relation "group" does not exist

@kowh-ai
Copy link
Contributor

kowh-ai commented Jul 20, 2020

Iv'e had the same problem (psycopg2.ProgrammingError relation "group" does not exist) with a source install of CKAN 2.8.4 on Ubuntu 18.04 (bionic) only...20.04 (focal) and 16.04 (xenial) were OK...Luckily I could run a "paster db init -c /path/to/production.ini" to resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants