generate fake-data fails
On a clean setup of 2.11 from pre-built docker images, the fake data generator doesn't work:
docker compose exec ckan ckan -c /srv/app/ckan.ini generate fake-data organization
2024-12-05 10:09:59,835 INFO [ckan.cli] Using configuration file /srv/app/ckan.ini
2024-12-05 10:09:59,835 INFO [ckan.config.environment] Loading static files from public
2024-12-05 10:10:00,344 WARNI [ckan.common] Option lang is not declared
2024-12-05 10:10:00,431 INFO [ckan.config.environment] Loading templates from /srv/app/src/ckan/ckan/templates
2024-12-05 10:10:00,675 WARNI [ckan.config.middleware.flask_app] Extensions are excluded from CSRF protection! We allow extensions to run without CSRF protection but it will be forced future releases. Read the documentation for more information on how to add CSRF protection to your extension.
No module named 'factory'
Make sure you have dev-dependencies installed:
pip install -r dev-requirements.txt
Aborted!
I wouldn't expect to have to build my own images for this, no?
Ref: https://github.com/ckan/ckan/issues/8177
@wardi do you have any immediate suggestion to add anything in the downstream Dockerfile that would make it work?
@rantoniuk you could use the dev image instead, i.e.
docker compose -f docker-compose.dev.yml exec ckan-dev ckan -c /srv/app/ckan.ini generate fake-data organization
@kowh-ai WDYT, should this be in the readme as well? I was considering adding a collection of little bash scripts for related tasks in dev like:
- installing packages from src dir
- reloading dev settings from .env
- running
ckan <subcommand>in dev
that last one would make creating test data like this a little easier.
I actually went the other way round and just added:
RUN pip3 install -r https://raw.githubusercontent.com/ckan/ckan/refs/heads/2.11/dev-requirements.txt
to my Dockerfile along other plugins. Just as stated in the linked ckan/ckan issue, I feel like this is not a "dev" dependency.
For example commands, I'd propose to add a README.md section:
While docker is running, you can execute any ckan CLI commands by executing command:
docker compose exec ckan ckan -c /srv/app/ckan.ini <command>
e.g.
docker compose exec ckan ckan -c /srv/app/ckan.ini --help
with most used usecases as examples.
@rantoniuk The CKAN cli documentation does specify when it's a "Development" task eg:
but yes it's a bit unclear and should be clarified a little better.
There are many ways make changes to a CKAN Docker environment - running a cli command from the host, running it from within the running CKAN container, adding configuration to the locally built CKAN image like you have done
@wardi I agree an update to the README would be useful and yes please your bash script additions would be much appreciated. I can update the README this week with some examples of how to run commands from the host in a running CKAN Dev container