First update (again)

This commit is contained in:
Brett 2020-09-17 11:42:27 +02:00
parent 179070f2ec
commit b5f2da482a
35 changed files with 143 additions and 2 deletions

View File

@ -1,2 +1,44 @@
### Please note that this re-purposed CKAN Docker repo is a WORK IN PROGRESS ### Notes on the new CKAN Docker
### It should not be used to install CKAN via Docker until this page is updated ### 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/<version> 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

31
ckan/Dockerfile Normal file
View File

@ -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

39
datapusher/Dockerfile Executable file
View File

@ -0,0 +1,39 @@
FROM keitaro/base:0.4
MAINTAINER Keitaro Inc <info@keitaro.info>
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"]

BIN
docker.tar Normal file

Binary file not shown.

15
nginx/Dockerfile Normal file
View File

@ -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

14
postgresql/Dockerfile Executable file
View File

@ -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