diff --git a/README.txt b/README.txt index 36d5c6d..2cfaf60 100644 --- a/README.txt +++ b/README.txt @@ -1,2 +1,44 @@ -### Please note that this re-purposed CKAN Docker repo is a WORK IN PROGRESS ### -### It should not be used to install CKAN via Docker until this page is updated ### \ No newline at end of file +Notes on the new CKAN Docker +solr Dockerfile has this line ENV CKAN_VERSION dev-v2.8 (what should this be for the new version?) + +Build a new CKAN image (using alpine as base, Python3 and CKAN 2.9) +# docker image build -t ckan-base-NEW . +docker build -t kowhai/ckan-base:2.9 -f ckan/2.9/Dockerfile . + +postgresql version needs to increase to 9.5 (at least) +Look at where sensitive data can be obfuscated + +TO DO +1. Add Dev Mode +2. Add patches directory + +Notes + +-Development Mode- + +docker-compose -f docker-compose.dev.yml build +docker-compose -f docker-compose.dev.yml up + +Dockerfile.dev: this is based on openknowledge/ckan-dev (with the Dockerfile on the /ckan-dev/ folder), wich extends openknowledge/ckan-base to include: + +Any extension cloned on the src folder will be installed in the CKAN container when booting up Docker Compose (docker-compose up). +This includes installing any requirements listed in a requirements.txt (or pip-requirements.txt) file and running python setup.py develop. +The CKAN image used will development requirements needed to run the tests. +CKAN will be started running on the ckan development server, with the --reload option to watch changes in the extension files. +Make sure to add the local plugins to the CKAN__PLUGINS env var in the .env file. + +Patches +When building your project specific CKAN images (the ones defined in the ckan/ folder), you can apply patches to CKAN core or any of the built extensions. To do so create a folder inside ckan/patches with the name of the package to patch (ie ckan or ckanext-??). Inside you can place patch files that will be applied when building the images. The patches will be applied in alphabetical order, so you can prefix them sequentially if necessary. + +For instance, check the following example image folder: + +ckan +├── patches +│ ├── ckan +│ │ ├── 01_datasets_per_page.patch +│ │ ├── 02_groups_per_page.patch +│ │ ├── 03_or_filters.patch +│ └── ckanext-harvest +│ └── 01_resubmit_objects.patch +├── Dockerfile +└── Dockerfile.dev \ No newline at end of file diff --git a/ckan/Dockerfile b/ckan/Dockerfile new file mode 100644 index 0000000..de8e8c9 --- /dev/null +++ b/ckan/Dockerfile @@ -0,0 +1,31 @@ +FROM kowhai/ckan-base:2.9 + +LABEL maintainer="brett@kowh.ai" + +# Set timezone +ARG TZ +RUN echo $TZ > /etc/timezone +RUN cp /usr/share/zoneinfo/$TZ /etc/localtime + +# Install any extensions needed by your CKAN instance +# (Make sure to add the plugins to CKAN__PLUGINS in the .env file) +# For instance: +#RUN pip install -e git+https://github.com/ckan/ckanext-pages.git#egg=ckanext-pages && \ +# pip install -e git+https://github.com/ckan/ckanext-dcat.git@v0.0.6#egg=ckanext-dcat && \ +# pip install -r https://raw.githubusercontent.com/ckan/ckanext-dcat/v0.0.6/requirements.txt + +# Install the extension(s) you wrote for your own project +# RUN pip install -e git+https://github.com/your-org/ckanext-your-extension.git@v1.0.0#egg=ckanext-your-extension + +# Apply any patches needed to CKAN core or any of the built extensions (not the +# runtime mounted ones) +# See https://github.com/okfn/docker-ckan#applying-patches +COPY patches ${APP_DIR}/patches + +RUN for d in $APP_DIR/patches/*; do \ + if [ -d $d ]; then \ + for f in `ls $d/*.patch | sort -g`; do \ + cd $SRC_DIR/`basename "$d"` && echo "$0: Applying patch $f to $SRC_DIR/`basename $d`"; patch -p1 < "$f" ; \ + done ; \ + fi ; \ + done diff --git a/ckan-base/2.7/Dockerfile b/ckan/ckan-base/2.7/Dockerfile similarity index 100% rename from ckan-base/2.7/Dockerfile rename to ckan/ckan-base/2.7/Dockerfile diff --git a/ckan-base/2.7/setup/prerun.py b/ckan/ckan-base/2.7/setup/prerun.py similarity index 100% rename from ckan-base/2.7/setup/prerun.py rename to ckan/ckan-base/2.7/setup/prerun.py diff --git a/ckan-base/2.7/setup/start_ckan.sh b/ckan/ckan-base/2.7/setup/start_ckan.sh similarity index 100% rename from ckan-base/2.7/setup/start_ckan.sh rename to ckan/ckan-base/2.7/setup/start_ckan.sh diff --git a/ckan-base/2.7/setup/supervisor.worker.conf b/ckan/ckan-base/2.7/setup/supervisor.worker.conf similarity index 100% rename from ckan-base/2.7/setup/supervisor.worker.conf rename to ckan/ckan-base/2.7/setup/supervisor.worker.conf diff --git a/ckan-base/2.7/setup/supervisord.conf b/ckan/ckan-base/2.7/setup/supervisord.conf similarity index 100% rename from ckan-base/2.7/setup/supervisord.conf rename to ckan/ckan-base/2.7/setup/supervisord.conf diff --git a/ckan-base/2.7/setup/uwsgi.conf b/ckan/ckan-base/2.7/setup/uwsgi.conf similarity index 100% rename from ckan-base/2.7/setup/uwsgi.conf rename to ckan/ckan-base/2.7/setup/uwsgi.conf diff --git a/ckan-base/2.8/Dockerfile b/ckan/ckan-base/2.8/Dockerfile similarity index 100% rename from ckan-base/2.8/Dockerfile rename to ckan/ckan-base/2.8/Dockerfile diff --git a/ckan-base/2.8/setup/prerun.py b/ckan/ckan-base/2.8/setup/prerun.py similarity index 100% rename from ckan-base/2.8/setup/prerun.py rename to ckan/ckan-base/2.8/setup/prerun.py diff --git a/ckan-base/2.8/setup/start_ckan.sh b/ckan/ckan-base/2.8/setup/start_ckan.sh similarity index 100% rename from ckan-base/2.8/setup/start_ckan.sh rename to ckan/ckan-base/2.8/setup/start_ckan.sh diff --git a/ckan-base/2.8/setup/supervisor.worker.conf b/ckan/ckan-base/2.8/setup/supervisor.worker.conf similarity index 100% rename from ckan-base/2.8/setup/supervisor.worker.conf rename to ckan/ckan-base/2.8/setup/supervisor.worker.conf diff --git a/ckan-base/2.8/setup/supervisord.conf b/ckan/ckan-base/2.8/setup/supervisord.conf similarity index 100% rename from ckan-base/2.8/setup/supervisord.conf rename to ckan/ckan-base/2.8/setup/supervisord.conf diff --git a/ckan-base/2.8/setup/uwsgi.conf b/ckan/ckan-base/2.8/setup/uwsgi.conf similarity index 100% rename from ckan-base/2.8/setup/uwsgi.conf rename to ckan/ckan-base/2.8/setup/uwsgi.conf diff --git a/ckan-base/2.9/Dockerfile b/ckan/ckan-base/2.9/Dockerfile similarity index 100% rename from ckan-base/2.9/Dockerfile rename to ckan/ckan-base/2.9/Dockerfile diff --git a/ckan-base/2.9/setup/ckan-uwsgi.ini b/ckan/ckan-base/2.9/setup/ckan-uwsgi.ini similarity index 100% rename from ckan-base/2.9/setup/ckan-uwsgi.ini rename to ckan/ckan-base/2.9/setup/ckan-uwsgi.ini diff --git a/ckan-base/2.9/setup/prerun.py b/ckan/ckan-base/2.9/setup/prerun.py similarity index 100% rename from ckan-base/2.9/setup/prerun.py rename to ckan/ckan-base/2.9/setup/prerun.py diff --git a/ckan-base/2.9/setup/start_ckan.sh b/ckan/ckan-base/2.9/setup/start_ckan.sh similarity index 100% rename from ckan-base/2.9/setup/start_ckan.sh rename to ckan/ckan-base/2.9/setup/start_ckan.sh diff --git a/ckan-base/2.9/setup/supervisor.worker.conf b/ckan/ckan-base/2.9/setup/supervisor.worker.conf similarity index 100% rename from ckan-base/2.9/setup/supervisor.worker.conf rename to ckan/ckan-base/2.9/setup/supervisor.worker.conf diff --git a/ckan-base/2.9/setup/supervisord.conf b/ckan/ckan-base/2.9/setup/supervisord.conf similarity index 100% rename from ckan-base/2.9/setup/supervisord.conf rename to ckan/ckan-base/2.9/setup/supervisord.conf diff --git a/ckan-base/2.9/setup/wsgi.py b/ckan/ckan-base/2.9/setup/wsgi.py similarity index 100% rename from ckan-base/2.9/setup/wsgi.py rename to ckan/ckan-base/2.9/setup/wsgi.py diff --git a/patches b/ckan/patches similarity index 100% rename from patches rename to ckan/patches diff --git a/datapusher/Dockerfile b/datapusher/Dockerfile new file mode 100755 index 0000000..eee3343 --- /dev/null +++ b/datapusher/Dockerfile @@ -0,0 +1,39 @@ +FROM keitaro/base:0.4 + +MAINTAINER Keitaro Inc + +ENV APP_DIR=/srv/app +ENV GIT_BRANCH 0.0.15 +ENV GIT_URL https://github.com/ckan/datapusher.git +ENV JOB_CONFIG ${APP_DIR}/datapusher_settings.py + +WORKDIR ${APP_DIR} + +RUN apk add --no-cache python \ + py-pip \ + py-gunicorn \ + libffi-dev \ + libressl-dev \ + libxslt && \ + # Temporary packages to build CKAN requirements + apk add --no-cache --virtual .build-deps \ + gcc \ + git \ + musl-dev \ + python-dev \ + libxml2-dev \ + libxslt-dev && \ + # Fetch datapusher and install + mkdir ${APP_DIR}/src && cd ${APP_DIR}/src && \ + git clone -b ${GIT_BRANCH} --depth=1 --single-branch ${GIT_URL} && \ + cd datapusher && \ + python setup.py install && \ + pip install --no-cache-dir -r requirements.txt && \ + # Remove temporary packages and files + apk del .build-deps && \ + rm -rf ${APP_DIR}/src + +COPY setup ${APP_DIR} + +EXPOSE 8800 +CMD ["gunicorn", "--bind=0.0.0.0:8800", "--log-file=-", "wsgi"] diff --git a/setup/datapusher_settings.py b/datapusher/setup/datapusher_settings.py similarity index 100% rename from setup/datapusher_settings.py rename to datapusher/setup/datapusher_settings.py diff --git a/setup/wsgi.py b/datapusher/setup/wsgi.py similarity index 100% rename from setup/wsgi.py rename to datapusher/setup/wsgi.py diff --git a/docker.tar b/docker.tar new file mode 100644 index 0000000..bd19ffc Binary files /dev/null and b/docker.tar differ diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..a62d0d3 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,15 @@ +FROM nginx:alpine + +ENV NGINX_DIR=/etc/nginx + +COPY index.html /usr/share/nginx/html/index.html + +RUN mkdir -p ${NGINX_DIR}/sites-available +RUN mkdir -p ${NGINX_DIR}/sites-enabled + +COPY setup/nginx.conf ${NGINX_DIR} +COPY setup/sites-available/* ${NGINX_DIR}/sites-available + +RUN ln -s ${NGINX_DIR}/sites-available/ckan.conf ${NGINX_DIR}/sites-enabled/ckan.conf + +EXPOSE 80 \ No newline at end of file diff --git a/index.html b/nginx/index.html similarity index 100% rename from index.html rename to nginx/index.html diff --git a/setup/nginx.conf b/nginx/setup/nginx.conf similarity index 100% rename from setup/nginx.conf rename to nginx/setup/nginx.conf diff --git a/setup/sites-available/ckan.conf b/nginx/setup/sites-available/ckan.conf similarity index 100% rename from setup/sites-available/ckan.conf rename to nginx/setup/sites-available/ckan.conf diff --git a/postgresql/Dockerfile b/postgresql/Dockerfile new file mode 100755 index 0000000..f221611 --- /dev/null +++ b/postgresql/Dockerfile @@ -0,0 +1,14 @@ +FROM postgres:9.6-alpine +MAINTAINER Open Knowledge International + +# Allow connections; we don't map out any ports so only linked docker containers can connect +RUN echo "host all all 0.0.0.0/0 md5" >> /var/lib/postgresql/data/pg_hba.conf + +# Customize default user/pass/db +ENV POSTGRES_DB ckan +ENV POSTGRES_USER ckan +ARG POSTGRES_PASSWORD +ARG DATASTORE_READONLY_PASSWORD + +# Include extra setup scripts (eg datastore) +ADD docker-entrypoint-initdb.d /docker-entrypoint-initdb.d diff --git a/docker-entrypoint-initdb.d/10_create_datastore.sql b/postgresql/docker-entrypoint-initdb.d/10_create_datastore.sql similarity index 100% rename from docker-entrypoint-initdb.d/10_create_datastore.sql rename to postgresql/docker-entrypoint-initdb.d/10_create_datastore.sql diff --git a/docker-entrypoint-initdb.d/20_setup_test_databases.sql b/postgresql/docker-entrypoint-initdb.d/20_setup_test_databases.sql similarity index 100% rename from docker-entrypoint-initdb.d/20_setup_test_databases.sql rename to postgresql/docker-entrypoint-initdb.d/20_setup_test_databases.sql diff --git a/Dockerfile b/solr/Dockerfile similarity index 100% rename from Dockerfile rename to solr/Dockerfile diff --git a/solrconfig.xml b/solr/solrconfig.xml similarity index 100% rename from solrconfig.xml rename to solr/solrconfig.xml