Skip to content

Commit

Permalink
prepare docker-compose for ckanext-spatial
Browse files Browse the repository at this point in the history
modify CKAN Dockerfile to install system packages required for ckanext-spatial
modify postgres Dockerfile to use postgis image
add postgres Dockerfile script to set permissions for postgis tables to ckan user
add working installation steps to docs
  • Loading branch information
Florian Mayer authored and Florian Mayer committed Jul 17, 2017
1 parent 32c976a commit 6f7869f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Dockerfile
Expand Up @@ -14,6 +14,10 @@ RUN apt-get -q -y update && apt-get -q -y upgrade && \
libpq-dev \
git-core \
postgresql-client \
python-dev \
libxml2-dev \
libxslt-dev \
libgeos-dev \
&& apt-get -q clean

# Define environment variables
Expand Down
5 changes: 4 additions & 1 deletion contrib/docker/postgresql/Dockerfile
@@ -1,4 +1,5 @@
FROM postgres:9.6
#FROM postgres:9.6
FROM mdillon/postgis
MAINTAINER Open Knowledge

# Allow connections; we don't map out any ports so only linked docker containers can connect
Expand All @@ -13,3 +14,5 @@ ARG DS_RO_PASS
# Include datastore setup scripts
ADD /docker-entrypoint-initdb.d/00_create_datastore.sql ./00_create_datastore.sql
ADD /docker-entrypoint-initdb.d/10_set_permissions.sql ./10_set_permissions.sql
ADD /docker-entrypoint-initdb.d/20_postgis_permissions.sql ./20_postgis_permissions.sql

@@ -0,0 +1,3 @@
CREATE EXTENSION POSTGIS;
ALTER VIEW geometry_columns OWNER TO ckan;
ALTER TABLE spatial_ref_sys OWNER TO ckan;
23 changes: 23 additions & 0 deletions doc/maintaining/installing/install-from-docker-compose.rst
Expand Up @@ -251,8 +251,31 @@ In this example we'll install `ckanext-geoview <https://github.com/ckan/ckanext-
Some extensions require database upgrades, often through paster scripts.
E.g., ``ckanext-spatial``::


# Enter the running ckan container:
docker exec -it ckan bash

# Inside the running ckan container
source $CKAN_VENV/bin/activate && cd $CKAN_VENV/src/
git clone https://github.com/ckan/ckanext-spatial.git
cd ckanext-spatial
pip install -r pip-requirements.txt
python setup.py install && python setup.py develop
exit

docker exec -it db psql -U ckan -f 20_postgis_permissions.sql
docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-spatial spatial initdb -c /etc/ckan/ckan.ini

sudo vim /var/lib/docker/volumes/docker_ckan_config/_data/ckan.ini

# in plugins, add:
spatial_metadata spatial_query

ckanext.spatial.search_backend = solr

.. note:: In order to work on your own forks of CKAN extensions, the container's
ssh publickey must be added to the respective repository's authorized keys.

b. Modify CKAN config

Follow the respective extension's instructions to set CKAN config variables::
Expand Down

0 comments on commit 6f7869f

Please sign in to comment.