-
Notifications
You must be signed in to change notification settings - Fork 201
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
Override scripts for custom ckan
images fail: sudo
not installed
#83
Comments
Thanks @themowski - yes when you say "(Note, however, that the ckan/ckan-docker-base version of this script does not use sudo, so presumably this override file got out of sync with upstream.)" thats exactly what has happened. I'll sort out a way to make this more robust. Thanks for your help. Oh and using the |
@kowh-ai would a possible fix for this be to simply install |
|
Thanks for the update @kowh-ai! I think the
It wasn't clear to me what the process for deploying ckan using docker was, so we used the ckan/ckan-docker repo as a template to start from. If there's a better approach, we'd be glad to hear it. Otherwise, I'm happy to open a PR in the ckan-docker repo to update both Thanks again for all your work on CKAN :) EDIT: I see you have a PR opened already for this: #150 |
Overview
The
ckan/setup/start_ckan.sh.override
file usessudo
to impersonate theckan
user. However,sudo
is not available in the Alpine-based container images. As a result, if you follow the instructions in step 5 of the top-levelREADME.md
and install the override script to create a customckan
image, the script fails when a container is started with that custom image (see the "Demonstration" section).I did not try to build the development image, but looking at the corresponding override file, this error also affects that one.
As a note, it appears that the
start_ckan.sh.override
script is a copy ofckan-2.10/base/setup/start_ckan.sh
in theckan/ckan-docker-base
repo. (Note, however, that theckan/ckan-docker-base
version of this script does not usesudo
, so presumably this override file got out of sync with upstream.) Similarly, thestart_ckan_development.sh.override
file seems to be a copy ofckan-2.10/dev/setup/start_ckan_development.sh
in theckan/ckan-docker-base
repo.It would probably be worth adding comments to the override files or to the
README
stating this, so that people who encounter issues with these in the future can understand how they relates to the base images.Demonstration
I cloned the current
master
(commit 6bbc482) and made this change tockan/Dockerfile
:Then, I ran
docker compose build
anddocker compose up
. Theckan
container eventually died. Here are its logs, minus some extremely lengthy traceback that I believe occurs because the invocation ofsudo python3 prerun.py
fails due tosudo
:Suggested Fixes
For the
start_ckan.sh.override
file, remove the instances ofsudo -u ckan -EH
from the file. It's worth pointing out that this results in the application running as root, which might not be ideal.It's also worth noting that because the script does not run with the
-e
flag, the firstsudo
call in the current script does not cause the container to die immediately. I verified that changing the shebang line to#!/bin/sh -e
causes the script to fail as soon as that firstsudo
is hit, but I don't know if that's really desirable; are some failures OK or expected? (This is really an upstreamckan/ckan-docker-base
question; if there is interest, I can log an issue there as well, if needed.)For
start_ckan_development.sh.override
, the approach is less clear, since I haven't actually tested it. Removingsudo -u ckan -EH
probably needs to happen. However, theckan/ckan-docker-base
version of the script has an extrasu
command on the last line that appears to be used to run CKAN as theckan
user.Maybe using
su ckan -c ...
is the best path forward for both override scripts? I don't know enough about how CKAN runs / expects to run to say for sure, but it is worth noting that this difference exists.The text was updated successfully, but these errors were encountered: