tum-gis / ckan-docker

Docker images for Smart District Data Infrastructure (SDDI) enabled CKAN catalog
Apache License 2.0
10 stars 9 forks source link

Update for Spatial, UserAutoAddGroup and DateSearch view #14

Closed MarijaKnezevic closed 1 year ago

MarijaKnezevic commented 1 year ago

Changes in branch for versions which are working with ckan 2.9

BWibo commented 1 year ago

Hey there,

I'm getting this error on image runtime:

@MarijaKnezevic @TomeCirun: Can you fix this? Apparently there is some kind of naming conflict, should be easy to resolve.

Defaulted container "ckan" out of: ckan, init-data (init), pg-ready (init)
/srv/app/start_ckan.sh: Ignoring /srv/app/docker-entrypoint.d/* (not an sh or py file)

Starting UWSGI with '2' workers
[prerun] Start check_db_connection...
[prerun] Start check_solr_connection...
[prerun] Succesfully connected to solr and CKAN schema loaded
[prerun] Start init_db...
[prerun] Initializing or upgrading db - start using ckan db init
2023-04-11 06:57:23,460 INFO  [ckan.cli] Using configuration file /srv/app/production.ini
2023-04-11 06:57:23,460 INFO  [ckan.config.environment] Loading static files from public
2023-04-11 06:57:23,584 INFO  [ckan.config.environment] Loading templates from /srv/app/src/ckan/ckan/templates
2023-04-11 06:57:23,960 INFO  [ckan.config.environment] Loading templates from /srv/app/src/ckan/ckan/templates
Traceback (most recent call last):
  File "/usr/local/bin/ckan", line 8, in <module>
    sys.exit(ckan())
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 781, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 700, in make_context
    self.parse_args(ctx, args)
  File "/srv/app/src/ckan/ckan/cli/cli.py", line 115, in parse_args
    result = super(ExtendableGroup, self).parse_args(ctx, args)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1212, in parse_args
    rest = Command.parse_args(self, ctx, args)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1048, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1630, in handle_parse_result
    value = invoke_param_callback(self.callback, ctx, self, value)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 123, in invoke_param_callback
    return callback(ctx, param, value)
  File "/srv/app/src/ckan/ckan/cli/cli.py", line 125, in _init_ckan_config
    _add_ctx_object(ctx, value)
  File "/srv/app/src/ckan/ckan/cli/cli.py", line 134, in _add_ctx_object
    ctx.obj = CtxObject(path)
  File "/srv/app/src/ckan/ckan/cli/cli.py", line 56, in __init__
    self.app = make_app(self.config)
  File "/srv/app/src/ckan/ckan/config/middleware/__init__.py", line 56, in make_app
    load_environment(conf)
  File "/srv/app/src/ckan/ckan/config/environment.py", line 123, in load_environment
    p.load_all()
  File "/srv/app/src/ckan/ckan/plugins/core.py", line 165, in load_all
    load(*plugins)
  File "/srv/app/src/ckan/ckan/plugins/core.py", line 193, in load
    plugins_update()
  File "/srv/app/src/ckan/ckan/plugins/core.py", line 153, in plugins_update
    environment.update_config()
  File "/srv/app/src/ckan/ckan/config/environment.py", line 322, in update_config
    logic.get_action('get_site_user')({'ignore_auth': True}, None)
  File "/srv/app/src/ckan/ckan/logic/__init__.py", line 454, in get_action
    raise NameConflict(
ckan.logic.NameConflict: The action 'user_create' is already implemented in 'display_group'

Traceback (most recent call last):
  File "prerun.py", line 217, in <module>
    init_db()
  File "prerun.py", line 113, in init_db
    raise e
  File "prerun.py", line 101, in init_db
    subprocess.check_output(db_command, stderr=subprocess.STDOUT)
  File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ckan', '-c', '/srv/app/production.ini', 'db', 'init']' returned non-zero exit status 1.
[CKAN prerun] FAILED. Exiting...
BWibo commented 1 year ago

@MarijaKnezevic Regarding your eMail with the error on missing permissions in CKAN_STORAGE_PATH -> /var/lib/ckan :

I assume it's the compose environment. I added to chown this path to ckan, can you test if that works for you?

This should not be a problem in the k8s stack, as an init-container makes sure that CKAN_STORAGE_PATH has permissions set correctly.

MarijaKnezevic commented 1 year ago

@MarijaKnezevic Regarding your eMail with the error on missing permissions in CKAN_STORAGE_PATH -> /var/lib/ckan :

  • In what environment (docker-compose, k8s or bare metal server) did the error occur?

I assume it's the compose environment. I added to chown this path to ckan, can you test if that works for you?

This should not be a problem in the k8s stack, as an init-container makes sure that CKAN_STORAGE_PATH has permissions set correctly.

@BWibo Yes, it is compose environment. I've tested it and receiving following error:

 => ERROR [runtime 16/14] RUN set -ex &&   ckan config-tool "/srv/app/production.ini" "ckan.plugins = image_view  31.8s
------
 > [runtime 16/14] RUN set -ex &&   ckan config-tool "/srv/app/production.ini" "ckan.plugins = image_view text_view recline_view datastore datapusher   hierarchy_display hierarchy_form display_group relation   spatial_metadata spatial_query datesearch repeating composite scheming_datasets   envvars" &&   ckan config-tool "/srv/app/production.ini" "ckan.spatial.srid = 4326" &&   ckan config-tool "/srv/app/production.ini" "ckanext.spatial.search_backend = solr-bbox" &&   ckan config-tool "/srv/app/production.ini" "scheming.dataset_schemas = ckanext.scheming:ckan_dataset.yaml" &&   ckan config-tool "/srv/app/production.ini" "scheming.presets = ckanext.scheming:presets.json ckanext.repeating:presets.json ckanext.composite:presets.json" &&   ckan config-tool "/srv/app/production.ini" "scheming.dataset_fallback = false" &&   echo "UTC" > /etc/timezone &&   chown -R ckan:ckan /srv/app /var/lib/ckan &&   rm -rf /srv/app/ext_wheels:
#33 0.977 + ckan config-tool /srv/app/production.ini ckan.plugins = image_view text_view recline_view datastore datapusher   hierarchy_display hierarchy_form display_group relation   spatial_metadata spatial_query datesearch repeating composite scheming_datasets   envvars
#33 2.579 Edited option ckan.plugins = "envvars image_view text_view recline_view datastore datapusher"->"image_view text_view recline_view datastore datapusher   hierarchy_display hierarchy_form display_group relation   spatial_metadata spatial_query datesearch repeating composite scheming_datasets   envvars" (section "app:main")
#33 2.798 + ckan config-tool /srv/app/production.ini ckan.spatial.srid = 4326
#33 4.862 + ckan config-tool /srv/app/production.ini ckanext.spatial.search_backend = solr-bbox
#33 7.288 + ckan config-tool /srv/app/production.ini scheming.dataset_schemas = ckanext.scheming:ckan_dataset.yaml
#33 9.728 + ckan config-tool /srv/app/production.ini scheming.presets = ckanext.scheming:presets.json ckanext.repeating:presets.json ckanext.composite:presets.json
#33 11.84 + ckan config-tool /srv/app/production.ini scheming.dataset_fallback = false
#33 13.83 + echo UTC
#33 13.83 + chown -R ckan:ckan /srv/app /var/lib/ckan
#33 31.73 chown: cannot access '/var/lib/ckan': No such file or directory
------
executor failed running [/bin/sh -c set -ex &&   ckan config-tool "${CKAN_INI}" "ckan.plugins = ${CKAN__PLUGINS}" &&   ckan config-tool "${CKAN_INI}" "ckan.spatial.srid = 4326" &&   ckan config-tool "${CKAN_INI}" "ckanext.spatial.search_backend = solr-bbox" &&   ckan config-tool "${CKAN_INI}" "scheming.dataset_schemas = ckanext.scheming:ckan_dataset.yaml" &&   ckan config-tool "${CKAN_INI}" "scheming.presets = ckanext.scheming:presets.json ckanext.repeating:presets.json ckanext.composite:presets.json" &&   ckan config-tool "${CKAN_INI}" "scheming.dataset_fallback = false" &&   echo "${TZ}" > /etc/timezone &&   chown -R ckan:ckan ${APP_DIR} ${CKAN_STORAGE_PATH} &&   rm -rf ${APP_DIR}/ext_wheels]: exit code: 1
BWibo commented 1 year ago

@MarijaKnezevic I added the missing folder creation, please try again. Can you please as well post/link the docker-compose.yml yiou are using?