Skip to content

Fix docker install #5381

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

Merged
merged 1 commit into from
Sep 2, 2020
Merged

Conversation

markstuart
Copy link
Contributor

I attempted to install the master (2.9.0a) version of CKAN using docker, but was seeing errors in the logs when running docker-compose logs -f. The ckan container would exit almost immediately after starting.

The only similar info I can see in issues is this comment by @kowh-ai #5243 (comment)

I haven't raised an accompanying issue, I chose to hopefully provide a fix instead.

Proposed fixes:

Docker installation instructions for 2.9.0a should now work as expected.

Features:

  • includes tests covering changes
  • includes updated documentation
  • includes user-visible changes
  • includes API changes
  • includes bugfix for possible backport

Please [X] all the boxes above that apply

@@ -44,7 +44,8 @@ RUN useradd -r -u 900 -m -c "ckan account" -d $CKAN_HOME -s /bin/false ckan
RUN mkdir -p $CKAN_VENV $CKAN_CONFIG $CKAN_STORAGE_PATH && \
virtualenv $CKAN_VENV && \
ln -s $CKAN_VENV/bin/pip /usr/local/bin/ckan-pip &&\
ln -s $CKAN_VENV/bin/paster /usr/local/bin/ckan-paster
ln -s $CKAN_VENV/bin/paster /usr/local/bin/ckan-paster &&\
ln -s $CKAN_VENV/bin/ckan /usr/local/bin/ckan
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a symlink to the ckan cli here, similar to what has been done in the past for ckan-paster.

Questions:

  • Are we happy with just ckan, or maybe ckan-cli?
  • Do we want to remove the ckan-paster symlink?

@@ -62,4 +63,4 @@ ENTRYPOINT ["/ckan-entrypoint.sh"]
USER ckan
EXPOSE 5000

CMD ["ckan-paster","serve","/etc/ckan/production.ini"]
CMD ["ckan","-c","/etc/ckan/production.ini", "run", "--host", "0.0.0.0"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to set the host to 0.0.0.0 to allow host network to access the server in the container. The ckan run command defaults to localhost if --host is not provided.

@@ -5,7 +5,7 @@
import click
import logging
from logging.config import fileConfig as loggingFileConfig
from configparser import ConfigParser
from six.moves.configparser import ConfigParser
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure how this is working for anyone else? This looks to be way that this library is imported in other parts of the project.

@click.option(u'-o', u'--output-dir', help=u"Location to put the generated "
u"template.",
default=u'.')
def extension(output_dir):
try:
from cookiecutter.main import cookiecutter
except ImportError:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this was in the @generate decorator previously, it was also being applied when running ckan generate config.

The config command does not need cookiecutter, and should not need to load the dev-requirements in order to generate the config file for a new install.

@markstuart markstuart force-pushed the fix-docker-install branch from 4d4f142 to 4f4ffc0 Compare May 13, 2020 22:40
@markstuart
Copy link
Contributor Author

markstuart commented May 13, 2020

Please note that I'm seeing the issue described in #4715 (FATAL: role "postgres" does not exist) output in the docker logs every 30 seconds or so, but everything seems to still be working as expected.

@kowh-ai
Copy link
Contributor

kowh-ai commented May 14, 2020

@smotornyuk -- hey what was the PR mentioned at the Dev meeting today that (may be) updating ckan/cli/generate.py ? I missed that one - thanks Sergey

@smotornyuk
Copy link
Member

#5150 - this one

@kowh-ai
Copy link
Contributor

kowh-ai commented May 15, 2020

@markstuart - thanks for your work here - did you also change the ckan-entrypoint.sh file in your branch?

@kowh-ai
Copy link
Contributor

kowh-ai commented May 15, 2020

Ah - yes I see the 2 changes in the ckan-entrypoint.sh you made - great - this works for me

@markstuart
Copy link
Contributor Author

Yep, just updated to use the new ckan CLI commands 👍

Copy link
Contributor

@kowh-ai kowh-ai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have successfully downloaded/built the 2.9 docker images, run the containers and tested a login - all work fine - Maybe one of the Core Dev's @amercader or @smotornyuk could check the changes in the Python code to see if they are happy

@markstuart markstuart force-pushed the fix-docker-install branch from 4f4ffc0 to 272b30a Compare May 15, 2020 12:43
@markstuart
Copy link
Contributor Author

I see master has moved on a bit since I raised this PR, and there were some conflicts due to @amercader merging #5150. I've rebased my branch on top of master and fixed the conflicts.

@amercader amercader self-assigned this May 19, 2020
paster is still there, but doesn't load all the
commands that are needed

Also prevents an error message being thrown about
needing to pip install dev-requirements

Using 0.0.0.0 instead of localhost in docker so that
we can access exposed port from outside the container
@kowh-ai
Copy link
Contributor

kowh-ai commented Sep 2, 2020

@amercader - Hey can we get this PR merged?...it works fine

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

Successfully merging this pull request may close these issues.

4 participants