From 14b6ae04d7048b2e4ff5ebe4e12c8dad971a7b53 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Thu, 2 Mar 2023 17:36:19 +0100 Subject: [PATCH 01/34] Update Dockerfile.dev Add extensions: ckanext-harvest ckanext-resourcedictionary ckanext-geoview ckanext-pages ckanext-pdfview --- ckan/Dockerfile.dev | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/ckan/Dockerfile.dev b/ckan/Dockerfile.dev index cd97021..071db29 100644 --- a/ckan/Dockerfile.dev +++ b/ckan/Dockerfile.dev @@ -27,15 +27,30 @@ RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ # pip3 install -U requests[security] ### Harvester ### -#RUN pip3 install -e 'git+https://github.com/ckan/ckanext-harvest.git@master#egg=ckanext-harvest' && \ -# pip3 install -r ${APP_DIR}/src/ckanext-harvest/pip-requirements.txt +RUN pip3 install -e 'git+https://github.com/ckan/ckanext-harvest.git@master#egg=ckanext-harvest' && \ + pip3 install -r ${APP_DIR}/src/ckanext-harvest/pip-requirements.txt # will also require gather_consumer and fetch_consumer processes running (please see https://github.com/ckan/ckanext-harvest) + +### resourcedictionary ### +RUN pip3 install -e 'git+https://github.com/keitaroinc/ckanext-resourcedictionary.git#egg=ckanext-resourcedictionary' && \ + pip3 install -r ${APP_DIR}/src/ckanext-resourcedictionary/requirements.txt + +### Geoview ### + RUN pip3 install -e git+https://github.com/ckan/ckanext-geoview.git#egg=ckanext-geoview + +### Spatial ### +# RUN pip3 install -e git+https://github.com/ckan/ckanext-spatial.git#egg=ckanext-spatial && \ +# pip3 install -r ${APP_DIR}/src/ckanext-spatial/pip-requirements.txt + ### Scheming ### #RUN pip3 install -e 'git+https://github.com/ckan/ckanext-scheming.git@master#egg=ckanext-scheming' ### Pages ### -#RUN pip3 install -e git+https://github.com/ckan/ckanext-pages.git#egg=ckanext-pages +RUN pip3 install -e git+https://github.com/ckan/ckanext-pages.git#egg=ckanext-pages + +### PDFView ### +RUN pip3 install -e git+https://github.com/ckan/ckanext-pdfview.git#egg=ckanext-pdfview ### DCAT ### #RUN pip3 install -e git+https://github.com/ckan/ckanext-dcat.git@v0.0.6#egg=ckanext-dcat && \ @@ -55,4 +70,4 @@ RUN for d in $APP_DIR/patches/*; do \ cd $SRC_DIR/`basename "$d"` && echo "$0: Applying patch $f to $SRC_DIR/`basename $d`"; patch -p1 < "$f" ; \ done ; \ fi ; \ - done \ No newline at end of file + done From fdf4d8206432e2bfbad18c50ed00da252b4f548e Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Fri, 17 Mar 2023 10:09:20 +0000 Subject: [PATCH 02/34] Update dev docker Update: - README, add roadmap with plugin versions. - .env and .env.example - Dockerfile.dev Add: - docker-entrypoint to update ckanext-spatial (.env) environment variables that envvars does not retrieve dynamically. - Git patches to update the display of spatial widgets (ckanext-spatial). --- .env | 56 ++++- .env.example | 56 ++++- .gitignore | 1 + README.md | 208 +++++++++++++----- ckan/Dockerfile.dev | 68 ++++-- ckan/docker-entrypoint.d/setup_scheming.sh | 9 + .../ckan/00_spatial_widget_dataset.patch | 14 ++ .../ckan/01_spatial_widget_search.patch | 10 + 8 files changed, 339 insertions(+), 83 deletions(-) create mode 100644 ckan/docker-entrypoint.d/setup_scheming.sh create mode 100644 ckan/patches/ckan/00_spatial_widget_dataset.patch create mode 100644 ckan/patches/ckan/01_spatial_widget_search.patch diff --git a/.env b/.env index 02d6238..dfff212 100644 --- a/.env +++ b/.env @@ -28,15 +28,16 @@ TEST_CKAN_DATASTORE_WRITE_URL=postgresql://ckan:ckan@db/datastore_test TEST_CKAN_DATASTORE_READ_URL=postgresql://datastore_ro:datastore@db/datastore_test # CKAN core -CKAN_VERSION=2.9.7 +CKAN_VERSION=2.10.0 CKAN_SITE_ID=default -CKAN_SITE_URL=http://ckan:5000 +CKAN_SITE_URL=http://localhost:5000 CKAN_PORT=5000 CKAN_PORT_HOST=5000 -CKAN___BEAKER__SESSION__SECRET=CHANGE_ME +CKAN___BEAKER__SESSION__SECRET=39ASDK913r4jas0 # See https://docs.ckan.org/en/latest/maintaining/configuration.html#api-token-settings -CKAN___API_TOKEN__JWT__ENCODE__SECRET=string:CHANGE_ME -CKAN___API_TOKEN__JWT__DECODE__SECRET=string:CHANGE_ME +CKAN___API_TOKEN__JWT__ENCODE__SECRET=string:WqVhDAXsF7E9FvzVnNqdsKpDT9wZbiu6hzxyMijv4FN3B +CKAN___API_TOKEN__JWT__DECODE__SECRET=string:WqVhDAXsF7E9FvzVnNqdsKpDT9wZbiu6hzxyMijv4FN3B +CKAN___DATAPUSHER__API_TOKEN=api_token CKAN_SYSADMIN_NAME=ckan_admin CKAN_SYSADMIN_PASSWORD=test1234 CKAN_SYSADMIN_EMAIL=your_email@example.com @@ -47,9 +48,22 @@ CKAN_SMTP_USER=user CKAN_SMTP_PASSWORD=pass CKAN_SMTP_MAIL_FROM=ckan@localhost TZ=UTC +## Customize which text formats the text_view plugin will show +CKAN__PREVIEW__JSON_FORMATS="json jsonld" +# html htm rdf+xml owl+xml xml n3 n-triples turtle plain atom csv tsv rss txt json +CKAN__PREVIEW__XML_FORMATS="html htm xml rdf rdf+xml owl+xml atom rss turtle ttl n3 n-triples" +CKAN__PREVIEW__TEXT_FORMATS="text plain text/plain text/turtle csv tsv rss txt json" +## Resource Proxy settings +### Preview size limit, default: 1MB +CKAN__RESOURCE_PROXY__MAX_FILE_SIZE=50048576 +## Size of chunks to read/write__ +CKAN__RESOURCE_PROXY__CHUNK_SIZE=4096 +## Default timeout for fetching proxied items +CKAN__RESOURCE_PROXY__TIMEOUT=10 +CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view harvest ckan_harvester wmts_view geojson_view geo_view shp_view pdf_view" # Solr -SOLR_IMAGE_VERSION=2.9-solr8 +SOLR_IMAGE_VERSION=2.10-spatial CKAN_SOLR_URL=http://solr:8983/solr/ckan TEST_CKAN_SOLR_URL=http://solr:8983/solr/ckan @@ -70,8 +84,36 @@ NGINX_PORT=80 NGINX_SSLPORT=443 # Extensions -CKAN__PLUGINS="envvars image_view text_view recline_view datastore datapusher" +CKAN__PLUGINS="envvars stats text_view image_view recline_view resourcedictionary datastore datapusher harvest ckan_harvester spatial_metadata spatial_query spatial_harvest_metadata_api csw_harvester waf_harvester doc_harvester resource_proxy geo_view geojson_view wmts_view shp_view dcat dcat_rdf_harvester dcat_json_harvester dcat_json_interface scheming_datasets scheming_groups scheming_organizations pdf_view pages" + CKAN__HARVEST__MQ__TYPE=redis CKAN__HARVEST__MQ__HOSTNAME=redis CKAN__HARVEST__MQ__PORT=6379 CKAN__HARVEST__MQ__REDIS_DB=1 + +# ckanext-dcat +CKANEXT__DCAT__BASE_URI=https://localhost:5000 +CKANEXT__DCAT__RDF_PROFILES="euro_dcat_ap_2 euro_dcat_ap" + +# ckanext-scheming: setup_scheming.sh +SCHEMA_CKANEXT_SCHEMING_DATASET_SCHEMA="ckanext.scheming:ckan_geodcatap.yaml" +SCHEMA_CKANEXT_SCHEMING_GROUP_SCHEMAS="ckanext.scheming:ckan_group_geodcatap.json" +SCHEMA_CKANEXT_SCHEMING_ORGANIZATION_SCHEMAS="ckanext.scheming:ckan_org_geodcatap.json" +SCHEMA_CKANEXT_SCHEMING_PRESETS="ckanext.scheming:presets.json" + +# ckanext-spatial (Solr Backend - solr8-spatial) +CKANEXT__SPATIAL__SEARCH_BACKEND=solr-bbox +CKAN__SPATIAL__SRID=3857 +CKANEXT__SPATIAL__COMMON_MAP__TYPE=custom +CKANEXT__SPATIAL__COMMON_MAP__CUSTOM__URL=https://rts.larioja.org/mapa-base/rioja/{z}/{x}/{y}.png +CKANEXT__SPATIAL__COMMON_MAP__ATTRIBUTION='Servicios de Teselas. IDEE, bajo CC BY 3.0.' + +# ckanext-geoview +CKANEXT__GEOVIEW__GEOJSON__MAX_FILE_SIZE=100000000 +CKANEXT__GEOVIEW__OL_VIEWER__FORMATS="wms wfs geojson gml kml" +CKANEXT__GEOVIEW__SHP_VIEWER__SRID=3857 +CKANEXT__GEOVIEW__SHP_VIEWER__ENCODING=UTF-8 + +#TODO: ckanext-sparql - Not implemented yet +CKANEXT__SPARQL__ENDPOINT_URL=http://dbpedia.org/sparql +CKANEXT__SPARQL__HIDE_ENDPOINT_URL=False \ No newline at end of file diff --git a/.env.example b/.env.example index 02d6238..2a0e497 100644 --- a/.env.example +++ b/.env.example @@ -28,15 +28,16 @@ TEST_CKAN_DATASTORE_WRITE_URL=postgresql://ckan:ckan@db/datastore_test TEST_CKAN_DATASTORE_READ_URL=postgresql://datastore_ro:datastore@db/datastore_test # CKAN core -CKAN_VERSION=2.9.7 +CKAN_VERSION=2.10.0 CKAN_SITE_ID=default -CKAN_SITE_URL=http://ckan:5000 +CKAN_SITE_URL=http://localhost:5000 CKAN_PORT=5000 CKAN_PORT_HOST=5000 -CKAN___BEAKER__SESSION__SECRET=CHANGE_ME +CKAN___BEAKER__SESSION__SECRET=39ASDK913r4jas0 # See https://docs.ckan.org/en/latest/maintaining/configuration.html#api-token-settings -CKAN___API_TOKEN__JWT__ENCODE__SECRET=string:CHANGE_ME -CKAN___API_TOKEN__JWT__DECODE__SECRET=string:CHANGE_ME +CKAN___API_TOKEN__JWT__ENCODE__SECRET=string:WqVhDAXsF7E9FvzVnNqdsKpDT9wZbiu6hzxyMijv4FN3B +CKAN___API_TOKEN__JWT__DECODE__SECRET=string:WqVhDAXsF7E9FvzVnNqdsKpDT9wZbiu6hzxyMijv4FN3B +CKAN___DATAPUSHER__API_TOKEN = api_token CKAN_SYSADMIN_NAME=ckan_admin CKAN_SYSADMIN_PASSWORD=test1234 CKAN_SYSADMIN_EMAIL=your_email@example.com @@ -47,9 +48,22 @@ CKAN_SMTP_USER=user CKAN_SMTP_PASSWORD=pass CKAN_SMTP_MAIL_FROM=ckan@localhost TZ=UTC +## Customize which text formats the text_view plugin will show +CKAN__PREVIEW__JSON_FORMATS="json jsonld" +# html htm rdf+xml owl+xml xml n3 n-triples turtle plain atom csv tsv rss txt json +CKAN__PREVIEW__XML_FORMATS="html htm xml rdf rdf+xml owl+xml atom rss turtle ttl n3 n-triples" +CKAN__PREVIEW__TEXT_FORMATS="text plain text/plain text/turtle csv tsv rss txt json" +## Resource Proxy settings +### Preview size limit, default: 1MB +CKAN__RESOURCE_PROXY__MAX_FILE_SIZE=50048576 +## Size of chunks to read/write__ +CKAN__RESOURCE_PROXY__CHUNK_SIZE=4096 +## Default timeout for fetching proxied items +CKAN__RESOURCE_PROXY__TIMEOUT=10 +CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view harvest ckan_harvester wmts_view geojson_view geo_view shp_view pdf_view" # Solr -SOLR_IMAGE_VERSION=2.9-solr8 +SOLR_IMAGE_VERSION=2.10-spatial CKAN_SOLR_URL=http://solr:8983/solr/ckan TEST_CKAN_SOLR_URL=http://solr:8983/solr/ckan @@ -70,8 +84,36 @@ NGINX_PORT=80 NGINX_SSLPORT=443 # Extensions -CKAN__PLUGINS="envvars image_view text_view recline_view datastore datapusher" +CKAN__PLUGINS="envvars stats text_view image_view recline_view resourcedictionary datastore datapusher harvest ckan_harvester spatial_metadata spatial_query spatial_harvest_metadata_api csw_harvester waf_harvester doc_harvester resource_proxy geo_view geojson_view wmts_view shp_view dcat dcat_rdf_harvester dcat_json_harvester dcat_json_interface scheming_datasets scheming_groups scheming_organizations pdf_view pages" + CKAN__HARVEST__MQ__TYPE=redis CKAN__HARVEST__MQ__HOSTNAME=redis CKAN__HARVEST__MQ__PORT=6379 CKAN__HARVEST__MQ__REDIS_DB=1 + +# ckanext-dcat +CKANEXT__DCAT__BASE_URI=https://localhost:5000 +CKANEXT__DCAT__RDF_PROFILES="euro_dcat_ap_2 euro_dcat_ap" + +# ckanext-scheming: setup_scheming.sh +SCHEMA_CKANEXT_SCHEMING_DATASET_SCHEMA="ckanext.scheming:ckan_geodcatap.yaml" +SCHEMA_CKANEXT_SCHEMING_GROUP_SCHEMAS="ckanext.scheming:ckan_group_geodcatap.json" +SCHEMA_CKANEXT_SCHEMING_ORGANIZATION_SCHEMAS="ckanext.scheming:ckan_org_geodcatap.json" +SCHEMA_CKANEXT_SCHEMING_PRESETS="ckanext.scheming:presets.json" + +# ckanext-spatial (Solr Backend - solr8-spatial) +CKANEXT__SPATIAL__SEARCH_BACKEND=solr-bbox +CKAN__SPATIAL__SRID=3857 +CKANEXT__SPATIAL__COMMON_MAP__TYPE=custom +CKANEXT__SPATIAL__COMMON_MAP__CUSTOM__URL=https://rts.larioja.org/mapa-base/rioja/{z}/{x}/{y}.png +CKANEXT__SPATIAL__COMMON_MAP__ATTRIBUTION='Servicios de Teselas. IDEE, bajo CC BY 3.0.' + +# ckanext-geoview +CKANEXT__GEOVIEW__GEOJSON__MAX_FILE_SIZE=100000000 +CKANEXT__GEOVIEW__OL_VIEWER__FORMATS="wms wfs geojson gml kml" +CKANEXT__GEOVIEW__SHP_VIEWER__SRID=3857 +CKANEXT__GEOVIEW__SHP_VIEWER__ENCODING=UTF-8 + +#ckanext-sparql +CKANEXT__SPARQL__ENDPOINT_URL=http://dbpedia.org/sparql +CKANEXT__SPARQL__HIDE_ENDPOINT_URL=False \ No newline at end of file diff --git a/.gitignore b/.gitignore index 06c7c30..1722a68 100755 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ _service-provider/* _solr/schema.xml _src/* local/* +.vscode \ No newline at end of file diff --git a/README.md b/README.md index 450aada..85b84b7 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,34 @@ -# Docker Compose setup for CKAN +

CKAN Docker Compose - Open Data & GIS

+

+CKAN VersionsLicense: MIT -* [Overview](#overview) -* [Installing Docker](#installing-docker) -* [docker compose vs docker-compose](#docker-compose-vs-docker-compose) -* [Install CKAN plus dependencies](#install-ckan-plus-dependencies) -* [Development mode](#development-mode) - * [Create an extension](#create-an-extension) -* [CKAN images](#ckan-images) - * [Extending the base images](#extending-the-base-images) - * [Applying patches](#applying-patches) -* [Debugging with pdb](#pdb) -* [Datastore and Datapusher](#Datastore-and-datapusher) -* [NGINX](#nginx) -* [The ckanext-envvars extension](#envvars) +

+ Overview • + Branch roadmap • + Environment: docker • + Install CKAN • + CKAN images • + Extending guide • + Applying patches • + Addons +

+[](#ckan-images) +**Requirements**: +* Linux 64 bit system -## 1. Overview +>**Note**
+> Tested successfully on **Debian GNU/Linux 11 (bullseye)** -This is a set of configuration and setup files to run a CKAN site. +## Overview +Contains Docker images for the different components of CKAN Cloud and a Docker compose environment (based on [ckan](https://github.com/ckan/ckan)) for development and testing Open Data portals. -The CKAN images used are from the official CKAN [ckan-docker](https://github.com/ckan/ckan-docker-base) repo +Available components: +* The CKAN images used are from the official CKAN [ckan-docker-base](https://github.com/ckan/ckan-docker-base) repo The non-CKAN images are as follows: - -* DataPusher: CKAN's [pre-configured DataPusher image](https://github.com/ckan/ckan-base/tree/main/datapusher). +* DataPusher: CKAN's [pre-configured DataPusher image](https://github.com/ckan/ckan-docker-base/tree/main/datapusher). * PostgreSQL: Official PostgreSQL image. Database files are stored in a named volume. * Solr: CKAN's [pre-configured Solr image](https://github.com/ckan/ckan-solr). Index data is stored in a named volume. * Redis: standard Redis image @@ -32,29 +36,100 @@ The non-CKAN images are as follows: The site is configured using environment variables that you can set in the `.env` file. -## 2. Installing Docker +>**Warning**:
+> This is the **install from Docker Compose**. To see the install from source, check it out: [`ckan/doc/repository/installations/ckan_source.md`](https://github.com/OpenDataGIS/ckan/blob/16dbe5da5ca0fd28d595ba2049e4d47e52c40c0f/doc/repository/installations/ckan_source.md) -Install Docker by following the following instructions: [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/) + +### ckan-docker roadmap +Information about extensions installed in the `main` image. More info described in the [Extending the base images](#extending-the-base-images) + +>**Note**
+> Switch branches to see the `roadmap` for other projects: [ckan-docker/branches](https://github.com/mjanez/ckan-docker/branches) + + +| **Element** | **Description** | **version** | **Status** | **DEV**[^1] | **PRO**[^2] | **Remarks** | +|-------------|-----------------------------------------------------------------------------------------|-------------|------------------------------|---------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Core | [CKAN](https://github.com/mjanez/ckan-docker) | 2.10.0 | Completed | ✔️ | ✔️ | Stable installation for version 2.10.0 (Production & Dev images) via Docker Compose based on [official images](https://github.com/ckan/ckan-docker-base)). Initial configuration, basic customisation and operation guide. | +| Core + | [Datastore](https://github.com/mjanez/ckan-docker) | 2.10.0 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose. | +| Core + | [Datapusher](https://github.com/mjanez/ckan-docker) | 0.0.19 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose.

**TODO**: Upgrade to [xloader](https://github.com/ckan/ckanext-xloader), an express Loader - quickly load data into DataStore. A replacement for DataPusher. | +| Extension | [ckanext-harvest](https://github.com/ckan/ckanext-harvest) | 1.5.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | +| Extension | [ckanext-geoview](https://github.com/ckan/ckanext-geoview) | 0.0.20 | Completed | ✔️ | ✔️ | Stable installation. | +| Extension | [ckanext-spatial](https://github.com/ckan/ckanext-spatial) | 2.0.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | +| Extension | [ckanext-dcat](https://github.com/mjanez/ckanext-dcat) | 1.2.0 | Completed | ✔️ | ✔️ | Stable installation, include DCAT-AP 2.1 profile compatible with GeoDCAT-AP. | +| Extension | [ckanext-scheming](https://github.com/mjanez/ckanext-scheming) | 3.0.0 | WIP | ✔️ | ✔️ | Stable installation. Customised ckanext schema[^3] based on the [Spanish Metadata Core](https://datos.gob.es/es/doc-tags/nti-risp) with the aim of completing the minimum metadata elements included in the current datasets in accordance with [GeoDCAT-AP](https://semiceu.github.io/GeoDCAT-AP/releases/) and [INSPIRE](https://inspire.ec.europa.eu/about-inspire). | +| Extension | [ckanext-resourcedictionary](https://github.com/OpenDataGIS/ckanext-resourcedictionary) | main | Completed | ✔️ | ✔️ | Stable installation. This extension extends the default CKAN Data Dictionary functionality by adding possibility to create data dictionary before actual data is uploaded to datastore. | +| Extension | [ckanext-pages](https://github.com/ckan/ckanext-pages) | 0.5.1 | Completed | ✔️ | ✔️ | Stable installation. This extension gives you an easy way to add simple pages to CKAN. | +| Extension | [ckanext-pdfview](https://github.com/ckan/ckanext-pdfview) | 0.0.8 | Completed | ✔️ | ✔️ | Stable installation. This extension provides a view plugin for PDF files using an html object tag. | +| Software | [docker-pycsw](https://github.com/mjanez/ckan-pycsw) | main | Completed standalone version | ✔️ | ❌ | Stable installation. PyCSW Endpoint of Open Data Portal with docker compose config. Harvest the CKAN catalogue in a CSW endpoint based on existing spatial datasets in the open data portal. | + + +## Environment: docker +### docker compose *vs* docker-compose +All Docker Compose commands in this README will use the V2 version of Compose ie: `docker compose`. The older version (V1) used the `docker-compose` command. Please see [Docker Compose](https://docs.docker.com/compose/compose-v2/) for +more information. + +### Upgrade docker-engine +To upgrade Docker Engine, first run sudo `apt-get update`, then follow the [installation instructions](https://docs.docker.com/engine/install/debian/#install-using-the-repository), choosing the new version you want to install. To verify a successful Docker installation, run `docker run hello-world` and `docker version`. These commands should output versions for client and server. -## 3. docker compose *vs* docker-compose +### Docker. Basic commands +#### Linux post-install steps +[These optional post-installation procedures](https://docs.docker.com/engine/install/linux-postinstall/) shows you how to configure your Linux host machine to work better with Docker. For example, managing docker with [a non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user). -All Docker Compose commands in this README will use the V2 version of Compose ie: `docker compose`. The older version (V1) -used the `docker-compose` command. Please see [Docker Compose](https://docs.docker.com/compose/compose-v2/) for -more information. +#### Configure Docker to start on boot +```bash +sudo systemctl enable docker -## 4. Install (build and run) CKAN plus dependencies +# To disable this behavior, use disable instead. +sudo systemctl disable docker +``` -#### Base mode +#### Clear all Docker unused objects (images, containers, networks, local volumes) +```bash +docker system prune # Clear all +docker image prune # Clear unused images +docker container prune # Clear unused containers +docker volume prune # Clear unused volumes +docker network prune # Clear unused networks +``` + +### Docker Compose. Basic commands +More info about Docker Compose commands at [docker compose reference](https://docs.docker.com/compose/reference/). + +```bash +# Starts existing containers for a service. +docker compose start + +# Stops running containers without removing them. +docker compose stop + +# Pauses running containers of a service. +docker compose pause + +# Unpauses paused containers of a service. +docker compose unpause + +# Lists containers. +docker compose ps + +# Builds, (re)creates, starts, and attaches to containers for a service. +docker compose up + +# Stops containers and removes containers, networks, volumes, and images created by up. +docker compose down +``` + +## Install (build and run) CKAN plus dependencies +### Base mode Use this if you are a maintainer and will not be making code changes to CKAN or to CKAN extensions Copy the included `.env.example` and rename it to `.env`. Modify it depending on your own needs. -Please note that when accessing CKAN directly (via a browser) ie: not going through NGINX you will need to make sure you have "ckan" set up -to be an alias to localhost in the local hosts file. Either that or you will need to change the `.env` entry for CKAN_SITE_URL +>*Note**:
+> Please note that when accessing CKAN directly (via a browser) ie: not going through NGINX you will need to make sure you have "ckan" set up to be an alias to localhost in the local hosts file. Either that or you will need to change the `.env` entry for `CKAN_SITE_URL` Using the default values on the `.env.example` file will get you a working CKAN instance. There is a sysadmin user created by default with the values defined in `CKAN_SYSADMIN_NAME` and `CKAN_SYSADMIN_PASSWORD`(`ckan_admin` and `test1234` by default). This should be obviously changed before running this setup as a public CKAN instance. @@ -70,6 +145,9 @@ This will start up the containers in the current window. By default the containe using a different colour. You could also use the -d "detach mode" option ie: `docker compose up -d` if you wished to use the current window for something else. +>**Note**
+> Or `docker compose up --build` to build & up the containers. + At the end of the container start sequence there should be 6 containers running ![Screenshot 2022-12-12 at 10 36 21 am](https://user-images.githubusercontent.com/54408245/207012236-f9571baa-4d99-4ffe-bd93-30b11c4829e0.png) @@ -77,11 +155,10 @@ At the end of the container start sequence there should be 6 containers running After this step, CKAN should be running at `CKAN_SITE_URL`. -#### Development mode - +### Development mode Use this mode if you are making code changes to CKAN and either creating new extensions or making code changes to existing extensions. This mode also uses the `.env` file for config options. -To develop local extensions use the `docker-compose.dev.yml` file: +To develop local extensions use the `docker compose.dev.yml` file: To build the images: @@ -93,13 +170,20 @@ To start the containers: See [CKAN Images](#ckan-images) for more details of what happens when using development mode. +**docker/docker compose commands** + * `docker compose [-f ] up -d --build`: to build & up all the containers. + * `docker compose [-f ] build --no-cache`: to avoid using a cache of the previous build while creating a new image. + * `docker compose -p up -d --build`: to build a project with a specific Docker Compose prefix. + * `docker compose restart `: to restart only a specific container. + * `docker compose rm`: to remove all docker compose project. + * `docker compose [-p ] down`: to down all containers + * `docker logs --since 60s -f `: to display the logs of a container for the last n seconds. -##### Create an extension - +#### Create an extension You can use the ckan [extension](https://docs.ckan.org/en/latest/extensions/tutorial.html#creating-a-new-extension) instructions to create a CKAN extension, only executing the command inside the CKAN container and setting the mounted `src/` folder as output: - docker compose -f docker-compose.dev.yml exec ckan-dev /bin/sh -c "ckan generate extension --output-dir /srv/app/src_extensions" + docker compose -f docker compose.dev.yml exec ckan-dev /bin/sh -c "ckan generate extension --output-dir /srv/app/src_extensions" ![Screenshot 2023-02-22 at 1 45 55 pm](https://user-images.githubusercontent.com/54408245/220623568-b4e074c7-6d07-4d27-ae29-35ce70961463.png) @@ -107,11 +191,9 @@ You can use the ckan [extension](https://docs.ckan.org/en/latest/extensions/tuto The new extension files and directories are created in the `/srv/app/src_extensions/` folder in the running container. They will also exist in the local src/ directory as local `/src` directory is mounted as `/srv/app/src_extensions/` on the ckan container. You might need to change the owner of its folder to have the appropiate permissions. -## 5. CKAN images +## CKAN images ![ckan images](https://user-images.githubusercontent.com/54408245/207079416-a01235af-2dea-4425-b6fd-f8c3687dd993.png) - - The Docker image config files used to build your CKAN project are located in the `ckan/` folder. There are two Docker files: * `Dockerfile`: this is based on `ckan/ckan-base:`, a base image located in the DockerHub repository, that has CKAN installed along with all its dependencies, properly configured and running on [uWSGI](https://uwsgi-docs.readthedocs.io/en/latest/) (production setup) @@ -122,21 +204,20 @@ The Docker image config files used to build your CKAN project are located in the * Make sure to add the local plugins to the `CKAN__PLUGINS` env var in the `.env` file. -## 6. Extending the base images - +## CKAN images enhancement +### Extending the base images You can modify the docker files to build your own customized image tailored to your project, installing any extensions and extra requirements needed. For example here is where you would update to use a different CKAN base image ie: `ckan/ckan-base:` To perform extra initialization steps you can add scripts to your custom images and copy them to the `/docker-entrypoint.d` folder (The folder should be created for you when you build the image). Any `*.sh` and `*.py` file in that folder will be executed just after the main initialization script ([`prerun.py`](https://github.com/ckan/ckan-docker-base/blob/main/ckan-2.9/base/setup/prerun.py)) is executed and just before the web server and supervisor processes are started. For instance, consider the following custom image: -``` +```bash ckan ├── docker-entrypoint.d │ └── setup_validation.sh ├── Dockerfile └── Dockerfile.dev - ``` We want to install an extension like [ckanext-validation](https://github.com/frictionlessdata/ckanext-validation) that needs to create database tables on startup time. We create a `setup_validation.sh` script in a `docker-entrypoint.d` folder with the necessary commands: @@ -161,8 +242,8 @@ COPY docker-entrypoint.d/* /docker-entrypoint.d/ NB: There are a number of extension examples commented out in the Dockerfile.dev file -## 7. Applying patches +### Applying 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 @@ -170,7 +251,7 @@ the images. The patches will be applied in alphabetical order, so you can prefix For instance, check the following example image folder: -``` +```bash ckan ├── patches │ ├── ckan @@ -185,9 +266,19 @@ ckan ``` -## 8. pdb +>**Note**: +> Git diff is a command to output the changes between two sources inside the Git repository. The data sources can be two different branches, commits, files, etc. +> * Show changes between working directory and staging area +> `git diff > mypatch.patch` +> * -Add these lines to the `ckan-dev` service in the docker-compose.dev.yml file + +## ckan-docker addons +### VSCode dev containers +TODO: Info + +### pdb +Add these lines to the `ckan-dev` service in the docker compose.dev.yml file ![pdb](https://user-images.githubusercontent.com/54408245/179964232-9e98a451-5fe9-4842-ba9b-751bcc627730.png) @@ -195,21 +286,20 @@ Debug with pdb (example) - Interact with `docker attach $(docker container ls -q command: `python -m pdb /usr/lib/ckan/venv/bin/ckan --config /srv/app/ckan.ini run --host 0.0.0.0 --passthrough-errors` -## 9. Datastore and datapusher -The Datastore database and user is created as part of the entrypoint scripts for the db container. There is also a Datapusher container -running the latest version of Datapusher. +### Datastore and datapusher +The Datastore database and user is created as part of the entrypoint scripts for the db container. There is also a Datapusher container running the latest version of Datapusher. -## 10. NGINX +### NGINX The base Docker Compose configuration uses an NGINX image as the front-end (ie: reverse proxy). It includes HTTPS running on port number 8443 and an HTTP port (81). A "self-signed" SSL certificate is generated beforehand and the server certificate and key files are included. The NGINX `server_name` directive and the `CN` field in the SSL certificate have been both set to 'localhost'. This should obviously not be used for production. Creating the SSL cert and key files as follows: `openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=DE/ST=Berlin/L=Berlin/O=None/CN=localhost" -keyout ckan-local.key -out ckan-local.crt` The `ckan-local.*` files will then need to be moved into the nginx/setup/ directory -## 11. envvars +### envvars The ckanext-envvars extension is used in the CKAN Docker base repo to build the base images. This extension checks for environmental variables conforming to an expected format and updates the corresponding CKAN config settings with its value. @@ -227,3 +317,19 @@ For example: These parameters can be added to the `.env` file For more information please see [ckanext-envvars](https://github.com/okfn/ckanext-envvars) + + +### ckan-pycsw +[ckan-pycsw](https://github.com/mjanez/ckan-pycsw) is a docker compose environment (based on pycsw) for development and testing with CKAN Open Data portals.[^4] + +Docker compose environment (based on [pycsw](https://github.com/geopython/pycsw)) for development and testing with CKAN Open Data portals. + +Available components: +* **pycsw**: The pycsw app. An [OARec](https://ogcapi.ogc.org/records) and [OGC CSW](https://opengeospatial.org/standards/cat) server implementation written in Python. +* **ckan2pycsw**: Software to achieve interoperability with the open data portals based on CKAN. To do this, ckan2pycsw reads data from an instance using the CKAN API, generates ISO-19115/ISO-19139 metadata using [pygeometa](https://geopython.github.io/pygeometa/), and populates a [pycsw](https://pycsw.org/) instance that exposes the metadata using CSW and OAI-PMH. + + +[^1]: Development environment. +[^2]: Production environment. +[^3]: [ckan_geodcatap](https://github.com/mjanez/ckanext-scheming/blob/036b8c6503059e0d42b0eba180d5bd39205c64a3/ckanext/scheming/ckan_geodcatap.yaml), more info: https://github.com/mjanez/ckanext-scheming/pull/1 +[^4]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. \ No newline at end of file diff --git a/ckan/Dockerfile.dev b/ckan/Dockerfile.dev index 071db29..5098db1 100644 --- a/ckan/Dockerfile.dev +++ b/ckan/Dockerfile.dev @@ -1,11 +1,14 @@ FROM ckan/ckan-base:ckan-2.10.0-dev - # Set up environment variables ENV APP_DIR=/srv/app ENV TZ=UTC RUN echo ${TZ} > /etc/timezone +# Set up PROJ +# PROJ4 for ckanext-spatial: https://github.com/pyproj4/pyproj/issues/582 // https://github.com/nickumia-reisys/ckanext-geodatagov/commit/ed61ffdd118e21e7a1db482c75738c3f261aa180 +RUN apk add geos-dev proj proj-util proj-dev + # Make sure both files are not exactly the same RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\ @@ -26,42 +29,71 @@ RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ # pip3 install -r ${APP_DIR}/src/ckanext-xloader/requirements.txt && \ # pip3 install -U requests[security] + +###TODO: XLoader ### +#RUN pip3 install -e 'git+https://github.com/ckan/ckanext-xloader.git@master#egg=ckanext-xloader' && \ +# pip3 install -r ${APP_DIR}/src/ckanext-xloader/requirements.txt && \ +# pip3 install -U requests[security] + ### Harvester ### -RUN pip3 install -e 'git+https://github.com/ckan/ckanext-harvest.git@master#egg=ckanext-harvest' && \ +RUN echo "ckan/ckanext-harvester" && \ + pip3 install -e 'git+https://github.com/ckan/ckanext-harvest.git@master#egg=ckanext-harvest' && \ pip3 install -r ${APP_DIR}/src/ckanext-harvest/pip-requirements.txt # will also require gather_consumer and fetch_consumer processes running (please see https://github.com/ckan/ckanext-harvest) - -### resourcedictionary ### -RUN pip3 install -e 'git+https://github.com/keitaroinc/ckanext-resourcedictionary.git#egg=ckanext-resourcedictionary' && \ +### Resource dictionary-Fix version ### +RUN echo "mjanez/ckanext-resourcedictionary" && \ + pip3 install -e git+https://github.com/mjanez/ckanext-resourcedictionary.git#egg=ckanext-resourcedictionary && \ pip3 install -r ${APP_DIR}/src/ckanext-resourcedictionary/requirements.txt ### Geoview ### - RUN pip3 install -e git+https://github.com/ckan/ckanext-geoview.git#egg=ckanext-geoview +RUN echo "ckan/ckanext-geoview" && \ + pip3 install -e git+https://github.com/ckan/ckanext-geoview.git#egg=ckanext-geoview -### Spatial ### -# RUN pip3 install -e git+https://github.com/ckan/ckanext-spatial.git#egg=ckanext-spatial && \ -# pip3 install -r ${APP_DIR}/src/ckanext-spatial/pip-requirements.txt +### Spatial ### Check solr geoindexing: https://docs.ckan.org/projects/ckanext-spatial/en/latest/spatial-search.html // https://github.com/ckan/ckanext-spatial/issues/195 +#TODO: 2.10 support reqs: https://github.com/ckan/ckanext-spatial/pull/308 +RUN echo "ckan/ckanext-spatial" && \ + pip3 install -e git+https://github.com/ckan/ckanext-spatial.git#egg=ckanext-spatial && \ + pip3 install -r https://raw.githubusercontent.com/ckan/ckanext-spatial/bae9290395b252ee8e40056256fa694569d1d78b/requirements.txt -### Scheming ### -#RUN pip3 install -e 'git+https://github.com/ckan/ckanext-scheming.git@master#egg=ckanext-scheming' +### Scheming-GeoDCAT-AP extended version ### +RUN echo "mjanez/ckanext-scheming (GeoDCAT-AP extended version)" && \ + pip3 install -e git+https://github.com/mjanez/ckanext-scheming.git#egg=ckanext-scheming && \ + # update CKAN config with ckanext-scheming parameters + ckan config-tool ${CKAN_INI} "scheming.dataset_schemas=''" && \ + ckan config-tool ${CKAN_INI} "scheming.group_schemas=''" && \ + ckan config-tool ${CKAN_INI} "scheming.organization_schemas=''" && \ + ckan config-tool ${CKAN_INI} "scheming.presets=''" ### Pages ### -RUN pip3 install -e git+https://github.com/ckan/ckanext-pages.git#egg=ckanext-pages +RUN echo "ckan/ckanext-pages" && \ + pip3 install -e git+https://github.com/ckan/ckanext-pages.git#egg=ckanext-pages ### PDFView ### -RUN pip3 install -e git+https://github.com/ckan/ckanext-pdfview.git#egg=ckanext-pdfview +RUN echo "ckan/ckanext-pdfview" && \ + pip3 install -e git+https://github.com/ckan/ckanext-pdfview.git#egg=ckanext-pdfview -### DCAT ### -#RUN pip3 install -e git+https://github.com/ckan/ckanext-dcat.git@v0.0.6#egg=ckanext-dcat && \ -# pip3 install -r https://raw.githubusercontent.com/ckan/ckanext-dcat/v0.0.6/requirements.txt +### DCAT-GeoDCAT-AP extended version ### +RUN echo "mjanez/ckanext-dcat (GeoDCAT-AP extended version)" && \ + pip3 install -e git+https://github.com/mjanez/ckanext-dcat.git#egg=ckanext-dcat && \ + pip3 install -r https://raw.githubusercontent.com/mjanez/ckanext-dcat/master/requirements.txt + +# ###TODO: SPARQL Interface - Adapt to Py3### +# RUN echo "mjanez/sparql (Fixed version)" && \ +# pip3 install -e git+https://github.com/mjanez/ckanext-sparql.git#egg=ckanext-sparql && \ +# pip3 install -r ${APP_DIR}/src/ckanext-sparql/requirements.txt && \ +# # update CKAN config with ckanext-sparql parameters +# ckan config-tool ${CKAN_INI} "ckanext.sparql.endpoint_url=''" && \ +# ckan config-tool ${CKAN_INI} "ckanext.sparql.hide_endpoint_url=''" # Clone the extension(s) your are writing for your own project in the `src` folder # to get them mounted in this image at runtime +# Used to configure the container environment by setting environment variables, creating users, running initialization scripts, .etc +COPY docker-entrypoint.d/* /docker-entrypoint.d/ + # Apply any patches needed to CKAN core or any of the built extensions (not the # runtime mounted ones) - COPY patches ${APP_DIR}/patches RUN for d in $APP_DIR/patches/*; do \ @@ -70,4 +102,4 @@ RUN for d in $APP_DIR/patches/*; do \ cd $SRC_DIR/`basename "$d"` && echo "$0: Applying patch $f to $SRC_DIR/`basename $d`"; patch -p1 < "$f" ; \ done ; \ fi ; \ - done + done \ No newline at end of file diff --git a/ckan/docker-entrypoint.d/setup_scheming.sh b/ckan/docker-entrypoint.d/setup_scheming.sh new file mode 100644 index 0000000..8116e3c --- /dev/null +++ b/ckan/docker-entrypoint.d/setup_scheming.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Update ckanext-scheming settings defined in the env var +echo "Loading ckanext-scheming settings into ckan.ini" +ckan config-tool $CKAN_INI \ + "scheming.dataset_schemas=$SCHEMA_CKANEXT_SCHEMING_DATASET_SCHEMA" \ + "scheming.group_schemas=$SCHEMA_CKANEXT_SCHEMING_GROUP_SCHEMAS" \ + "scheming.organization_schemas=$SCHEMA_CKANEXT_SCHEMING_ORGANIZATION_SCHEMAS" \ + "scheming.presets=$SCHEMA_CKANEXT_SCHEMING_PRESETS" \ No newline at end of file diff --git a/ckan/patches/ckan/00_spatial_widget_dataset.patch b/ckan/patches/ckan/00_spatial_widget_dataset.patch new file mode 100644 index 0000000..6885402 --- /dev/null +++ b/ckan/patches/ckan/00_spatial_widget_dataset.patch @@ -0,0 +1,14 @@ +--- /ckan/templates/package/read_base.html ++++ /ckan/templates/package/read_base.html +@@ -23,6 +23,12 @@ + {% endblock %} + + {% block secondary_content %} ++ {{ super() }} ++ ++ {% set dataset_extent = pkg.spatial %} ++ {% if dataset_extent %} ++ {% snippet "spatial/snippets/dataset_map_sidebar.html", extent=dataset_extent %} ++ {% endif %} + + {% block secondary_help_content %}{% endblock %} \ No newline at end of file diff --git a/ckan/patches/ckan/01_spatial_widget_search.patch b/ckan/patches/ckan/01_spatial_widget_search.patch new file mode 100644 index 0000000..6f660f0 --- /dev/null +++ b/ckan/patches/ckan/01_spatial_widget_search.patch @@ -0,0 +1,10 @@ +--- /ckan/templates/package/search.html ++++ /ckan/templates/package/search.html +@@ -70,6 +70,7 @@ + + + {% block secondary_content %} ++{% snippet "spatial/snippets/spatial_query.html", default_extent="[[26.78,-19.21], [44.08, 5.66]]" %} +
+
+ {% for facet in facet_titles %} \ No newline at end of file From b7d90a82c4e93e632d8105cf0e6b2c441e57918c Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Fri, 17 Mar 2023 12:03:42 +0000 Subject: [PATCH 03/34] Update README and samples folder --- README.md | 40 ++-- .env.example => samples/.env.example | 0 samples/ckan.ini.example | 288 +++++++++++++++++++++++++++ 3 files changed, 314 insertions(+), 14 deletions(-) rename .env.example => samples/.env.example (100%) create mode 100644 samples/ckan.ini.example diff --git a/README.md b/README.md index 85b84b7..b7da272 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,9 @@ Applying patchesAddons

-[](#ckan-images) **Requirements**: -* Linux 64 bit system - ->**Note**
-> Tested successfully on **Debian GNU/Linux 11 (bullseye)** +* [Docker](https://docs.docker.com/get-docker/) ## Overview Contains Docker images for the different components of CKAN Cloud and a Docker compose environment (based on [ckan](https://github.com/ckan/ckan)) for development and testing Open Data portals. @@ -266,16 +262,34 @@ ckan ``` ->**Note**: +>**Note**:
> Git diff is a command to output the changes between two sources inside the Git repository. The data sources can be two different branches, commits, files, etc. -> * Show changes between working directory and staging area -> `git diff > mypatch.patch` -> * +> * Show changes between working directory and staging area: +> `git diff > [file.patch]` +> * Shows any changes between the staging area and the repository: +> `git diff --staged [file]` ## ckan-docker addons ### VSCode dev containers -TODO: Info +The [Visual Studio Code Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers) extension is a powerful tool that enables developers to use a container as a complete development environment. With this extension, developers can open any folder inside a container and take advantage of the full range of features provided by Visual Studio Code. To do this, developers create a `devcontainer.json `file in their project that specifies how to access or create a development container with a predefined tool and runtime stack. This allows developers to work in an isolated environment, ensuring that the development environment is consistent across team members and that project dependencies are easy to manage. + +![Developing inside a Container](https://code.visualstudio.com/assets/docs/devcontainers/containers/architecture-containers.png) + +1. Install [VSCode](https://code.visualstudio.com/). + +1. Install the[ Remote Development extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) for VSCode. + +3. In your project directory, create a file named `devcontainer.json.` This file will contain the configuration for your `dev container`. + +4. In the `devcontainer.json` file, specify the Docker image that you want to use for your `dev container`. + +5. Specify any additional configuration settings for your `dev container`, such as environment variables, ports to expose, and startup commands. + +6. Open your project in a `dev container` by using the Remote Development extension in VSCode. You can do this by clicking the `Open Folder in Container` button in the command palette or by opening the folder using the `Remote-Containers: Open Folder in Container` command. Also you can attach to an active container `Attach to Running Container`. + +7. VSCode will start a new container based on the configuration settings in your `devcontainer.json` file. Once the container is started, you can work on your project just like you would on your local machine. + ### pdb Add these lines to the `ckan-dev` service in the docker compose.dev.yml file @@ -320,13 +334,11 @@ For more information please see [ckanext-envvars](https://github.com/okfn/ckanex ### ckan-pycsw -[ckan-pycsw](https://github.com/mjanez/ckan-pycsw) is a docker compose environment (based on pycsw) for development and testing with CKAN Open Data portals.[^4] - -Docker compose environment (based on [pycsw](https://github.com/geopython/pycsw)) for development and testing with CKAN Open Data portals. +[ckan-pycsw](https://github.com/mjanez/ckan-pycsw) is a docker compose environment (based on [pycsw](https://github.com/geopython/pycsw)) for development and testing with CKAN Open Data portals.[^4] Available components: * **pycsw**: The pycsw app. An [OARec](https://ogcapi.ogc.org/records) and [OGC CSW](https://opengeospatial.org/standards/cat) server implementation written in Python. -* **ckan2pycsw**: Software to achieve interoperability with the open data portals based on CKAN. To do this, ckan2pycsw reads data from an instance using the CKAN API, generates ISO-19115/ISO-19139 metadata using [pygeometa](https://geopython.github.io/pygeometa/), and populates a [pycsw](https://pycsw.org/) instance that exposes the metadata using CSW and OAI-PMH. +* **ckan2pycsw**: Software to achieve interoperability with the open data portals based on CKAN. To do this, ckan2pycsw reads data from an instance using the CKAN API, generates ISO-19115/ISO-19139 metadata using [pygeometa](https://geopython.github.io/pygeometa/), or a custom schema that is based on a customized CKAN schema, and populates a [pycsw](https://pycsw.org/) instance that exposes the metadata using CSW and OAI-PMH. [^1]: Development environment. diff --git a/.env.example b/samples/.env.example similarity index 100% rename from .env.example rename to samples/.env.example diff --git a/samples/ckan.ini.example b/samples/ckan.ini.example new file mode 100644 index 0000000..618582b --- /dev/null +++ b/samples/ckan.ini.example @@ -0,0 +1,288 @@ +# +# CKAN - Pylons configuration +# +# These are some of the configuration options available for your CKAN +# instance. Check the documentation in 'doc/configuration.rst' or at the +# following URL for a description of what they do and the full list of +# available options: +# +# http://docs.ckan.org/en/latest/maintaining/configuration.html +# +# The %(here)s variable will be replaced with the parent directory of this file +# + +[DEFAULT] + +# WARNING: *THIS SETTING MUST BE SET TO FALSE ON A PUBLIC ENVIRONMENT* +# With debug mode enabled, a visitor to your site could execute malicious commands. +debug = false + +[app:main] +use = egg:ckan + +## Development settings +ckan.devserver.host = localhost +ckan.devserver.port = 5000 + + +## Session settings +cache_dir = /tmp/%(ckan.site_id)s/ +beaker.session.key = ckan + +# This is the secret token that the beaker library uses to hash the cookie sent +# to the client. `ckan generate config` generates a unique value for this each +# time it generates a config file. +beaker.session.secret = acZN6lm5UYE_8A6uEYGIBx0KL + +# `ckan generate config` generates a unique value for this each time it generates +# a config file. +app_instance_uuid = 32ceaae1-9cfa-4d31-ab19-9baf339d2bdd + +# repoze.who config +who.config_file = %(here)s/who.ini +who.log_level = warning +who.log_file = %(cache_dir)s/who_log.ini +# Session timeout (user logged out after period of inactivity, in seconds). +# Inactive by default, so the session doesn't expire. +# who.timeout = 86400 + +## Database Settings +sqlalchemy.url = postgresql://ckan:ckan@localhost/ckan_default + +ckan.datastore.write_url = postgresql://ckan:ckan@localhost/datastore_default +ckan.datastore.read_url = postgresql://datastore_ro:datastore@localhost/datastore_default + +# PostgreSQL' full-text search parameters +ckan.datastore.default_fts_lang = english +ckan.datastore.default_fts_index_method = gist + +## Site Settings +ckan.site_url = http://localhost:5000/ +#ckan.root_path = /catalog/{{LANG}} +#ckan.use_pylons_response_cleanup_middleware = true + +# Default timeout for Requests +#ckan.requests.timeout = 10 + +## Authorization Settings +ckan.auth.anon_create_dataset = false +ckan.auth.create_unowned_dataset = false +ckan.auth.create_dataset_if_not_in_organization = false +ckan.auth.user_create_groups = false +ckan.auth.user_create_organizations = false +ckan.auth.user_delete_groups = true +ckan.auth.user_delete_organizations = true +ckan.auth.create_user_via_api = false +ckan.auth.create_user_via_web = false +ckan.auth.roles_that_cascade_to_sub_groups = admin +ckan.auth.public_user_details = true +ckan.auth.public_activity_stream_detail = true +ckan.auth.allow_dataset_collaborators = false +ckan.auth.create_default_api_keys = false + +## API Token Settings +api_token.nbytes = 60 +api_token.jwt.encode.secret = string:acZN6lm5UYE_8A6uEYGIBx0KL +api_token.jwt.decode.secret = string:acZN6lm5UYE_8A6uEYGIBx0KL +api_token.jwt.algorithm = HS256 + +## API Token: expire_api_token plugin +expire_api_token.default_lifetime = 3600 + +## Search Settings + +ckan.site_id = default +#solr_url = http://127.0.0.1:8983/solr + + +## Redis Settings + +# URL to your Redis instance, including the database to be used. +#ckan.redis.url = redis://localhost:6379/0 + + +## CORS Settings + +# If cors.origin_allow_all is true, all origins are allowed. +# If false, the cors.origin_whitelist is used. +# ckan.cors.origin_allow_all = true +# cors.origin_whitelist is a space separated list of allowed domains. +# ckan.cors.origin_whitelist = http://example1.com http://example2.com + + +## Plugins Settings + +# Note: Add ``datastore`` to enable the CKAN DataStore +# Add ``datapusher`` to enable DataPusher +# Add ``resource_proxy`` to enable resorce proxying and get around the +# same origin policy +ckan.plugins = stats text_view image_view recline_view resourcedictionary datastore datapusher harvest ckan_harvester spatial_metadata spatial_query spatial_harvest_metadata_api csw_harvester waf_harvester doc_harvester resource_proxy geo_view geojson_view wmts_view shp_view dcat dcat_rdf_harvester dcat_json_harvester dcat_json_interface scheming_datasets scheming_groups scheming_organizations pdf_view pages + + +## ckanext-scheming +# module-path:file to schemas being used +scheming.dataset_schemas = ckanext.scheming:ckan_geodcatap.yaml + +# For group and organization schemas (replace myplugin with your custom plugin) +scheming.group_schemas = ckanext.scheming:ckan_group_geodcatap.json +scheming.organization_schemas = ckanext.scheming:ckan_org_geodcatap.json + +# Preset files may be included as well. The default preset setting is: +scheming.presets = ckanext.scheming:presets.json + + +## ckanext-dcat +ckanext.dcat.base_uri = http://localhost:5000 +ckanext.dcat.rdf.profiles = euro_dcat_ap_2 euro_dcat_ap + +## ckanext-spatial +ckanext.spatial.search_backend = solr-bbox +ckan.spatial.srid = 3857 +ckanext.spatial.common_map.type = custom +ckanext.spatial.common_map.custom.url = https://rts.larioja.org/mapa-base/rioja/{z}/{x}/{y}.png +ckanext.spatial.common_map.attribution = Servicios de Teselas. IDEE, bajo CC BY 3.0. + +# ckanext-harvest +ckan.harvest.mq.type = redis +ckan.harvest.mq.hostname = redis + +# Define which views should be created by default +# (plugins must be loaded in ckan.plugins) +ckan.views.default_views = image_view text_view recline_view harvest ckan_harvester wmts_view geojson_view geo_view shp_view pdf_view +ckanext.geoview.geojson.max_file_size = 100000000 +ckanext.geoview.ol_viewer.formats = wms wfs geojson gml kml +ckanext.geoview.shp_viewer.srid = 3857 +ckanext.geoview.shp_viewer.encoding = UTF-8 + +# Customize which text formats the text_view plugin will show +ckan.preview.json_formats = json jsonld +ckan.preview.xml_formats = xml rdf rdf+xml owl+xml atom rss turtle ttl n3 +ckan.preview.text_formats = text plain text/plain text/turtle + +# Customize which image formats the image_view plugin will show +#ckan.preview.image_formats = png jpeg jpg gif + +## Front-End Settings + +ckan.site_title = CKAN +ckan.site_logo = /base/images/ckan-logo.png +ckan.site_description = +ckan.favicon = /base/images/ckan.ico +ckan.gravatar_default = identicon +ckan.preview.direct = png jpg gif +ckan.preview.loadable = html htm rdf+xml owl+xml xml n3 n-triples turtle plain atom csv tsv rss txt json +ckan.display_timezone = server + +# package_hide_extras = for_search_index_only +#package_edit_return_url = http://another.frontend/dataset/ +#package_new_return_url = http://another.frontend/dataset/ +#ckan.recaptcha.publickey = +#ckan.recaptcha.privatekey = +#licenses_group_url = http://licenses.opendefinition.org/licenses/groups/ckan.json +# ckan.template_footer_end = + + +## Internationalisation Settings +ckan.locale_default = es +ckan.locale_order = es en pt_BR ja it cs_CZ ca fr el sv sr sr@latin no sk fi ru de pl nl bg ko_KR hu sa sl lv +ckan.locales_offered = +ckan.locales_filtered_out = en_GB + +## Feeds Settings + +ckan.feeds.authority_name = +ckan.feeds.date = +ckan.feeds.author_name = +ckan.feeds.author_link = + +## Storage Settings + +#ckan.storage_path = /var/lib/ckan +#ckan.max_resource_size = 10 +#ckan.max_image_size = 2 + +## Webassets Settings +#ckan.webassets.use_x_sendfile = false +#ckan.webassets.path = /var/lib/ckan/webassets + + +## Datapusher settings + +# Make sure you have set up the DataStore +ckan.datapusher.api_token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJ6ODViRDNEc1BRLUFGNHVqVEJTM2p4SmNGREJnY2kxRlFrV2I5aDhWNUNNZ09BMGZ5ZDZzUnFxRWQzMTk4OGlFY1h3Wndkcjc5ZFRZNy1JZyIsImlhdCI6MTY2OTE5Mzg3MX0.sfbkYDI_n_syYhBO3kt3NRZpzE5no6ey8M6E5jWMCGE +ckan.datapusher.formats = csv xls xlsx tsv application/csv application/vnd.ms-excel application/vnd.openxmlformats-officedocument.spreadsheetml.sheet +ckan.datapusher.url = http://127.0.0.1:8800/ +ckan.datapusher.callback_url_base = http://127.0.0.1:8800/ +#ckan.datapusher.assume_task_stale_after = 3600 + +# Resource Proxy settings +# Preview size limit, default: 1MB +ckan.resource_proxy.max_file_size = 50048576 +# Size of chunks to read/write. +ckan.resource_proxy.chunk_size = 4096 +# Default timeout for fetching proxied items +ckan.resource_proxy.timeout = 1000 + +## Activity Streams Settings + +#ckan.activity_streams_enabled = true +#ckan.activity_list_limit = 31 +#ckan.activity_streams_email_notifications = true +#ckan.email_notifications_since = 2 days +ckan.hide_activity_from_users = %(ckan.site_id)s + + +## Email settings + +#email_to = errors@example.com +#error_email_from = ckan-errors@example.com +#smtp.server = localhost +#smtp.starttls = False +#smtp.user = username@example.com +#smtp.password = your_password +#smtp.mail_from = +#smtp.reply_to = + +## Background Job Settings +ckan.jobs.timeout = 180 + +## Logging configuration +[loggers] +keys = root, ckan, ckanext, werkzeug + +[handlers] +keys = console + +[formatters] +keys = generic + +[logger_root] +level = WARNING +handlers = console + +[logger_werkzeug] +level = WARNING +handlers = console +qualname = werkzeug +propagate = 0 + +[logger_ckan] +level = INFO +handlers = console +qualname = ckan +propagate = 0 + +[logger_ckanext] +level = DEBUG +handlers = console +qualname = ckanext +propagate = 0 + +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic + +[formatter_generic] +format = %(asctime)s %(levelname)-5.5s [%(name)s] %(message)s \ No newline at end of file From 87fc684ab05d68b89196f4dd542ee80fa94cca39 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Fri, 17 Mar 2023 12:07:28 +0000 Subject: [PATCH 04/34] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7da272..cd27b7d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

CKAN Docker Compose - Open Data & GIS

-CKAN VersionsLicense: MIT +CKAN Versions

From 9af99bfba80c6abc3932fe523a6d6834c195a5a6 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Fri, 17 Mar 2023 12:17:23 +0000 Subject: [PATCH 05/34] Improve docker compose reference --- README.md | 56 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index cd27b7d..a0ea333 100644 --- a/README.md +++ b/README.md @@ -96,26 +96,49 @@ docker network prune # Clear unused networks More info about Docker Compose commands at [docker compose reference](https://docs.docker.com/compose/reference/). ```bash -# Starts existing containers for a service. -docker compose start +# Basic. All containers or specific container: +## Starts existing containers for a service. +docker compose start -# Stops running containers without removing them. -docker compose stop +## Restarts existing containers/container for a service. +docker compose restart -# Pauses running containers of a service. -docker compose pause +## Stops running containers without removing them. +docker compose stop -# Unpauses paused containers of a service. -docker compose unpause +## Pauses running containers of a service. +docker compose pause -# Lists containers. +## Unpauses paused containers of a service. +docker compose unpause + +# Display the logs of a container. Is it possible to retrieve only the last n seconds or other +docker logs [--since 60s] -f + +## Lists containers. docker compose ps -# Builds, (re)creates, starts, and attaches to containers for a service. -docker compose up +## Remove all docker compose project +docker compose rm + +# Build. +## Builds, (re)creates, starts, and attaches to containers for a service. +docker compose [-f ] up + +## Build & up all the containers. +docker compose [-f ] up -d --build + +## To avoid using a cache of the previous build while creating a new image. +docker compose [-f ] build --no-cache + +## Build a project with a specific Docker Compose prefix. +docker compose [-f ] -p up -d --build + + +# Down # Stops containers and removes containers, networks, volumes, and images created by up. -docker compose down +docker compose [-p ] down ``` ## Install (build and run) CKAN plus dependencies @@ -166,15 +189,6 @@ To start the containers: See [CKAN Images](#ckan-images) for more details of what happens when using development mode. -**docker/docker compose commands** - * `docker compose [-f ] up -d --build`: to build & up all the containers. - * `docker compose [-f ] build --no-cache`: to avoid using a cache of the previous build while creating a new image. - * `docker compose -p up -d --build`: to build a project with a specific Docker Compose prefix. - * `docker compose restart `: to restart only a specific container. - * `docker compose rm`: to remove all docker compose project. - * `docker compose [-p ] down`: to down all containers - * `docker logs --since 60s -f `: to display the logs of a container for the last n seconds. - #### Create an extension You can use the ckan [extension](https://docs.ckan.org/en/latest/extensions/tutorial.html#creating-a-new-extension) instructions to create a CKAN extension, only executing the command inside the CKAN container and setting the mounted `src/` folder as output: From 64195b52e8d7e6c9056900b874bc1fd526d78b3a Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Fri, 17 Mar 2023 12:30:01 +0000 Subject: [PATCH 06/34] Add warning info about this repo --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index a0ea333..56f3047 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,7 @@ The non-CKAN images are as follows: The site is configured using environment variables that you can set in the `.env` file. >**Warning**:
-> This is the **install from Docker Compose**. To see the install from source, check it out: [`ckan/doc/repository/installations/ckan_source.md`](https://github.com/OpenDataGIS/ckan/blob/16dbe5da5ca0fd28d595ba2049e4d47e52c40c0f/doc/repository/installations/ckan_source.md) - +>This is a **custom installation of Docker Compose** with specific extensions for spatial data and [GeoDCAT-AP](https://github.com/SEMICeu/GeoDCAT-AP)/[INSPIRE](https://github.com/INSPIRE-MIF/technical-guidelines) metadata [profiles](https://en.wikipedia.org/wiki/Geospatial_metadata). For official installations, please have a look: CKAN documentation: Installation ### ckan-docker roadmap Information about extensions installed in the `main` image. More info described in the [Extending the base images](#extending-the-base-images) From 309078d3e546002de66bce3474063c64bd1af3b5 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Fri, 17 Mar 2023 12:31:35 +0000 Subject: [PATCH 07/34] Fix link to CKAN Docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 56f3047..51e1b34 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The non-CKAN images are as follows: The site is configured using environment variables that you can set in the `.env` file. >**Warning**:
->This is a **custom installation of Docker Compose** with specific extensions for spatial data and [GeoDCAT-AP](https://github.com/SEMICeu/GeoDCAT-AP)/[INSPIRE](https://github.com/INSPIRE-MIF/technical-guidelines) metadata [profiles](https://en.wikipedia.org/wiki/Geospatial_metadata). For official installations, please have a look: CKAN documentation: Installation +>This is a **custom installation of Docker Compose** with specific extensions for spatial data and [GeoDCAT-AP](https://github.com/SEMICeu/GeoDCAT-AP)/[INSPIRE](https://github.com/INSPIRE-MIF/technical-guidelines) metadata [profiles](https://en.wikipedia.org/wiki/Geospatial_metadata). For official installations, please have a look: [CKAN documentation: Installation](https://docs.ckan.org/en/latest/maintaining/installing/index.html). ### ckan-docker roadmap Information about extensions installed in the `main` image. More info described in the [Extending the base images](#extending-the-base-images) From de7d05e8de30ece81705c6bfcb254f8df1d70b35 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Fri, 17 Mar 2023 12:32:46 +0000 Subject: [PATCH 08/34] Update message ckan-pycsw --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 51e1b34..4466221 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Information about extensions installed in the `main` image. More info described | Extension | [ckanext-resourcedictionary](https://github.com/OpenDataGIS/ckanext-resourcedictionary) | main | Completed | ✔️ | ✔️ | Stable installation. This extension extends the default CKAN Data Dictionary functionality by adding possibility to create data dictionary before actual data is uploaded to datastore. | | Extension | [ckanext-pages](https://github.com/ckan/ckanext-pages) | 0.5.1 | Completed | ✔️ | ✔️ | Stable installation. This extension gives you an easy way to add simple pages to CKAN. | | Extension | [ckanext-pdfview](https://github.com/ckan/ckanext-pdfview) | 0.0.8 | Completed | ✔️ | ✔️ | Stable installation. This extension provides a view plugin for PDF files using an html object tag. | -| Software | [docker-pycsw](https://github.com/mjanez/ckan-pycsw) | main | Completed standalone version | ✔️ | ❌ | Stable installation. PyCSW Endpoint of Open Data Portal with docker compose config. Harvest the CKAN catalogue in a CSW endpoint based on existing spatial datasets in the open data portal. | +| Software | [docker-pycsw](https://github.com/mjanez/ckan-pycsw) | main | Ready to use standalone version | ✔️ | ❌ | Stable installation. PyCSW Endpoint of Open Data Portal with docker compose config. Harvest the CKAN catalogue in a CSW endpoint based on existing spatial datasets in the open data portal. | ## Environment: docker From c61176e20cc612a6ba00b6e998e8f371e17d9c65 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 09:51:35 +0000 Subject: [PATCH 09/34] Remove datapusher --- docker-compose.dev.yml | 7 ------- docker-compose.yml | 7 ------- samples/ckan.ini.example | 2 +- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 2b6a0f1..5fc9ea4 100755 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -32,13 +32,6 @@ services: healthcheck: test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:5000"] - datapusher: - container_name: ${DATAPUSHER_CONTAINER_NAME} - image: ckan/ckan-base-datapusher:${DATAPUSHER_VERSION} - restart: unless-stopped - healthcheck: - test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:8800"] - db: container_name: ${POSTGRESQL_CONTAINER_NAME} build: diff --git a/docker-compose.yml b/docker-compose.yml index 8548f0e..75b2ede 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,13 +43,6 @@ services: healthcheck: test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:5000"] - datapusher: - container_name: ${DATAPUSHER_CONTAINER_NAME} - image: ckan/ckan-base-datapusher:${DATAPUSHER_VERSION} - restart: unless-stopped - healthcheck: - test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:8800"] - db: container_name: ${POSTGRESQL_CONTAINER_NAME} build: diff --git a/samples/ckan.ini.example b/samples/ckan.ini.example index 618582b..7ec88b5 100644 --- a/samples/ckan.ini.example +++ b/samples/ckan.ini.example @@ -149,10 +149,10 @@ ckan.harvest.mq.hostname = redis # Define which views should be created by default # (plugins must be loaded in ckan.plugins) ckan.views.default_views = image_view text_view recline_view harvest ckan_harvester wmts_view geojson_view geo_view shp_view pdf_view -ckanext.geoview.geojson.max_file_size = 100000000 ckanext.geoview.ol_viewer.formats = wms wfs geojson gml kml ckanext.geoview.shp_viewer.srid = 3857 ckanext.geoview.shp_viewer.encoding = UTF-8 +ckanext.geoview.geojson.max_file_size = 100000000 # Customize which text formats the text_view plugin will show ckan.preview.json_formats = json jsonld From 4985c8befc9f1c33bb04b8a6f8dd80ea4555aed8 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 09:52:41 +0000 Subject: [PATCH 10/34] Add entrypoints - ckanext-dcat - previews - ckanext-xloader --- ckan/docker-entrypoint.d/setup_dcat.sh | 7 +++++++ ckan/docker-entrypoint.d/setup_preview.sh | 20 ++++++++++++++++++++ ckan/docker-entrypoint.d/setup_xloader.sh | 11 +++++++++++ 3 files changed, 38 insertions(+) create mode 100644 ckan/docker-entrypoint.d/setup_dcat.sh create mode 100644 ckan/docker-entrypoint.d/setup_preview.sh create mode 100644 ckan/docker-entrypoint.d/setup_xloader.sh diff --git a/ckan/docker-entrypoint.d/setup_dcat.sh b/ckan/docker-entrypoint.d/setup_dcat.sh new file mode 100644 index 0000000..9c8f5ae --- /dev/null +++ b/ckan/docker-entrypoint.d/setup_dcat.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Add ckanext-dcat settings to the CKAN config file +echo "Loading ckanext-dcat settings in the CKAN config file" +ckan config-tool $CKAN_INI \ + "ckanext.dcat.base_uri = $CKANEXT__DCAT__BASE_URI" \ + "ckanext.dcat.rdf.profiles = $CKANEXT__DCAT__RDF_PROFILES" \ No newline at end of file diff --git a/ckan/docker-entrypoint.d/setup_preview.sh b/ckan/docker-entrypoint.d/setup_preview.sh new file mode 100644 index 0000000..246a1ed --- /dev/null +++ b/ckan/docker-entrypoint.d/setup_preview.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +#TODO: Correct views. + +# Add CKAN Resource views to the CKAN config file +echo "Loading resource views in the CKAN config file" +ckan config-tool $CKAN_INI \ + "ckan.views.default_views = $CKAN__VIEWS__DEFAULT_VIEWS" \ + "ckan.preview.json_formats = $CKAN__PREVIEW__JSON_FORMATS" \ + "ckan.preview.xml_formats = $CKAN__PREVIEW__XML_FORMATS" \ + "ckan.preview.text_formats = $CKAN__PREVIEW__TEXT_FORMATS" \ + "ckan.preview.loadable = $CKAN__PREVIEW__LOADABLE" + +# Add CKAN Resource geoviews to the CKAN config file +echo "Loading geoviews in the CKAN config file" +ckan config-tool $CKAN_INI \ + "ckanext.geoview.ol_viewer.formats = $CKANEXT__GEOVIEW__OL_VIEWER__FORMATS" \ + "ckanext.geoview.shp_viewer.srid = $CKANEXT__GEOVIEW__SHP_VIEWER__SRID" \ + "ckanext.geoview.shp_viewer.encoding = $CKANEXT__GEOVIEW__SHP_VIEWER__ENCODING" \ + "ckanext.geoview.geojson.max_file_size = $CKANEXT__GEOVIEW__GEOJSON__MAX_FILE_SIZE" \ No newline at end of file diff --git a/ckan/docker-entrypoint.d/setup_xloader.sh b/ckan/docker-entrypoint.d/setup_xloader.sh new file mode 100644 index 0000000..d34e245 --- /dev/null +++ b/ckan/docker-entrypoint.d/setup_xloader.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Add ckanext.xloader.api_token to the CKAN config file +echo "Loading ckanext-xloader settings in the CKAN config file" +ckan config-tool $CKAN_INI \ + "ckanext.xloader.api_token = xxx" \ + "ckanext.xloader.jobs_db.uri = $CKANEXT__XLOADER__JOBS__DB_URI" + +# Create ckanext-xloader API_TOKEN +echo "Set up ckanext.xloader.api_token in the CKAN config file" +ckan config-tool $CKAN_INI "ckanext.xloader.api_token = $(ckan -c $CKAN_INI user token add ckan_admin xloader | tail -n 1 | tr -d '\t')" From bb48c03341de6113634ab6d91d38784c5faddef3 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 09:54:02 +0000 Subject: [PATCH 11/34] Update Dockerfile.dev - Use stable 2.9.7 - Add plugins --- ckan/Dockerfile.dev | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/ckan/Dockerfile.dev b/ckan/Dockerfile.dev index 5098db1..a4f79c6 100644 --- a/ckan/Dockerfile.dev +++ b/ckan/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM ckan/ckan-base:ckan-2.10.0-dev +FROM ckan/ckan-base:2.9.7-dev # Set up environment variables ENV APP_DIR=/srv/app @@ -11,7 +11,7 @@ RUN apk add geos-dev proj proj-util proj-dev # Make sure both files are not exactly the same RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ - cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\ + cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\ fi ; # Install any extensions needed by your CKAN instance @@ -31,9 +31,9 @@ RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ ###TODO: XLoader ### -#RUN pip3 install -e 'git+https://github.com/ckan/ckanext-xloader.git@master#egg=ckanext-xloader' && \ -# pip3 install -r ${APP_DIR}/src/ckanext-xloader/requirements.txt && \ -# pip3 install -U requests[security] +RUN pip3 install -e 'git+https://github.com/ckan/ckanext-xloader.git@master#egg=ckanext-xloader' && \ + pip3 install -r ${APP_DIR}/src/ckanext-xloader/requirements.txt && \ + pip3 install -U requests[security] ### Harvester ### RUN echo "ckan/ckanext-harvester" && \ @@ -58,12 +58,7 @@ RUN echo "ckan/ckanext-spatial" && \ ### Scheming-GeoDCAT-AP extended version ### RUN echo "mjanez/ckanext-scheming (GeoDCAT-AP extended version)" && \ - pip3 install -e git+https://github.com/mjanez/ckanext-scheming.git#egg=ckanext-scheming && \ - # update CKAN config with ckanext-scheming parameters - ckan config-tool ${CKAN_INI} "scheming.dataset_schemas=''" && \ - ckan config-tool ${CKAN_INI} "scheming.group_schemas=''" && \ - ckan config-tool ${CKAN_INI} "scheming.organization_schemas=''" && \ - ckan config-tool ${CKAN_INI} "scheming.presets=''" + pip3 install -e git+https://github.com/mjanez/ckanext-scheming.git#egg=ckanext-scheming ### Pages ### RUN echo "ckan/ckanext-pages" && \ @@ -78,6 +73,16 @@ RUN echo "mjanez/ckanext-dcat (GeoDCAT-AP extended version)" && \ pip3 install -e git+https://github.com/mjanez/ckanext-dcat.git#egg=ckanext-dcat && \ pip3 install -r https://raw.githubusercontent.com/mjanez/ckanext-dcat/master/requirements.txt +###TODO: ckanext-visualize +#https://github.com/keitaroinc/ckanext-visualize + +###TODO datapreview error +# 2023-03-19 12:54:42,311 WARNI [ckan.lib.datapreview] Plugin for view t could not be found +# 2023-03-19 12:54:42,313 WARNI [ckan.lib.datapreview] Plugin for view e could not be found +# 2023-03-19 12:54:42,314 WARNI [ckan.lib.datapreview] Plugin for view x could not be found +# 2023-03-19 12:54:42,315 WARNI [ckan.lib.datapreview] Plugin for view t could not be found +# https://github.com/ckan/ckan/search?q=datapreview&type=issues + # ###TODO: SPARQL Interface - Adapt to Py3### # RUN echo "mjanez/sparql (Fixed version)" && \ # pip3 install -e git+https://github.com/mjanez/ckanext-sparql.git#egg=ckanext-sparql && \ @@ -97,9 +102,9 @@ COPY docker-entrypoint.d/* /docker-entrypoint.d/ 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 ; \ + 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 \ No newline at end of file From 9d99392ea639f46224b8e66d89d7994aff21c811 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 09:54:57 +0000 Subject: [PATCH 12/34] Update Dockerfile - Use stable 2.9.7 - Add stable plugins --- ckan/Dockerfile | 65 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/ckan/Dockerfile b/ckan/Dockerfile index 89b67a8..2e27be0 100644 --- a/ckan/Dockerfile +++ b/ckan/Dockerfile @@ -1,12 +1,71 @@ -FROM ckan/ckan-base:ckan-2.10.0 -#FROM ckan/ckan-base:dev-v2.10 +FROM ckan/ckan-base:2.9.7 # Set up environment variables ENV APP_DIR=/srv/app ENV TZ=UTC RUN echo ${TZ} > /etc/timezone +# Set up PROJ +RUN apk add geos-dev proj proj-util proj-dev + # Make sure both files are not exactly the same RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ - cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\ + cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\ fi ; + +# Extensions +### XLoader - v0.12.2 ### +RUN pip3 install -e 'git+https://github.com/ckan/ckanext-xloader.git@0.12.2#egg=ckanext-xloader' && \ + pip3 install -r ${APP_DIR}/src/ckanext-xloader/requirements.txt && \ + pip3 install -U requests[security] + +### Harvester - v1.5.0 ### +RUN echo "ckan/ckanext-harvest" && \ + pip3 install -e 'git+https://github.com/ckan/ckanext-harvest.git@v1.5.0#egg=ckanext-harvest' && \ + pip3 install -r ${APP_DIR}/src/ckanext-harvest/pip-requirements.txt + +### Geoview - v0.0.20 ### +RUN echo "ckan/ckanext-geoview" && \ + pip3 install -e 'git+https://github.com/ckan/ckanext-geoview.git@v0.0.20#egg=ckanext-geoview' + +### Spatial - v2.0.0 ### +RUN echo "ckan/ckanext-spatial" && \ + pip3 install -e 'git+https://github.com/ckan/ckanext-spatial.git@v2.0.0#egg=ckanext-spatial' && \ + pip3 install -r https://raw.githubusercontent.com/ckan/ckanext-spatial/bae9290395b252ee8e40056256fa694569d1d78b/requirements.txt + +### DCAT - master (GeoDCAT-AP extended version) ### +RUN echo "mjanez/ckanext-dcat (GeoDCAT-AP extended version)" && \ + pip3 install -e git+https://github.com/mjanez/ckanext-dcat.git#egg=ckanext-dcat && \ + pip3 install -r https://raw.githubusercontent.com/mjanez/ckanext-dcat/master/requirements.txt + +### Scheming - master (GeoDCAT-AP extended version) ### +RUN echo "mjanez/ckanext-scheming (GeoDCAT-AP extended version)" && \ + pip3 install -e git+https://github.com/mjanez/ckanext-scheming.git#egg=ckanext-scheming + +### Resource dictionary (Fix version) - main ### +RUN echo "mjanez/ckanext-resourcedictionary" && \ + pip3 install -e 'git+https://github.com/mjanez/ckanext-resourcedictionary.git#egg=ckanext-resourcedictionary' + +### Pages - v0.5.1 ### +RUN echo "ckan/ckanext-pages" && \ + pip3 install -e git+https://github.com/ckan/ckanext-pages.git@v0.5.1#egg=ckanext-pages + +### PDFView - v0.0.8 ### +RUN echo "ckan/ckanext-pdfview" && \ + pip3 install -e git+https://github.com/ckan/ckanext-pdfview.git@0.0.8#egg=ckanext-pdfview + +# Used to configure the container environment by setting environment variables, creating users, running initialization scripts, .etc +COPY docker-entrypoint.d/* /docker-entrypoint.d/ + +# Apply any patches needed to CKAN core +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 + +CMD ["/srv/app/start_ckan.sh"] \ No newline at end of file From 404f72b63ae88054c7c3abd32a23b9402de98079 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 09:55:59 +0000 Subject: [PATCH 13/34] Update README - Add info about plugins --- .env | 16 +++++++++------- README.md | 6 +++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.env b/.env index dfff212..6161cc7 100644 --- a/.env +++ b/.env @@ -3,7 +3,6 @@ NGINX_CONTAINER_NAME=nginx REDIS_CONTAINER_NAME=redis POSTGRESQL_CONTAINER_NAME=db SOLR_CONTAINER_NAME=solr -DATAPUSHER_CONTAINER_NAME=datapusher CKAN_CONTAINER_NAME=ckan WORKER_CONTAINER_NAME=ckan-worker @@ -33,11 +32,10 @@ CKAN_SITE_ID=default CKAN_SITE_URL=http://localhost:5000 CKAN_PORT=5000 CKAN_PORT_HOST=5000 -CKAN___BEAKER__SESSION__SECRET=39ASDK913r4jas0 +CKAN___BEAKER__SESSION__SECRET=CHANGE_ME # See https://docs.ckan.org/en/latest/maintaining/configuration.html#api-token-settings -CKAN___API_TOKEN__JWT__ENCODE__SECRET=string:WqVhDAXsF7E9FvzVnNqdsKpDT9wZbiu6hzxyMijv4FN3B -CKAN___API_TOKEN__JWT__DECODE__SECRET=string:WqVhDAXsF7E9FvzVnNqdsKpDT9wZbiu6hzxyMijv4FN3B -CKAN___DATAPUSHER__API_TOKEN=api_token +CKAN___API_TOKEN__JWT__ENCODE__SECRET=string:CHANGE_ME +CKAN___API_TOKEN__JWT__DECODE__SECRET=string:CHANGE_ME CKAN_SYSADMIN_NAME=ckan_admin CKAN_SYSADMIN_PASSWORD=test1234 CKAN_SYSADMIN_EMAIL=your_email@example.com @@ -72,7 +70,7 @@ REDIS_VERSION=6 CKAN_REDIS_URL=redis://redis:6379/1 TEST_CKAN_REDIS_URL=redis://redis:6379/1 -# Datapusher +# Datapusher - Deprecated by ckanext-xloader DATAPUSHER_VERSION=0.0.19 CKAN_DATAPUSHER_URL=http://datapusher:8800 CKAN__DATAPUSHER__CALLBACK_URL_BASE=http://ckan:5000 @@ -84,13 +82,17 @@ NGINX_PORT=80 NGINX_SSLPORT=443 # Extensions -CKAN__PLUGINS="envvars stats text_view image_view recline_view resourcedictionary datastore datapusher harvest ckan_harvester spatial_metadata spatial_query spatial_harvest_metadata_api csw_harvester waf_harvester doc_harvester resource_proxy geo_view geojson_view wmts_view shp_view dcat dcat_rdf_harvester dcat_json_harvester dcat_json_interface scheming_datasets scheming_groups scheming_organizations pdf_view pages" +CKAN__PLUGINS="envvars stats text_view image_view recline_view resourcedictionary datastore xloader harvest ckan_harvester spatial_metadata spatial_query spatial_harvest_metadata_api csw_harvester waf_harvester doc_harvester resource_proxy geo_view geojson_view wmts_view shp_view dcat dcat_rdf_harvester dcat_json_harvester dcat_json_interface scheming_datasets scheming_groups scheming_organizations pdf_view pages" CKAN__HARVEST__MQ__TYPE=redis CKAN__HARVEST__MQ__HOSTNAME=redis CKAN__HARVEST__MQ__PORT=6379 CKAN__HARVEST__MQ__REDIS_DB=1 +# ckanext-xloader +CKANEXT__XLOADER__API_TOKEN=api_token +CKANEXT__XLOADER__JOBS__DB_URI=postgresql://ckan:ckan@db/ckan + # ckanext-dcat CKANEXT__DCAT__BASE_URI=https://localhost:5000 CKANEXT__DCAT__RDF_PROFILES="euro_dcat_ap_2 euro_dcat_ap" diff --git a/README.md b/README.md index 4466221..52484ff 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

CKAN Docker Compose - Open Data & GIS

-CKAN Versions +CKAN Versions

@@ -24,7 +24,6 @@ Available components: * The CKAN images used are from the official CKAN [ckan-docker-base](https://github.com/ckan/ckan-docker-base) repo The non-CKAN images are as follows: -* DataPusher: CKAN's [pre-configured DataPusher image](https://github.com/ckan/ckan-docker-base/tree/main/datapusher). * PostgreSQL: Official PostgreSQL image. Database files are stored in a named volume. * Solr: CKAN's [pre-configured Solr image](https://github.com/ckan/ckan-solr). Index data is stored in a named volume. * Redis: standard Redis image @@ -46,7 +45,8 @@ Information about extensions installed in the `main` image. More info described |-------------|-----------------------------------------------------------------------------------------|-------------|------------------------------|---------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Core | [CKAN](https://github.com/mjanez/ckan-docker) | 2.10.0 | Completed | ✔️ | ✔️ | Stable installation for version 2.10.0 (Production & Dev images) via Docker Compose based on [official images](https://github.com/ckan/ckan-docker-base)). Initial configuration, basic customisation and operation guide. | | Core + | [Datastore](https://github.com/mjanez/ckan-docker) | 2.10.0 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose. | -| Core + | [Datapusher](https://github.com/mjanez/ckan-docker) | 0.0.19 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose.

**TODO**: Upgrade to [xloader](https://github.com/ckan/ckanext-xloader), an express Loader - quickly load data into DataStore. A replacement for DataPusher. | +| Core + | [~~Datapusher~~](https://github.com/mjanez/ckan-docker) | 0.0.19 | Deprecated | ❌ | ❌ | Updated to [xloader](https://github.com/ckan/ckanext-xloader), an express Loader - quickly load data into DataStore. | +| Extension | [ckanext-xloader](https://github.com/ckan/ckanext-xloader) | 0.12.2 | Completed | ✔️ | ❌ | Stable installation, a replacement for DataPusher because it offers ten times the speed and more robustness | | Extension | [ckanext-harvest](https://github.com/ckan/ckanext-harvest) | 1.5.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | | Extension | [ckanext-geoview](https://github.com/ckan/ckanext-geoview) | 0.0.20 | Completed | ✔️ | ✔️ | Stable installation. | | Extension | [ckanext-spatial](https://github.com/ckan/ckanext-spatial) | 2.0.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | From 8bc880f5e7f7551146fe4be5af072ec96651d0f9 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 11:01:51 +0100 Subject: [PATCH 14/34] Update README.md --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 52484ff..e4df69a 100644 --- a/README.md +++ b/README.md @@ -146,10 +146,17 @@ Use this if you are a maintainer and will not be making code changes to CKAN or Copy the included `.env.example` and rename it to `.env`. Modify it depending on your own needs. ->*Note**:
+>**Note**:
> Please note that when accessing CKAN directly (via a browser) ie: not going through NGINX you will need to make sure you have "ckan" set up to be an alias to localhost in the local hosts file. Either that or you will need to change the `.env` entry for `CKAN_SITE_URL` -Using the default values on the `.env.example` file will get you a working CKAN instance. There is a sysadmin user created by default with the values defined in `CKAN_SYSADMIN_NAME` and `CKAN_SYSADMIN_PASSWORD`(`ckan_admin` and `test1234` by default). This should be obviously changed before running this setup as a public CKAN instance. +>**Warning**:
+> Using the default values on the `.env.example` file will get you a working CKAN instance. There is a sysadmin user created by default with the values defined in `CKAN_SYSADMIN_NAME` and `CKAN_SYSADMIN_PASSWORD`(`ckan_admin` and `test1234` by default). This should be obviously changed before running this setup as a public CKAN instance. + +Clone project +```shell +cd /path/to/my/project +git clone https://github.com/mjanez/ckan-docker.git +``` To build the images: @@ -357,4 +364,4 @@ Available components: [^1]: Development environment. [^2]: Production environment. [^3]: [ckan_geodcatap](https://github.com/mjanez/ckanext-scheming/blob/036b8c6503059e0d42b0eba180d5bd39205c64a3/ckanext/scheming/ckan_geodcatap.yaml), more info: https://github.com/mjanez/ckanext-scheming/pull/1 -[^4]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. \ No newline at end of file +[^4]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. From 79f0b37255efb7c859006b1ae009756cccf01202 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 15:36:55 +0000 Subject: [PATCH 15/34] ckan-docker 2.9.8 --- .env | 4 +- .github/workflows/docker.yml | 47 +++++++++++++++ README.md | 4 +- ckan/Dockerfile | 109 +++++++++++++++++++++++++++++++++-- ckan/Dockerfile.dev | 3 +- ckan/setup/start_ckan.sh | 11 ++++ docker-compose.yml | 1 + 7 files changed, 170 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.env b/.env index 6161cc7..5c4a951 100644 --- a/.env +++ b/.env @@ -27,7 +27,7 @@ TEST_CKAN_DATASTORE_WRITE_URL=postgresql://ckan:ckan@db/datastore_test TEST_CKAN_DATASTORE_READ_URL=postgresql://datastore_ro:datastore@db/datastore_test # CKAN core -CKAN_VERSION=2.10.0 +CKAN_VERSION=2.9.8 CKAN_SITE_ID=default CKAN_SITE_URL=http://localhost:5000 CKAN_PORT=5000 @@ -61,7 +61,7 @@ CKAN__RESOURCE_PROXY__TIMEOUT=10 CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view harvest ckan_harvester wmts_view geojson_view geo_view shp_view pdf_view" # Solr -SOLR_IMAGE_VERSION=2.10-spatial +SOLR_IMAGE_VERSION=2.9-solr8-spatial CKAN_SOLR_URL=http://solr:8983/solr/ckan TEST_CKAN_SOLR_URL=http://solr:8983/solr/ckan diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..0eb6ca6 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,47 @@ +name: Docker + +on: + push: + branches: [ 'ckan-2.9.8' ] + tags: [ 'v*.*.*' ] + pull_request: + branches: [ 'ckan-2.9.8' ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Checkout + uses: actions/checkout@v1 + - + name: Login to registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - + name: Build and push + uses: docker/build-push-action@v3 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/README.md b/README.md index 52484ff..777174f 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ Information about extensions installed in the `main` image. More info described | **Element** | **Description** | **version** | **Status** | **DEV**[^1] | **PRO**[^2] | **Remarks** | |-------------|-----------------------------------------------------------------------------------------|-------------|------------------------------|---------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Core | [CKAN](https://github.com/mjanez/ckan-docker) | 2.10.0 | Completed | ✔️ | ✔️ | Stable installation for version 2.10.0 (Production & Dev images) via Docker Compose based on [official images](https://github.com/ckan/ckan-docker-base)). Initial configuration, basic customisation and operation guide. | -| Core + | [Datastore](https://github.com/mjanez/ckan-docker) | 2.10.0 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose. | +| Core | [CKAN](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation for version 2.9.7 (Production & Dev images) via Docker Compose based on [official images](https://github.com/ckan/ckan-docker-base)). Initial configuration, basic customisation and operation guide. | +| Core + | [Datastore](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose. | | Core + | [~~Datapusher~~](https://github.com/mjanez/ckan-docker) | 0.0.19 | Deprecated | ❌ | ❌ | Updated to [xloader](https://github.com/ckan/ckanext-xloader), an express Loader - quickly load data into DataStore. | | Extension | [ckanext-xloader](https://github.com/ckan/ckanext-xloader) | 0.12.2 | Completed | ✔️ | ❌ | Stable installation, a replacement for DataPusher because it offers ten times the speed and more robustness | | Extension | [ckanext-harvest](https://github.com/ckan/ckanext-harvest) | 1.5.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | diff --git a/ckan/Dockerfile b/ckan/Dockerfile index 2e27be0..9741f50 100644 --- a/ckan/Dockerfile +++ b/ckan/Dockerfile @@ -1,12 +1,113 @@ -FROM ckan/ckan-base:2.9.7 +FROM alpine:3.13 -# Set up environment variables +# Internals, you probably don't need to change these ENV APP_DIR=/srv/app +ENV SRC_DIR=/srv/app/src +ENV CKAN_INI=${APP_DIR}/ckan.ini +ENV PIP_SRC=${SRC_DIR} +ENV CKAN_STORAGE_PATH=/var/lib/ckan +ENV GIT_URL=https://github.com/ckan/ckan.git ENV TZ=UTC RUN echo ${TZ} > /etc/timezone +# CKAN version to build +ENV GIT_BRANCH=ckan-2.9.8 +# Customize these on the .env file if needed +ENV CKAN_SITE_URL=http://localhost:5000 +ENV CKAN__PLUGINS image_view text_view recline_view datastore datapusher envvars -# Set up PROJ -RUN apk add geos-dev proj proj-util proj-dev +# UWSGI options +ENV UWSGI_HARAKIRI=50 + +WORKDIR ${APP_DIR} + +# Install necessary packages to run CKAN +RUN apk add --no-cache tzdata \ + git \ + gettext \ + postgresql-client \ + python3 \ + libxml2 \ + libxslt \ + musl-dev \ + uwsgi \ + uwsgi-http \ + uwsgi-corerouter \ + uwsgi-python \ + py3-gevent \ + uwsgi-gevent \ + libmagic \ + curl \ + patch \ + sudo && \ + # Packages to build CKAN requirements and plugins + apk add --no-cache --virtual .build-deps \ + postgresql-dev \ + gcc \ + make \ + g++ \ + autoconf \ + automake \ + libtool \ + python3-dev \ + libxml2-dev \ + libxslt-dev \ + linux-headers \ + openssl-dev \ + libffi-dev \ + cargo \ + # Set up PROJ + geos-dev \ + proj \ + proj-util \ + proj-dev && \ + # Create SRC_DIR + mkdir -p ${SRC_DIR} && \ + # Install pip, supervisord and uwsgi + curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ + python3 ${SRC_DIR}/get-pip.py && \ + pip3 install supervisor && \ + mkdir /etc/supervisord.d && \ + #pip wheel --wheel-dir=/wheels uwsgi gevent && \ + rm -rf ${SRC_DIR}/get-pip.py + +COPY setup/supervisord.conf /etc + +# Install CKAN +RUN pip3 install -e git+${GIT_URL}@${GIT_BRANCH}#egg=ckan && \ + cd ${SRC_DIR}/ckan && \ + cp who.ini ${APP_DIR} && \ + pip3 install -r requirement-setuptools.txt && \ + pip3 install --no-binary markdown -r requirements.txt && \ + # Install CKAN envvars to support loading config from environment variables + pip3 install -e git+https://github.com/okfn/ckanext-envvars.git#egg=ckanext-envvars && \ + # Create and update CKAN config + ckan generate config ${CKAN_INI} && \ + ckan config-tool ${CKAN_INI} "beaker.session.secret = " && \ + ckan config-tool ${CKAN_INI} "ckan.plugins = ${CKAN__PLUGINS}" + +# Create a local user and group to run the app +RUN addgroup -g 92 -S ckan && \ + adduser -u 92 -h /srv/app -s /bin/bash -D -G ckan ckan + +# Create local storage folder +RUN mkdir -p ${CKAN_STORAGE_PATH} && \ + chown -R ckan:ckan ${CKAN_STORAGE_PATH} + +COPY setup/prerun.py ${APP_DIR} +COPY setup/start_ckan.sh ${APP_DIR} +ADD https://raw.githubusercontent.com/ckan/ckan/${GIT_BRANCH}/wsgi.py ${APP_DIR} + +# Create entrypoint directory for children image scripts +ONBUILD RUN mkdir /docker-entrypoint.d + +RUN chown ckan -R /srv/app + +RUN addgroup sudo && \ + adduser ckan sudo + +EXPOSE 5000 + +HEALTHCHECK --interval=60s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1 # Make sure both files are not exactly the same RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ diff --git a/ckan/Dockerfile.dev b/ckan/Dockerfile.dev index a4f79c6..1e7b26e 100644 --- a/ckan/Dockerfile.dev +++ b/ckan/Dockerfile.dev @@ -1,4 +1,5 @@ -FROM ckan/ckan-base:2.9.7-dev +# syntax = edrevo/dockerfile-plus +INCLUDE+ Dockerfile # Set up environment variables ENV APP_DIR=/srv/app diff --git a/ckan/setup/start_ckan.sh b/ckan/setup/start_ckan.sh index e1fb8e1..d6d437d 100755 --- a/ckan/setup/start_ckan.sh +++ b/ckan/setup/start_ckan.sh @@ -1,5 +1,16 @@ #!/bin/bash +# Set up the Secret key used by Beaker and Flask +# This can be overriden using a CKAN___BEAKER__SESSION__SECRET env var +if grep -E "beaker.session.secret ?= ?$" ckan.ini +then + echo "Setting beaker.session.secret in ini file" + ckan config-tool $CKAN_INI "beaker.session.secret=$(python3 -c 'import secrets; print(secrets.token_urlsafe())')" + JWT_SECRET=$(python3 -c 'import secrets; print("string:" + secrets.token_urlsafe())') + ckan config-tool $CKAN_INI "api_token.jwt.encode.secret=${JWT_SECRET}" + ckan config-tool $CKAN_INI "api_token.jwt.decode.secret=${JWT_SECRET}" +fi + # Run the prerun script to init CKAN and create the default admin user sudo -u ckan -EH python3 prerun.py diff --git a/docker-compose.yml b/docker-compose.yml index 75b2ede..b5d7b96 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,7 @@ services: dockerfile: Dockerfile args: - TZ=${TZ} + image: ghcr.io/mjanez/ckan-docker:ckan-2.9.8 env_file: - .env depends_on: From 2d0e9a34d7bab5d35373ea4bf06a4be6f0a3fa0f Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:40:05 +0100 Subject: [PATCH 16/34] Fix Dockerfile --- ckan/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ckan/Dockerfile b/ckan/Dockerfile index 9741f50..4927e79 100644 --- a/ckan/Dockerfile +++ b/ckan/Dockerfile @@ -54,7 +54,7 @@ RUN apk add --no-cache tzdata \ linux-headers \ openssl-dev \ libffi-dev \ - cargo \ + cargo && \ # Set up PROJ geos-dev \ proj \ @@ -169,4 +169,4 @@ RUN for d in $APP_DIR/patches/*; do \ fi ; \ done -CMD ["/srv/app/start_ckan.sh"] \ No newline at end of file +CMD ["/srv/app/start_ckan.sh"] From 925835d93bfd23992942190027d3582f501724b2 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:44:54 +0100 Subject: [PATCH 17/34] Update docker.yml --- .github/workflows/docker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0eb6ca6..f2fbc4e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -21,6 +21,9 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + with: + context: ./ckan + file: ./ckan/Dockerfile - name: Checkout uses: actions/checkout@v1 @@ -44,4 +47,4 @@ jobs: with: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} From 5766a7f79406147a3501688c033e1e7004fd4408 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:51:07 +0100 Subject: [PATCH 18/34] Update docker.yml --- .github/workflows/docker.yml | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f2fbc4e..688cf5f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,11 +1,11 @@ -name: Docker +name: Build CKAN Docker on: push: - branches: [ 'ckan-2.9.8' ] - tags: [ 'v*.*.*' ] + branches: [ 'main' ] + tags: [ 'ckan-*.*.*' ] pull_request: - branches: [ 'ckan-2.9.8' ] + branches: [ 'main' ] env: REGISTRY: ghcr.io @@ -15,36 +15,34 @@ jobs: docker: runs-on: ubuntu-latest steps: - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx + + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - with: - context: ./ckan - file: ./ckan/Dockerfile - - - name: Checkout + + - name: Checkout uses: actions/checkout@v1 - - - name: Login to registry + + - name: Login to registry if: github.event_name != 'pull_request' uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract Docker metadata + + - name: Extract Docker metadata id: meta uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and push + + - name: CKAN Build and push uses: docker/build-push-action@v3 with: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + context: ./ckan + file: ./ckan/Dockerfile From cd3dfa0985875ede8f28fd5713b2a08cefc3df5a Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:58:36 +0100 Subject: [PATCH 19/34] Fix Dockerfile --- ckan/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckan/Dockerfile b/ckan/Dockerfile index 4927e79..49a621b 100644 --- a/ckan/Dockerfile +++ b/ckan/Dockerfile @@ -54,7 +54,7 @@ RUN apk add --no-cache tzdata \ linux-headers \ openssl-dev \ libffi-dev \ - cargo && \ + cargo \ # Set up PROJ geos-dev \ proj \ From 5fb6a14fb5bda6604d21897621dadaaf512a0316 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:54:17 +0000 Subject: [PATCH 20/34] Fix README --- README.md | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 46b4554..fed77a9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

CKAN Docker Compose - Open Data & GIS

-CKAN Versions +CKAN Versions

@@ -20,19 +20,28 @@ ## Overview Contains Docker images for the different components of CKAN Cloud and a Docker compose environment (based on [ckan](https://github.com/ckan/ckan)) for development and testing Open Data portals. +>**Warning**:
+>This is a **custom installation of Docker Compose** with specific extensions for spatial data and [GeoDCAT-AP](https://github.com/SEMICeu/GeoDCAT-AP)/[INSPIRE](https://github.com/INSPIRE-MIF/technical-guidelines) metadata [profiles](https://en.wikipedia.org/wiki/Geospatial_metadata). For official installations, please have a look: [CKAN documentation: Installation](https://docs.ckan.org/en/latest/maintaining/installing/index.html). + Available components: -* The CKAN images used are from the official CKAN [ckan-docker-base](https://github.com/ckan/ckan-docker-base) repo +* CKAN custom image based on the official CKAN repo [ckan-docker-base](https://github.com/ckan/ckan-docker-base) The non-CKAN images are as follows: * PostgreSQL: Official PostgreSQL image. Database files are stored in a named volume. -* Solr: CKAN's [pre-configured Solr image](https://github.com/ckan/ckan-solr). Index data is stored in a named volume. +* Solr: CKAN's [pre-configured Solr image](https://github.com/ckan/ckan-solr). The index data is stored in a named volume and has a spatial schema. [^1] * Redis: standard Redis image * NGINX: latest stable nginx image that includes SSL and Non-SSL endpoints +| Repository | Type | Docker tag | Size | Notes | +| --- | --- | --- | --- | --- | +| PostgreSQL 12.14 | base image | [`postgres/postgres:12-alpine`](https://hub.docker.com/layers/library/postgres/12-alpine/images/sha256-e07198f71e85eccd6c351bb4eb0b2ff833bef2dd6ea314f6442c2dc47535fbb7?context=explore) | 87.09 MB | Custom Dockerfile: [`postgresql/Dockerfile`](/postgresql/Dockerfile) | +| Solr 8.11.1 | base image | [`ckan/ckan-solr:2.9-solr8-spatial`](https://registry.hub.docker.com/layers/ckan/ckan-solr/2.9-solr8-spatial/images/sha256-b5ee4979891c7dd1f10d2ac2cbdd4d80ff656879edb0f0493616be7b4cf8bc3a?context=explore) | 331.1 MB | - | +| Redis 6.2.11 | base image | [`redis/redis:6`](https://hub.docker.com/layers/library/redis/6/images/sha256-e10c69dc5f9b27c47874060962fdaa26ec0df592205d6d21402945267081b434?context=explore) | 39.32 MB | - | +| NGINX 1.22.1 | base image | [`nginx:stable-alpine`](https://hub.docker.com/layers/library/nginx/stable-alpine/images/sha256-ff2a5d557ca22fa93669f5e70cfbeefda32b98f8fd3d33b38028c582d700f93a?context=explore) | 9.74 MB | Custom Dockerfile: [`nginx/Dockerfile`](/nginx/Dockerfile) | + + The site is configured using environment variables that you can set in the `.env` file. ->**Warning**:
->This is a **custom installation of Docker Compose** with specific extensions for spatial data and [GeoDCAT-AP](https://github.com/SEMICeu/GeoDCAT-AP)/[INSPIRE](https://github.com/INSPIRE-MIF/technical-guidelines) metadata [profiles](https://en.wikipedia.org/wiki/Geospatial_metadata). For official installations, please have a look: [CKAN documentation: Installation](https://docs.ckan.org/en/latest/maintaining/installing/index.html). ### ckan-docker roadmap Information about extensions installed in the `main` image. More info described in the [Extending the base images](#extending-the-base-images) @@ -41,9 +50,9 @@ Information about extensions installed in the `main` image. More info described > Switch branches to see the `roadmap` for other projects: [ckan-docker/branches](https://github.com/mjanez/ckan-docker/branches) -| **Element** | **Description** | **version** | **Status** | **DEV**[^1] | **PRO**[^2] | **Remarks** | +| **Element** | **Description** | **version** | **Status** | **DEV**[^2] | **PRO**[^3] | **Remarks** | |-------------|-----------------------------------------------------------------------------------------|-------------|------------------------------|---------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Core | [CKAN](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation for version 2.9.7 (Production & Dev images) via Docker Compose based on [official images](https://github.com/ckan/ckan-docker-base)). Initial configuration, basic customisation and operation guide. | +| Core | [CKAN](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation for version 2.9.8 (Production & Dev images) via Docker Compose based on [official images](https://github.com/ckan/ckan-docker-base)). Initial configuration, basic customisation and operation guide. | | Core + | [Datastore](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose. | | Core + | [~~Datapusher~~](https://github.com/mjanez/ckan-docker) | 0.0.19 | Deprecated | ❌ | ❌ | Updated to [xloader](https://github.com/ckan/ckanext-xloader), an express Loader - quickly load data into DataStore. | | Extension | [ckanext-xloader](https://github.com/ckan/ckanext-xloader) | 0.12.2 | Completed | ✔️ | ❌ | Stable installation, a replacement for DataPusher because it offers ten times the speed and more robustness | @@ -51,7 +60,7 @@ Information about extensions installed in the `main` image. More info described | Extension | [ckanext-geoview](https://github.com/ckan/ckanext-geoview) | 0.0.20 | Completed | ✔️ | ✔️ | Stable installation. | | Extension | [ckanext-spatial](https://github.com/ckan/ckanext-spatial) | 2.0.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | | Extension | [ckanext-dcat](https://github.com/mjanez/ckanext-dcat) | 1.2.0 | Completed | ✔️ | ✔️ | Stable installation, include DCAT-AP 2.1 profile compatible with GeoDCAT-AP. | -| Extension | [ckanext-scheming](https://github.com/mjanez/ckanext-scheming) | 3.0.0 | WIP | ✔️ | ✔️ | Stable installation. Customised ckanext schema[^3] based on the [Spanish Metadata Core](https://datos.gob.es/es/doc-tags/nti-risp) with the aim of completing the minimum metadata elements included in the current datasets in accordance with [GeoDCAT-AP](https://semiceu.github.io/GeoDCAT-AP/releases/) and [INSPIRE](https://inspire.ec.europa.eu/about-inspire). | +| Extension | [ckanext-scheming](https://github.com/mjanez/ckanext-scheming) | 3.0.0 | WIP | ✔️ | ✔️ | Stable installation. Customised ckanext schema[^4] based on the [Spanish Metadata Core](https://datos.gob.es/es/doc-tags/nti-risp) with the aim of completing the minimum metadata elements included in the current datasets in accordance with [GeoDCAT-AP](https://semiceu.github.io/GeoDCAT-AP/releases/) and [INSPIRE](https://inspire.ec.europa.eu/about-inspire). | | Extension | [ckanext-resourcedictionary](https://github.com/OpenDataGIS/ckanext-resourcedictionary) | main | Completed | ✔️ | ✔️ | Stable installation. This extension extends the default CKAN Data Dictionary functionality by adding possibility to create data dictionary before actual data is uploaded to datastore. | | Extension | [ckanext-pages](https://github.com/ckan/ckanext-pages) | 0.5.1 | Completed | ✔️ | ✔️ | Stable installation. This extension gives you an easy way to add simple pages to CKAN. | | Extension | [ckanext-pdfview](https://github.com/ckan/ckanext-pdfview) | 0.0.8 | Completed | ✔️ | ✔️ | Stable installation. This extension provides a view plugin for PDF files using an html object tag. | @@ -248,7 +257,7 @@ ckan -c /srv/app/ckan.ini validation init-db And then in our `Dockerfile.dev` file we install the extension and copy the initialization scripts: ```Dockerfile -FROM ckan/ckan-base:2.9.7-dev +FROM ckan/ckan-base:2.9.8-dev RUN pip install -e git+https://github.com/frictionlessdata/ckanext-validation.git#egg=ckanext-validation && \ pip install -r https://raw.githubusercontent.com/frictionlessdata/ckanext-validation/master/requirements.txt @@ -354,14 +363,15 @@ For more information please see [ckanext-envvars](https://github.com/okfn/ckanex ### ckan-pycsw -[ckan-pycsw](https://github.com/mjanez/ckan-pycsw) is a docker compose environment (based on [pycsw](https://github.com/geopython/pycsw)) for development and testing with CKAN Open Data portals.[^4] +[ckan-pycsw](https://github.com/mjanez/ckan-pycsw) is a docker compose environment (based on [pycsw](https://github.com/geopython/pycsw)) for development and testing with CKAN Open Data portals.[^5] Available components: * **pycsw**: The pycsw app. An [OARec](https://ogcapi.ogc.org/records) and [OGC CSW](https://opengeospatial.org/standards/cat) server implementation written in Python. * **ckan2pycsw**: Software to achieve interoperability with the open data portals based on CKAN. To do this, ckan2pycsw reads data from an instance using the CKAN API, generates ISO-19115/ISO-19139 metadata using [pygeometa](https://geopython.github.io/pygeometa/), or a custom schema that is based on a customized CKAN schema, and populates a [pycsw](https://pycsw.org/) instance that exposes the metadata using CSW and OAI-PMH. -[^1]: Development environment. -[^2]: Production environment. -[^3]: [ckan_geodcatap](https://github.com/mjanez/ckanext-scheming/blob/036b8c6503059e0d42b0eba180d5bd39205c64a3/ckanext/scheming/ckan_geodcatap.yaml), more info: https://github.com/mjanez/ckanext-scheming/pull/1 -[^4]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. +[^1]: Contains fields needed for the [ckanext-spatial geo search](https://docs.ckan.org/projects/ckanext-spatial/en/latest/spatial-search.html) +[^2]: Development environment. +[^3]: Production environment. +[^4]: [ckan_geodcatap](https://github.com/mjanez/ckanext-scheming/blob/036b8c6503059e0d42b0eba180d5bd39205c64a3/ckanext/scheming/ckan_geodcatap.yaml), more info: https://github.com/mjanez/ckanext-scheming/pull/1 +[^5]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. From e3ab3927369e86be7568447c15e9eff98647c8be Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 22 Mar 2023 17:03:33 +0000 Subject: [PATCH 21/34] Update ckanext-xloader --- .env | 2 +- README.md | 2 +- ckan/docker-entrypoint.d/setup_xloader.sh | 3 +++ samples/.env.example | 24 ++++++++++++----------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.env b/.env index 5c4a951..de58312 100644 --- a/.env +++ b/.env @@ -58,7 +58,7 @@ CKAN__RESOURCE_PROXY__MAX_FILE_SIZE=50048576 CKAN__RESOURCE_PROXY__CHUNK_SIZE=4096 ## Default timeout for fetching proxied items CKAN__RESOURCE_PROXY__TIMEOUT=10 -CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view harvest ckan_harvester wmts_view geojson_view geo_view shp_view pdf_view" +CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view recline_grid_view recline_graph_view wmts_view webpage_view geojson_view geo_view shp_view pdf_view" # Solr SOLR_IMAGE_VERSION=2.9-solr8-spatial diff --git a/README.md b/README.md index fed77a9..bd4ae58 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Information about extensions installed in the `main` image. More info described | Core | [CKAN](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation for version 2.9.8 (Production & Dev images) via Docker Compose based on [official images](https://github.com/ckan/ckan-docker-base)). Initial configuration, basic customisation and operation guide. | | Core + | [Datastore](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose. | | Core + | [~~Datapusher~~](https://github.com/mjanez/ckan-docker) | 0.0.19 | Deprecated | ❌ | ❌ | Updated to [xloader](https://github.com/ckan/ckanext-xloader), an express Loader - quickly load data into DataStore. | -| Extension | [ckanext-xloader](https://github.com/ckan/ckanext-xloader) | 0.12.2 | Completed | ✔️ | ❌ | Stable installation, a replacement for DataPusher because it offers ten times the speed and more robustness | +| Extension | [ckanext-xloader](https://github.com/ckan/ckanext-xloader) | 0.12.2 | Completed | ✔️ | ✔️ | Stable installation, a replacement for DataPusher because it offers ten times the speed and more robustness | | Extension | [ckanext-harvest](https://github.com/ckan/ckanext-harvest) | 1.5.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | | Extension | [ckanext-geoview](https://github.com/ckan/ckanext-geoview) | 0.0.20 | Completed | ✔️ | ✔️ | Stable installation. | | Extension | [ckanext-spatial](https://github.com/ckan/ckanext-spatial) | 2.0.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | diff --git a/ckan/docker-entrypoint.d/setup_xloader.sh b/ckan/docker-entrypoint.d/setup_xloader.sh index d34e245..5f738c1 100644 --- a/ckan/docker-entrypoint.d/setup_xloader.sh +++ b/ckan/docker-entrypoint.d/setup_xloader.sh @@ -9,3 +9,6 @@ ckan config-tool $CKAN_INI \ # Create ckanext-xloader API_TOKEN echo "Set up ckanext.xloader.api_token in the CKAN config file" ckan config-tool $CKAN_INI "ckanext.xloader.api_token = $(ckan -c $CKAN_INI user token add ckan_admin xloader | tail -n 1 | tr -d '\t')" + +# Setup worker +ckan config-tool $CKAN_INI jobs worker \ No newline at end of file diff --git a/samples/.env.example b/samples/.env.example index 2a0e497..de58312 100644 --- a/samples/.env.example +++ b/samples/.env.example @@ -3,7 +3,6 @@ NGINX_CONTAINER_NAME=nginx REDIS_CONTAINER_NAME=redis POSTGRESQL_CONTAINER_NAME=db SOLR_CONTAINER_NAME=solr -DATAPUSHER_CONTAINER_NAME=datapusher CKAN_CONTAINER_NAME=ckan WORKER_CONTAINER_NAME=ckan-worker @@ -28,16 +27,15 @@ TEST_CKAN_DATASTORE_WRITE_URL=postgresql://ckan:ckan@db/datastore_test TEST_CKAN_DATASTORE_READ_URL=postgresql://datastore_ro:datastore@db/datastore_test # CKAN core -CKAN_VERSION=2.10.0 +CKAN_VERSION=2.9.8 CKAN_SITE_ID=default CKAN_SITE_URL=http://localhost:5000 CKAN_PORT=5000 CKAN_PORT_HOST=5000 -CKAN___BEAKER__SESSION__SECRET=39ASDK913r4jas0 +CKAN___BEAKER__SESSION__SECRET=CHANGE_ME # See https://docs.ckan.org/en/latest/maintaining/configuration.html#api-token-settings -CKAN___API_TOKEN__JWT__ENCODE__SECRET=string:WqVhDAXsF7E9FvzVnNqdsKpDT9wZbiu6hzxyMijv4FN3B -CKAN___API_TOKEN__JWT__DECODE__SECRET=string:WqVhDAXsF7E9FvzVnNqdsKpDT9wZbiu6hzxyMijv4FN3B -CKAN___DATAPUSHER__API_TOKEN = api_token +CKAN___API_TOKEN__JWT__ENCODE__SECRET=string:CHANGE_ME +CKAN___API_TOKEN__JWT__DECODE__SECRET=string:CHANGE_ME CKAN_SYSADMIN_NAME=ckan_admin CKAN_SYSADMIN_PASSWORD=test1234 CKAN_SYSADMIN_EMAIL=your_email@example.com @@ -60,10 +58,10 @@ CKAN__RESOURCE_PROXY__MAX_FILE_SIZE=50048576 CKAN__RESOURCE_PROXY__CHUNK_SIZE=4096 ## Default timeout for fetching proxied items CKAN__RESOURCE_PROXY__TIMEOUT=10 -CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view harvest ckan_harvester wmts_view geojson_view geo_view shp_view pdf_view" +CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view recline_grid_view recline_graph_view wmts_view webpage_view geojson_view geo_view shp_view pdf_view" # Solr -SOLR_IMAGE_VERSION=2.10-spatial +SOLR_IMAGE_VERSION=2.9-solr8-spatial CKAN_SOLR_URL=http://solr:8983/solr/ckan TEST_CKAN_SOLR_URL=http://solr:8983/solr/ckan @@ -72,7 +70,7 @@ REDIS_VERSION=6 CKAN_REDIS_URL=redis://redis:6379/1 TEST_CKAN_REDIS_URL=redis://redis:6379/1 -# Datapusher +# Datapusher - Deprecated by ckanext-xloader DATAPUSHER_VERSION=0.0.19 CKAN_DATAPUSHER_URL=http://datapusher:8800 CKAN__DATAPUSHER__CALLBACK_URL_BASE=http://ckan:5000 @@ -84,13 +82,17 @@ NGINX_PORT=80 NGINX_SSLPORT=443 # Extensions -CKAN__PLUGINS="envvars stats text_view image_view recline_view resourcedictionary datastore datapusher harvest ckan_harvester spatial_metadata spatial_query spatial_harvest_metadata_api csw_harvester waf_harvester doc_harvester resource_proxy geo_view geojson_view wmts_view shp_view dcat dcat_rdf_harvester dcat_json_harvester dcat_json_interface scheming_datasets scheming_groups scheming_organizations pdf_view pages" +CKAN__PLUGINS="envvars stats text_view image_view recline_view resourcedictionary datastore xloader harvest ckan_harvester spatial_metadata spatial_query spatial_harvest_metadata_api csw_harvester waf_harvester doc_harvester resource_proxy geo_view geojson_view wmts_view shp_view dcat dcat_rdf_harvester dcat_json_harvester dcat_json_interface scheming_datasets scheming_groups scheming_organizations pdf_view pages" CKAN__HARVEST__MQ__TYPE=redis CKAN__HARVEST__MQ__HOSTNAME=redis CKAN__HARVEST__MQ__PORT=6379 CKAN__HARVEST__MQ__REDIS_DB=1 +# ckanext-xloader +CKANEXT__XLOADER__API_TOKEN=api_token +CKANEXT__XLOADER__JOBS__DB_URI=postgresql://ckan:ckan@db/ckan + # ckanext-dcat CKANEXT__DCAT__BASE_URI=https://localhost:5000 CKANEXT__DCAT__RDF_PROFILES="euro_dcat_ap_2 euro_dcat_ap" @@ -114,6 +116,6 @@ CKANEXT__GEOVIEW__OL_VIEWER__FORMATS="wms wfs geojson gml kml" CKANEXT__GEOVIEW__SHP_VIEWER__SRID=3857 CKANEXT__GEOVIEW__SHP_VIEWER__ENCODING=UTF-8 -#ckanext-sparql +#TODO: ckanext-sparql - Not implemented yet CKANEXT__SPARQL__ENDPOINT_URL=http://dbpedia.org/sparql CKANEXT__SPARQL__HIDE_ENDPOINT_URL=False \ No newline at end of file From 531edd9e0bc34ee00fbc4ce3bfd891d69f88dc80 Mon Sep 17 00:00:00 2001 From: mnjnz <96422458+mjanez@users.noreply.github.com> Date: Thu, 23 Mar 2023 09:59:13 +0100 Subject: [PATCH 22/34] Update actions - Updated build.yml to test only auxiliary images. - Update docker.yml to build and upload the image to the Github registry. --- .github/workflows/build.yml | 11 +---- .github/workflows/docker.yml | 80 ++++++++++++++++++------------------ docker-compose.yml | 2 +- 3 files changed, 43 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95cde00..91123cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build CKAN Docker +name: Build CKAN Docker auxiliary images on: # Trigger the workflow on push or pull request, @@ -45,12 +45,3 @@ jobs: file: ./solr/Dockerfile push: false tags: kowhai/ckan-docker-solr:test-build-only - - - name: CKAN build - uses: docker/build-push-action@v2 - with: - context: ./ckan - file: ./ckan/Dockerfile - push: false - tags: kowhai/ckan-docker-ckan:test-build-only - \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 688cf5f..6c6c3a6 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,48 +1,50 @@ -name: Build CKAN Docker +name: Build & Push CKAN-Spatial Docker image on: - push: - branches: [ 'main' ] - tags: [ 'ckan-*.*.*' ] - pull_request: - branches: [ 'main' ] + # Trigger the workflow after build.yml, + # but only for the master branch + workflow_run: + workflows: ["Build CKAN Docker auxiliary images"] + branches: [master] + types: + - completed env: REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + IMAGE_NAME: mjanez/ckan-spatial -jobs: - docker: + +jobs: + build: runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + steps: + - uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Login to registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout - uses: actions/checkout@v1 - - - name: Login to registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: CKAN Build and push - uses: docker/build-push-action@v3 - with: - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - context: ./ckan - file: ./ckan/Dockerfile + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: CKAN Build and push + uses: docker/build-push-action@v3 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + context: ./ckan + file: ./ckan/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index b5d7b96..e51be94 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,7 @@ services: dockerfile: Dockerfile args: - TZ=${TZ} - image: ghcr.io/mjanez/ckan-docker:ckan-2.9.8 + image: ghcr.io/mjanez/ckan-spatial:master env_file: - .env depends_on: From 58e9c9a2d50e3fd2d28767eb15d95b6826451db4 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Thu, 23 Mar 2023 10:34:40 +0100 Subject: [PATCH 23/34] Update PostgreSQL 15 --- README.md | 12 +++++++++--- postgresql/Dockerfile | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bd4ae58..83e8cb5 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ The non-CKAN images are as follows: | Repository | Type | Docker tag | Size | Notes | | --- | --- | --- | --- | --- | -| PostgreSQL 12.14 | base image | [`postgres/postgres:12-alpine`](https://hub.docker.com/layers/library/postgres/12-alpine/images/sha256-e07198f71e85eccd6c351bb4eb0b2ff833bef2dd6ea314f6442c2dc47535fbb7?context=explore) | 87.09 MB | Custom Dockerfile: [`postgresql/Dockerfile`](/postgresql/Dockerfile) | +| PostgreSQL 15.2 | base image | [`postgres/postgres:15-alpine`](https://hub.docker.com/layers/library/postgres/15-alpine/images/sha256-53a02ecbe9d18ff6476e6651c34811da39f054424c725fc15d2b480fc3fab877?context=explore) | 89.74 MB | Custom Dockerfile: [`postgresql/Dockerfile`](/postgresql/Dockerfile) | | Solr 8.11.1 | base image | [`ckan/ckan-solr:2.9-solr8-spatial`](https://registry.hub.docker.com/layers/ckan/ckan-solr/2.9-solr8-spatial/images/sha256-b5ee4979891c7dd1f10d2ac2cbdd4d80ff656879edb0f0493616be7b4cf8bc3a?context=explore) | 331.1 MB | - | | Redis 6.2.11 | base image | [`redis/redis:6`](https://hub.docker.com/layers/library/redis/6/images/sha256-e10c69dc5f9b27c47874060962fdaa26ec0df592205d6d21402945267081b434?context=explore) | 39.32 MB | - | | NGINX 1.22.1 | base image | [`nginx:stable-alpine`](https://hub.docker.com/layers/library/nginx/stable-alpine/images/sha256-ff2a5d557ca22fa93669f5e70cfbeefda32b98f8fd3d33b38028c582d700f93a?context=explore) | 9.74 MB | Custom Dockerfile: [`nginx/Dockerfile`](/nginx/Dockerfile) | @@ -210,7 +210,13 @@ You can use the ckan [extension](https://docs.ckan.org/en/latest/extensions/tuto docker compose -f docker compose.dev.yml exec ckan-dev /bin/sh -c "ckan generate extension --output-dir /srv/app/src_extensions" -![Screenshot 2023-02-22 at 1 45 55 pm](https://user-images.githubusercontent.com/54408245/220623568-b4e074c7-6d07-4d27-ae29-35ce70961463.png) +|CONTAINER ID |IMAGE |COMMAND|CREATED|STATUS|PORTS|NAMES| +|------------|----------------------------------|--------------------|-------|-------|------|-----| +|0217537f717e|ckan-docker-nginx |/docker-entrypoint.…|6 minutes ago |Up 4 minutes|81/tcp,0.0.0.0:81->80/tcp, 0.0.0.0:8443->443/tcp|nginx | +|7b06ab2e060a|ghcr.io/mjanez/ckan-spatial:master|/srv/app/start_ckan…|6 minutes ago |Up 5 minutes (healthy)|0.0.0.0:5000->5000/tcp|ckan | | +|1b8d9789c29a|redis:6 |docker-entrypoint.s…|6 minutes ago |Up 5 minutes (healthy)|6379/tcp |redis | | +|7f162741254d|ckan/ckan-solr:2.9-solr8-spatial |docker-entrypoint.s…|6 minutes ago |Up 5 minutes (healthy)|8983/tcp |solr | | +|2cdd25cea0de|ckan-docker-db |docker-entrypoint.s…|6 minutes ago |Up 5 minutes (healthy)|5432/tcp |db | | The new extension files and directories are created in the `/srv/app/src_extensions/` folder in the running container. They will also exist in the local src/ directory as local `/src` directory is mounted as `/srv/app/src_extensions/` on the ckan container. You might need to change the owner of its folder to have the appropiate permissions. @@ -374,4 +380,4 @@ Available components: [^2]: Development environment. [^3]: Production environment. [^4]: [ckan_geodcatap](https://github.com/mjanez/ckanext-scheming/blob/036b8c6503059e0d42b0eba180d5bd39205c64a3/ckanext/scheming/ckan_geodcatap.yaml), more info: https://github.com/mjanez/ckanext-scheming/pull/1 -[^5]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. +[^5]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. \ No newline at end of file diff --git a/postgresql/Dockerfile b/postgresql/Dockerfile index e912383..42ea06f 100755 --- a/postgresql/Dockerfile +++ b/postgresql/Dockerfile @@ -1,4 +1,4 @@ -FROM postgres:12-alpine +FROM postgres:15-alpine # 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 From 8bd0b13b999d00e0bb50260944c58f7b87552a9a Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Thu, 23 Mar 2023 13:51:30 +0100 Subject: [PATCH 24/34] Update to ckanext-harvest 1.5.1 Fix url routing https://github.com/ckan/ckanext-harvest/pull/523 --- README.md | 2 +- ckan/Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bd4ae58..62ff06a 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Information about extensions installed in the `main` image. More info described | Core + | [Datastore](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose. | | Core + | [~~Datapusher~~](https://github.com/mjanez/ckan-docker) | 0.0.19 | Deprecated | ❌ | ❌ | Updated to [xloader](https://github.com/ckan/ckanext-xloader), an express Loader - quickly load data into DataStore. | | Extension | [ckanext-xloader](https://github.com/ckan/ckanext-xloader) | 0.12.2 | Completed | ✔️ | ✔️ | Stable installation, a replacement for DataPusher because it offers ten times the speed and more robustness | -| Extension | [ckanext-harvest](https://github.com/ckan/ckanext-harvest) | 1.5.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | +| Extension | [ckanext-harvest](https://github.com/ckan/ckanext-harvest) | 1.5.1 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | | Extension | [ckanext-geoview](https://github.com/ckan/ckanext-geoview) | 0.0.20 | Completed | ✔️ | ✔️ | Stable installation. | | Extension | [ckanext-spatial](https://github.com/ckan/ckanext-spatial) | 2.0.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | | Extension | [ckanext-dcat](https://github.com/mjanez/ckanext-dcat) | 1.2.0 | Completed | ✔️ | ✔️ | Stable installation, include DCAT-AP 2.1 profile compatible with GeoDCAT-AP. | diff --git a/ckan/Dockerfile b/ckan/Dockerfile index 49a621b..1dff8d6 100644 --- a/ckan/Dockerfile +++ b/ckan/Dockerfile @@ -120,9 +120,9 @@ RUN pip3 install -e 'git+https://github.com/ckan/ckanext-xloader.git@0.12.2#egg= pip3 install -r ${APP_DIR}/src/ckanext-xloader/requirements.txt && \ pip3 install -U requests[security] -### Harvester - v1.5.0 ### +### Harvester - v1.5.1 ### RUN echo "ckan/ckanext-harvest" && \ - pip3 install -e 'git+https://github.com/ckan/ckanext-harvest.git@v1.5.0#egg=ckanext-harvest' && \ + pip3 install -e 'git+https://github.com/ckan/ckanext-harvest.git@v1.5.1#egg=ckanext-harvest' && \ pip3 install -r ${APP_DIR}/src/ckanext-harvest/pip-requirements.txt ### Geoview - v0.0.20 ### From 64b07daf630de7febdb0899e3521114a63f23ecc Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Thu, 23 Mar 2023 13:54:14 +0100 Subject: [PATCH 25/34] Update dev mode --- ckan/Dockerfile.dev | 52 ++------------- ckan/Dockerfile.spatial-vanilla | 112 ++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 48 deletions(-) create mode 100644 ckan/Dockerfile.spatial-vanilla diff --git a/ckan/Dockerfile.dev b/ckan/Dockerfile.dev index 1e7b26e..0f72975 100644 --- a/ckan/Dockerfile.dev +++ b/ckan/Dockerfile.dev @@ -1,5 +1,5 @@ # syntax = edrevo/dockerfile-plus -INCLUDE+ Dockerfile +INCLUDE+ Dockerfile.spatial-vanilla # Set up environment variables ENV APP_DIR=/srv/app @@ -25,54 +25,10 @@ RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ # # For instance: # -### XLoader ### -#RUN pip3 install -e 'git+https://github.com/ckan/ckanext-xloader.git@master#egg=ckanext-xloader' && \ -# pip3 install -r ${APP_DIR}/src/ckanext-xloader/requirements.txt && \ -# pip3 install -U requests[security] - - ###TODO: XLoader ### -RUN pip3 install -e 'git+https://github.com/ckan/ckanext-xloader.git@master#egg=ckanext-xloader' && \ - pip3 install -r ${APP_DIR}/src/ckanext-xloader/requirements.txt && \ - pip3 install -U requests[security] - -### Harvester ### -RUN echo "ckan/ckanext-harvester" && \ - pip3 install -e 'git+https://github.com/ckan/ckanext-harvest.git@master#egg=ckanext-harvest' && \ - pip3 install -r ${APP_DIR}/src/ckanext-harvest/pip-requirements.txt -# will also require gather_consumer and fetch_consumer processes running (please see https://github.com/ckan/ckanext-harvest) - -### Resource dictionary-Fix version ### -RUN echo "mjanez/ckanext-resourcedictionary" && \ - pip3 install -e git+https://github.com/mjanez/ckanext-resourcedictionary.git#egg=ckanext-resourcedictionary && \ - pip3 install -r ${APP_DIR}/src/ckanext-resourcedictionary/requirements.txt - -### Geoview ### -RUN echo "ckan/ckanext-geoview" && \ - pip3 install -e git+https://github.com/ckan/ckanext-geoview.git#egg=ckanext-geoview - -### Spatial ### Check solr geoindexing: https://docs.ckan.org/projects/ckanext-spatial/en/latest/spatial-search.html // https://github.com/ckan/ckanext-spatial/issues/195 -#TODO: 2.10 support reqs: https://github.com/ckan/ckanext-spatial/pull/308 -RUN echo "ckan/ckanext-spatial" && \ - pip3 install -e git+https://github.com/ckan/ckanext-spatial.git#egg=ckanext-spatial && \ - pip3 install -r https://raw.githubusercontent.com/ckan/ckanext-spatial/bae9290395b252ee8e40056256fa694569d1d78b/requirements.txt - -### Scheming-GeoDCAT-AP extended version ### -RUN echo "mjanez/ckanext-scheming (GeoDCAT-AP extended version)" && \ - pip3 install -e git+https://github.com/mjanez/ckanext-scheming.git#egg=ckanext-scheming - -### Pages ### -RUN echo "ckan/ckanext-pages" && \ - pip3 install -e git+https://github.com/ckan/ckanext-pages.git#egg=ckanext-pages - -### PDFView ### -RUN echo "ckan/ckanext-pdfview" && \ - pip3 install -e git+https://github.com/ckan/ckanext-pdfview.git#egg=ckanext-pdfview - -### DCAT-GeoDCAT-AP extended version ### -RUN echo "mjanez/ckanext-dcat (GeoDCAT-AP extended version)" && \ - pip3 install -e git+https://github.com/mjanez/ckanext-dcat.git#egg=ckanext-dcat && \ - pip3 install -r https://raw.githubusercontent.com/mjanez/ckanext-dcat/master/requirements.txt +# RUN pip3 install -e 'git+https://github.com/ckan/ckanext-xloader.git@master#egg=ckanext-xloader' && \ +# pip3 install -r ${APP_DIR}/src/ckanext-xloader/requirements.txt && \ +# pip3 install -U requests[security] ###TODO: ckanext-visualize #https://github.com/keitaroinc/ckanext-visualize diff --git a/ckan/Dockerfile.spatial-vanilla b/ckan/Dockerfile.spatial-vanilla new file mode 100644 index 0000000..2e4acb5 --- /dev/null +++ b/ckan/Dockerfile.spatial-vanilla @@ -0,0 +1,112 @@ +FROM alpine:3.13 + +# Internals, you probably don't need to change these +ENV APP_DIR=/srv/app +ENV SRC_DIR=/srv/app/src +ENV CKAN_INI=${APP_DIR}/ckan.ini +ENV PIP_SRC=${SRC_DIR} +ENV CKAN_STORAGE_PATH=/var/lib/ckan +ENV GIT_URL=https://github.com/ckan/ckan.git +ENV TZ=UTC +RUN echo ${TZ} > /etc/timezone +# CKAN version to build +ENV GIT_BRANCH=ckan-2.9.8 +# Customize these on the .env file if needed +ENV CKAN_SITE_URL=http://localhost:5000 +ENV CKAN__PLUGINS image_view text_view recline_view datastore datapusher envvars + +# UWSGI options +ENV UWSGI_HARAKIRI=50 + +WORKDIR ${APP_DIR} + +# Install necessary packages to run CKAN +RUN apk add --no-cache tzdata \ + git \ + gettext \ + postgresql-client \ + python3 \ + libxml2 \ + libxslt \ + musl-dev \ + uwsgi \ + uwsgi-http \ + uwsgi-corerouter \ + uwsgi-python \ + py3-gevent \ + uwsgi-gevent \ + libmagic \ + curl \ + patch \ + sudo && \ + # Packages to build CKAN requirements and plugins + apk add --no-cache --virtual .build-deps \ + postgresql-dev \ + gcc \ + make \ + g++ \ + autoconf \ + automake \ + libtool \ + python3-dev \ + libxml2-dev \ + libxslt-dev \ + linux-headers \ + openssl-dev \ + libffi-dev \ + cargo \ + # Set up PROJ + geos-dev \ + proj \ + proj-util \ + proj-dev && \ + # Create SRC_DIR + mkdir -p ${SRC_DIR} && \ + # Install pip, supervisord and uwsgi + curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ + python3 ${SRC_DIR}/get-pip.py && \ + pip3 install supervisor && \ + mkdir /etc/supervisord.d && \ + #pip wheel --wheel-dir=/wheels uwsgi gevent && \ + rm -rf ${SRC_DIR}/get-pip.py + +COPY setup/supervisord.conf /etc + +# Install CKAN +RUN pip3 install -e git+${GIT_URL}@${GIT_BRANCH}#egg=ckan && \ + cd ${SRC_DIR}/ckan && \ + cp who.ini ${APP_DIR} && \ + pip3 install -r requirement-setuptools.txt && \ + pip3 install --no-binary markdown -r requirements.txt && \ + # Install CKAN envvars to support loading config from environment variables + pip3 install -e git+https://github.com/okfn/ckanext-envvars.git#egg=ckanext-envvars && \ + # Create and update CKAN config + ckan generate config ${CKAN_INI} && \ + ckan config-tool ${CKAN_INI} "beaker.session.secret = " && \ + ckan config-tool ${CKAN_INI} "ckan.plugins = ${CKAN__PLUGINS}" + +# Create a local user and group to run the app +RUN addgroup -g 92 -S ckan && \ + adduser -u 92 -h /srv/app -s /bin/bash -D -G ckan ckan + +# Create local storage folder +RUN mkdir -p ${CKAN_STORAGE_PATH} && \ + chown -R ckan:ckan ${CKAN_STORAGE_PATH} + +COPY setup/prerun.py ${APP_DIR} +COPY setup/start_ckan.sh ${APP_DIR} +ADD https://raw.githubusercontent.com/ckan/ckan/${GIT_BRANCH}/wsgi.py ${APP_DIR} + +# Create entrypoint directory for children image scripts +ONBUILD RUN mkdir /docker-entrypoint.d + +RUN chown ckan -R /srv/app + +RUN addgroup sudo && \ + adduser ckan sudo + +EXPOSE 5000 + +HEALTHCHECK --interval=60s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1 + +CMD ["/srv/app/start_ckan.sh"] \ No newline at end of file From 53d2d65cb10d22af216a6e132aa552090dc08d21 Mon Sep 17 00:00:00 2001 From: mnjnz <96422458+mjanez@users.noreply.github.com> Date: Mon, 27 Mar 2023 12:26:51 +0200 Subject: [PATCH 26/34] Add custom images of base Dockerfiles Now use ghcr.io/mjanez/ckan-base-spatial:master --- README.md | 19 +++--- ckan/Dockerfile | 110 +------------------------------ ckan/Dockerfile.dev | 9 +-- ckan/Dockerfile.spatial-vanilla | 112 -------------------------------- 4 files changed, 15 insertions(+), 235 deletions(-) delete mode 100644 ckan/Dockerfile.spatial-vanilla diff --git a/README.md b/README.md index 62ff06a..c9c3e61 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,11 @@ Contains Docker images for the different components of CKAN Cloud and a Docker c >This is a **custom installation of Docker Compose** with specific extensions for spatial data and [GeoDCAT-AP](https://github.com/SEMICeu/GeoDCAT-AP)/[INSPIRE](https://github.com/INSPIRE-MIF/technical-guidelines) metadata [profiles](https://en.wikipedia.org/wiki/Geospatial_metadata). For official installations, please have a look: [CKAN documentation: Installation](https://docs.ckan.org/en/latest/maintaining/installing/index.html). Available components: -* CKAN custom image based on the official CKAN repo [ckan-docker-base](https://github.com/ckan/ckan-docker-base) +* CKAN custom image based on the official CKAN repo [ckan-docker-spatial](https://github.com/mjanez/ckan-docker-spatial)[^1] The non-CKAN images are as follows: * PostgreSQL: Official PostgreSQL image. Database files are stored in a named volume. -* Solr: CKAN's [pre-configured Solr image](https://github.com/ckan/ckan-solr). The index data is stored in a named volume and has a spatial schema. [^1] +* Solr: CKAN's [pre-configured Solr image](https://github.com/ckan/ckan-solr). The index data is stored in a named volume and has a spatial schema. [^2] * Redis: standard Redis image * NGINX: latest stable nginx image that includes SSL and Non-SSL endpoints @@ -50,7 +50,7 @@ Information about extensions installed in the `main` image. More info described > Switch branches to see the `roadmap` for other projects: [ckan-docker/branches](https://github.com/mjanez/ckan-docker/branches) -| **Element** | **Description** | **version** | **Status** | **DEV**[^2] | **PRO**[^3] | **Remarks** | +| **Element** | **Description** | **version** | **Status** | **DEV**[^3] | **PRO**[^4] | **Remarks** | |-------------|-----------------------------------------------------------------------------------------|-------------|------------------------------|---------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Core | [CKAN](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation for version 2.9.8 (Production & Dev images) via Docker Compose based on [official images](https://github.com/ckan/ckan-docker-base)). Initial configuration, basic customisation and operation guide. | | Core + | [Datastore](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose. | @@ -60,7 +60,7 @@ Information about extensions installed in the `main` image. More info described | Extension | [ckanext-geoview](https://github.com/ckan/ckanext-geoview) | 0.0.20 | Completed | ✔️ | ✔️ | Stable installation. | | Extension | [ckanext-spatial](https://github.com/ckan/ckanext-spatial) | 2.0.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | | Extension | [ckanext-dcat](https://github.com/mjanez/ckanext-dcat) | 1.2.0 | Completed | ✔️ | ✔️ | Stable installation, include DCAT-AP 2.1 profile compatible with GeoDCAT-AP. | -| Extension | [ckanext-scheming](https://github.com/mjanez/ckanext-scheming) | 3.0.0 | WIP | ✔️ | ✔️ | Stable installation. Customised ckanext schema[^4] based on the [Spanish Metadata Core](https://datos.gob.es/es/doc-tags/nti-risp) with the aim of completing the minimum metadata elements included in the current datasets in accordance with [GeoDCAT-AP](https://semiceu.github.io/GeoDCAT-AP/releases/) and [INSPIRE](https://inspire.ec.europa.eu/about-inspire). | +| Extension | [ckanext-scheming](https://github.com/mjanez/ckanext-scheming) | 3.0.0 | WIP | ✔️ | ✔️ | Stable installation. Customised ckanext schema[^5] based on the [Spanish Metadata Core](https://datos.gob.es/es/doc-tags/nti-risp) with the aim of completing the minimum metadata elements included in the current datasets in accordance with [GeoDCAT-AP](https://semiceu.github.io/GeoDCAT-AP/releases/) and [INSPIRE](https://inspire.ec.europa.eu/about-inspire). | | Extension | [ckanext-resourcedictionary](https://github.com/OpenDataGIS/ckanext-resourcedictionary) | main | Completed | ✔️ | ✔️ | Stable installation. This extension extends the default CKAN Data Dictionary functionality by adding possibility to create data dictionary before actual data is uploaded to datastore. | | Extension | [ckanext-pages](https://github.com/ckan/ckanext-pages) | 0.5.1 | Completed | ✔️ | ✔️ | Stable installation. This extension gives you an easy way to add simple pages to CKAN. | | Extension | [ckanext-pdfview](https://github.com/ckan/ckanext-pdfview) | 0.0.8 | Completed | ✔️ | ✔️ | Stable installation. This extension provides a view plugin for PDF files using an html object tag. | @@ -370,8 +370,9 @@ Available components: * **ckan2pycsw**: Software to achieve interoperability with the open data portals based on CKAN. To do this, ckan2pycsw reads data from an instance using the CKAN API, generates ISO-19115/ISO-19139 metadata using [pygeometa](https://geopython.github.io/pygeometa/), or a custom schema that is based on a customized CKAN schema, and populates a [pycsw](https://pycsw.org/) instance that exposes the metadata using CSW and OAI-PMH. -[^1]: Contains fields needed for the [ckanext-spatial geo search](https://docs.ckan.org/projects/ckanext-spatial/en/latest/spatial-search.html) -[^2]: Development environment. -[^3]: Production environment. -[^4]: [ckan_geodcatap](https://github.com/mjanez/ckanext-scheming/blob/036b8c6503059e0d42b0eba180d5bd39205c64a3/ckanext/scheming/ckan_geodcatap.yaml), more info: https://github.com/mjanez/ckanext-scheming/pull/1 -[^5]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. +[^1]: Official CKAN repo: https://github.com/ckan/ckan-docker-base +[^2]: Contains fields needed for the [ckanext-spatial geo search](https://docs.ckan.org/projects/ckanext-spatial/en/latest/spatial-search.html) +[^3]: Development environment. +[^4]: Production environment. +[^5]: [ckan_geodcatap](https://github.com/mjanez/ckanext-scheming/blob/036b8c6503059e0d42b0eba180d5bd39205c64a3/ckanext/scheming/ckan_geodcatap.yaml), more info: https://github.com/mjanez/ckanext-scheming/pull/1 +[^6]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. diff --git a/ckan/Dockerfile b/ckan/Dockerfile index 1dff8d6..1b3552e 100644 --- a/ckan/Dockerfile +++ b/ckan/Dockerfile @@ -1,117 +1,13 @@ -FROM alpine:3.13 +FROM ghcr.io/mjanez/ckan-base-spatial:master -# Internals, you probably don't need to change these +# Set up environment variables ENV APP_DIR=/srv/app -ENV SRC_DIR=/srv/app/src -ENV CKAN_INI=${APP_DIR}/ckan.ini -ENV PIP_SRC=${SRC_DIR} -ENV CKAN_STORAGE_PATH=/var/lib/ckan -ENV GIT_URL=https://github.com/ckan/ckan.git ENV TZ=UTC RUN echo ${TZ} > /etc/timezone -# CKAN version to build -ENV GIT_BRANCH=ckan-2.9.8 -# Customize these on the .env file if needed -ENV CKAN_SITE_URL=http://localhost:5000 -ENV CKAN__PLUGINS image_view text_view recline_view datastore datapusher envvars - -# UWSGI options -ENV UWSGI_HARAKIRI=50 - -WORKDIR ${APP_DIR} - -# Install necessary packages to run CKAN -RUN apk add --no-cache tzdata \ - git \ - gettext \ - postgresql-client \ - python3 \ - libxml2 \ - libxslt \ - musl-dev \ - uwsgi \ - uwsgi-http \ - uwsgi-corerouter \ - uwsgi-python \ - py3-gevent \ - uwsgi-gevent \ - libmagic \ - curl \ - patch \ - sudo && \ - # Packages to build CKAN requirements and plugins - apk add --no-cache --virtual .build-deps \ - postgresql-dev \ - gcc \ - make \ - g++ \ - autoconf \ - automake \ - libtool \ - python3-dev \ - libxml2-dev \ - libxslt-dev \ - linux-headers \ - openssl-dev \ - libffi-dev \ - cargo \ - # Set up PROJ - geos-dev \ - proj \ - proj-util \ - proj-dev && \ - # Create SRC_DIR - mkdir -p ${SRC_DIR} && \ - # Install pip, supervisord and uwsgi - curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ - python3 ${SRC_DIR}/get-pip.py && \ - pip3 install supervisor && \ - mkdir /etc/supervisord.d && \ - #pip wheel --wheel-dir=/wheels uwsgi gevent && \ - rm -rf ${SRC_DIR}/get-pip.py - -COPY setup/supervisord.conf /etc - -# Install CKAN -RUN pip3 install -e git+${GIT_URL}@${GIT_BRANCH}#egg=ckan && \ - cd ${SRC_DIR}/ckan && \ - cp who.ini ${APP_DIR} && \ - pip3 install -r requirement-setuptools.txt && \ - pip3 install --no-binary markdown -r requirements.txt && \ - # Install CKAN envvars to support loading config from environment variables - pip3 install -e git+https://github.com/okfn/ckanext-envvars.git#egg=ckanext-envvars && \ - # Create and update CKAN config - ckan generate config ${CKAN_INI} && \ - ckan config-tool ${CKAN_INI} "beaker.session.secret = " && \ - ckan config-tool ${CKAN_INI} "ckan.plugins = ${CKAN__PLUGINS}" - -# Create a local user and group to run the app -RUN addgroup -g 92 -S ckan && \ - adduser -u 92 -h /srv/app -s /bin/bash -D -G ckan ckan - -# Create local storage folder -RUN mkdir -p ${CKAN_STORAGE_PATH} && \ - chown -R ckan:ckan ${CKAN_STORAGE_PATH} - -COPY setup/prerun.py ${APP_DIR} -COPY setup/start_ckan.sh ${APP_DIR} -ADD https://raw.githubusercontent.com/ckan/ckan/${GIT_BRANCH}/wsgi.py ${APP_DIR} - -# Create entrypoint directory for children image scripts -ONBUILD RUN mkdir /docker-entrypoint.d - -RUN chown ckan -R /srv/app - -RUN addgroup sudo && \ - adduser ckan sudo - -EXPOSE 5000 - -HEALTHCHECK --interval=60s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1 # Make sure both files are not exactly the same RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ - cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\ + cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\ fi ; # Extensions diff --git a/ckan/Dockerfile.dev b/ckan/Dockerfile.dev index 0f72975..6f2d24b 100644 --- a/ckan/Dockerfile.dev +++ b/ckan/Dockerfile.dev @@ -1,18 +1,13 @@ -# syntax = edrevo/dockerfile-plus -INCLUDE+ Dockerfile.spatial-vanilla +FROM ghcr.io/mjanez/ckan-base-spatial:master # Set up environment variables ENV APP_DIR=/srv/app ENV TZ=UTC RUN echo ${TZ} > /etc/timezone -# Set up PROJ -# PROJ4 for ckanext-spatial: https://github.com/pyproj4/pyproj/issues/582 // https://github.com/nickumia-reisys/ckanext-geodatagov/commit/ed61ffdd118e21e7a1db482c75738c3f261aa180 -RUN apk add geos-dev proj proj-util proj-dev - # Make sure both files are not exactly the same RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ - cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\ + cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\ fi ; # Install any extensions needed by your CKAN instance diff --git a/ckan/Dockerfile.spatial-vanilla b/ckan/Dockerfile.spatial-vanilla deleted file mode 100644 index 2e4acb5..0000000 --- a/ckan/Dockerfile.spatial-vanilla +++ /dev/null @@ -1,112 +0,0 @@ -FROM alpine:3.13 - -# Internals, you probably don't need to change these -ENV APP_DIR=/srv/app -ENV SRC_DIR=/srv/app/src -ENV CKAN_INI=${APP_DIR}/ckan.ini -ENV PIP_SRC=${SRC_DIR} -ENV CKAN_STORAGE_PATH=/var/lib/ckan -ENV GIT_URL=https://github.com/ckan/ckan.git -ENV TZ=UTC -RUN echo ${TZ} > /etc/timezone -# CKAN version to build -ENV GIT_BRANCH=ckan-2.9.8 -# Customize these on the .env file if needed -ENV CKAN_SITE_URL=http://localhost:5000 -ENV CKAN__PLUGINS image_view text_view recline_view datastore datapusher envvars - -# UWSGI options -ENV UWSGI_HARAKIRI=50 - -WORKDIR ${APP_DIR} - -# Install necessary packages to run CKAN -RUN apk add --no-cache tzdata \ - git \ - gettext \ - postgresql-client \ - python3 \ - libxml2 \ - libxslt \ - musl-dev \ - uwsgi \ - uwsgi-http \ - uwsgi-corerouter \ - uwsgi-python \ - py3-gevent \ - uwsgi-gevent \ - libmagic \ - curl \ - patch \ - sudo && \ - # Packages to build CKAN requirements and plugins - apk add --no-cache --virtual .build-deps \ - postgresql-dev \ - gcc \ - make \ - g++ \ - autoconf \ - automake \ - libtool \ - python3-dev \ - libxml2-dev \ - libxslt-dev \ - linux-headers \ - openssl-dev \ - libffi-dev \ - cargo \ - # Set up PROJ - geos-dev \ - proj \ - proj-util \ - proj-dev && \ - # Create SRC_DIR - mkdir -p ${SRC_DIR} && \ - # Install pip, supervisord and uwsgi - curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ - python3 ${SRC_DIR}/get-pip.py && \ - pip3 install supervisor && \ - mkdir /etc/supervisord.d && \ - #pip wheel --wheel-dir=/wheels uwsgi gevent && \ - rm -rf ${SRC_DIR}/get-pip.py - -COPY setup/supervisord.conf /etc - -# Install CKAN -RUN pip3 install -e git+${GIT_URL}@${GIT_BRANCH}#egg=ckan && \ - cd ${SRC_DIR}/ckan && \ - cp who.ini ${APP_DIR} && \ - pip3 install -r requirement-setuptools.txt && \ - pip3 install --no-binary markdown -r requirements.txt && \ - # Install CKAN envvars to support loading config from environment variables - pip3 install -e git+https://github.com/okfn/ckanext-envvars.git#egg=ckanext-envvars && \ - # Create and update CKAN config - ckan generate config ${CKAN_INI} && \ - ckan config-tool ${CKAN_INI} "beaker.session.secret = " && \ - ckan config-tool ${CKAN_INI} "ckan.plugins = ${CKAN__PLUGINS}" - -# Create a local user and group to run the app -RUN addgroup -g 92 -S ckan && \ - adduser -u 92 -h /srv/app -s /bin/bash -D -G ckan ckan - -# Create local storage folder -RUN mkdir -p ${CKAN_STORAGE_PATH} && \ - chown -R ckan:ckan ${CKAN_STORAGE_PATH} - -COPY setup/prerun.py ${APP_DIR} -COPY setup/start_ckan.sh ${APP_DIR} -ADD https://raw.githubusercontent.com/ckan/ckan/${GIT_BRANCH}/wsgi.py ${APP_DIR} - -# Create entrypoint directory for children image scripts -ONBUILD RUN mkdir /docker-entrypoint.d - -RUN chown ckan -R /srv/app - -RUN addgroup sudo && \ - adduser ckan sudo - -EXPOSE 5000 - -HEALTHCHECK --interval=60s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1 - -CMD ["/srv/app/start_ckan.sh"] \ No newline at end of file From f50edb467a305d94a8920262a55874b49752a98d Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Mon, 27 Mar 2023 17:53:35 +0200 Subject: [PATCH 27/34] Fix setup_xloader Assign default qeue --- ckan/docker-entrypoint.d/setup_xloader.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ckan/docker-entrypoint.d/setup_xloader.sh b/ckan/docker-entrypoint.d/setup_xloader.sh index 5f738c1..556de7a 100644 --- a/ckan/docker-entrypoint.d/setup_xloader.sh +++ b/ckan/docker-entrypoint.d/setup_xloader.sh @@ -11,4 +11,5 @@ echo "Set up ckanext.xloader.api_token in the CKAN config file" ckan config-tool $CKAN_INI "ckanext.xloader.api_token = $(ckan -c $CKAN_INI user token add ckan_admin xloader | tail -n 1 | tr -d '\t')" # Setup worker -ckan config-tool $CKAN_INI jobs worker \ No newline at end of file +echo "Set up CKAN jobs worker" +ckan config-tool $CKAN_INI jobs worker default \ No newline at end of file From 7db161188eaa8d210b7b818c5cbdde92a8fcd53c Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Mon, 27 Mar 2023 17:54:49 +0200 Subject: [PATCH 28/34] Remove datapusher - Datapusher out of date with ckanext-xloader - Fix deprecated views --- .env | 9 +-------- samples/.env.example | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/.env b/.env index de58312..5437e53 100644 --- a/.env +++ b/.env @@ -58,7 +58,7 @@ CKAN__RESOURCE_PROXY__MAX_FILE_SIZE=50048576 CKAN__RESOURCE_PROXY__CHUNK_SIZE=4096 ## Default timeout for fetching proxied items CKAN__RESOURCE_PROXY__TIMEOUT=10 -CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view recline_grid_view recline_graph_view wmts_view webpage_view geojson_view geo_view shp_view pdf_view" +CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view wmts_view geojson_view geo_view shp_view pdf_view" # Solr SOLR_IMAGE_VERSION=2.9-solr8-spatial @@ -70,13 +70,6 @@ REDIS_VERSION=6 CKAN_REDIS_URL=redis://redis:6379/1 TEST_CKAN_REDIS_URL=redis://redis:6379/1 -# Datapusher - Deprecated by ckanext-xloader -DATAPUSHER_VERSION=0.0.19 -CKAN_DATAPUSHER_URL=http://datapusher:8800 -CKAN__DATAPUSHER__CALLBACK_URL_BASE=http://ckan:5000 -DATAPUSHER_REWRITE_RESOURCES=True -DATAPUSHER_REWRITE_URL=http://ckan:5000 - # NGINX NGINX_PORT=80 NGINX_SSLPORT=443 diff --git a/samples/.env.example b/samples/.env.example index de58312..5437e53 100644 --- a/samples/.env.example +++ b/samples/.env.example @@ -58,7 +58,7 @@ CKAN__RESOURCE_PROXY__MAX_FILE_SIZE=50048576 CKAN__RESOURCE_PROXY__CHUNK_SIZE=4096 ## Default timeout for fetching proxied items CKAN__RESOURCE_PROXY__TIMEOUT=10 -CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view recline_grid_view recline_graph_view wmts_view webpage_view geojson_view geo_view shp_view pdf_view" +CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view wmts_view geojson_view geo_view shp_view pdf_view" # Solr SOLR_IMAGE_VERSION=2.9-solr8-spatial @@ -70,13 +70,6 @@ REDIS_VERSION=6 CKAN_REDIS_URL=redis://redis:6379/1 TEST_CKAN_REDIS_URL=redis://redis:6379/1 -# Datapusher - Deprecated by ckanext-xloader -DATAPUSHER_VERSION=0.0.19 -CKAN_DATAPUSHER_URL=http://datapusher:8800 -CKAN__DATAPUSHER__CALLBACK_URL_BASE=http://ckan:5000 -DATAPUSHER_REWRITE_RESOURCES=True -DATAPUSHER_REWRITE_URL=http://ckan:5000 - # NGINX NGINX_PORT=80 NGINX_SSLPORT=443 From 424035617f2f3a541f21e89b964eac2a11804a9e Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Thu, 30 Mar 2023 05:28:20 +0000 Subject: [PATCH 29/34] Fix setup worker --- ckan/docker-entrypoint.d/setup_xloader.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckan/docker-entrypoint.d/setup_xloader.sh b/ckan/docker-entrypoint.d/setup_xloader.sh index 5f738c1..9773aac 100644 --- a/ckan/docker-entrypoint.d/setup_xloader.sh +++ b/ckan/docker-entrypoint.d/setup_xloader.sh @@ -11,4 +11,4 @@ echo "Set up ckanext.xloader.api_token in the CKAN config file" ckan config-tool $CKAN_INI "ckanext.xloader.api_token = $(ckan -c $CKAN_INI user token add ckan_admin xloader | tail -n 1 | tr -d '\t')" # Setup worker -ckan config-tool $CKAN_INI jobs worker \ No newline at end of file +ckan config-tool $CKAN_INI jobs worker default \ No newline at end of file From d30bbad8e96bc7f0d326dcc454eafa71d992be56 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Thu, 30 Mar 2023 05:28:30 +0000 Subject: [PATCH 30/34] Fix views --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index de58312..dcb1e46 100644 --- a/.env +++ b/.env @@ -58,7 +58,7 @@ CKAN__RESOURCE_PROXY__MAX_FILE_SIZE=50048576 CKAN__RESOURCE_PROXY__CHUNK_SIZE=4096 ## Default timeout for fetching proxied items CKAN__RESOURCE_PROXY__TIMEOUT=10 -CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view recline_grid_view recline_graph_view wmts_view webpage_view geojson_view geo_view shp_view pdf_view" +CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view recline_view wmts_view geojson_view geo_view shp_view pdf_view" # Solr SOLR_IMAGE_VERSION=2.9-solr8-spatial From a62b09923b1b114955a6943d534219877a2c50dd Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Thu, 30 Mar 2023 05:29:45 +0000 Subject: [PATCH 31/34] Update README.md - Add info about postgres:15-alpine - Update footnotes - Update plugins - Update containers info --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 83e8cb5..d0bde5f 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,11 @@ Contains Docker images for the different components of CKAN Cloud and a Docker c >This is a **custom installation of Docker Compose** with specific extensions for spatial data and [GeoDCAT-AP](https://github.com/SEMICeu/GeoDCAT-AP)/[INSPIRE](https://github.com/INSPIRE-MIF/technical-guidelines) metadata [profiles](https://en.wikipedia.org/wiki/Geospatial_metadata). For official installations, please have a look: [CKAN documentation: Installation](https://docs.ckan.org/en/latest/maintaining/installing/index.html). Available components: -* CKAN custom image based on the official CKAN repo [ckan-docker-base](https://github.com/ckan/ckan-docker-base) +* CKAN custom image based on the official CKAN repo [ckan-docker-spatial](https://github.com/mjanez/ckan-docker-spatial)[^1] The non-CKAN images are as follows: * PostgreSQL: Official PostgreSQL image. Database files are stored in a named volume. -* Solr: CKAN's [pre-configured Solr image](https://github.com/ckan/ckan-solr). The index data is stored in a named volume and has a spatial schema. [^1] +* Solr: CKAN's [pre-configured Solr image](https://github.com/ckan/ckan-solr). The index data is stored in a named volume and has a spatial schema. [^2] * Redis: standard Redis image * NGINX: latest stable nginx image that includes SSL and Non-SSL endpoints @@ -50,17 +50,17 @@ Information about extensions installed in the `main` image. More info described > Switch branches to see the `roadmap` for other projects: [ckan-docker/branches](https://github.com/mjanez/ckan-docker/branches) -| **Element** | **Description** | **version** | **Status** | **DEV**[^2] | **PRO**[^3] | **Remarks** | +| **Element** | **Description** | **version** | **Status** | **DEV**[^3] | **PRO**[^4] | **Remarks** | |-------------|-----------------------------------------------------------------------------------------|-------------|------------------------------|---------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Core | [CKAN](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation for version 2.9.8 (Production & Dev images) via Docker Compose based on [official images](https://github.com/ckan/ckan-docker-base)). Initial configuration, basic customisation and operation guide. | | Core + | [Datastore](https://github.com/mjanez/ckan-docker) | 2.9.8 | Completed | ✔️ | ✔️ | Stable installation (Production & Dev images) via Docker Compose. | | Core + | [~~Datapusher~~](https://github.com/mjanez/ckan-docker) | 0.0.19 | Deprecated | ❌ | ❌ | Updated to [xloader](https://github.com/ckan/ckanext-xloader), an express Loader - quickly load data into DataStore. | | Extension | [ckanext-xloader](https://github.com/ckan/ckanext-xloader) | 0.12.2 | Completed | ✔️ | ✔️ | Stable installation, a replacement for DataPusher because it offers ten times the speed and more robustness | -| Extension | [ckanext-harvest](https://github.com/ckan/ckanext-harvest) | 1.5.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | +| Extension | [ckanext-harvest](https://github.com/ckan/ckanext-harvest) | 1.5.1 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | | Extension | [ckanext-geoview](https://github.com/ckan/ckanext-geoview) | 0.0.20 | Completed | ✔️ | ✔️ | Stable installation. | | Extension | [ckanext-spatial](https://github.com/ckan/ckanext-spatial) | 2.0.0 | Completed | ✔️ | ✔️ | Stable installation, necessary for the implementation of the Collector ([ogc_ckan](#recollector-ckan)) | | Extension | [ckanext-dcat](https://github.com/mjanez/ckanext-dcat) | 1.2.0 | Completed | ✔️ | ✔️ | Stable installation, include DCAT-AP 2.1 profile compatible with GeoDCAT-AP. | -| Extension | [ckanext-scheming](https://github.com/mjanez/ckanext-scheming) | 3.0.0 | WIP | ✔️ | ✔️ | Stable installation. Customised ckanext schema[^4] based on the [Spanish Metadata Core](https://datos.gob.es/es/doc-tags/nti-risp) with the aim of completing the minimum metadata elements included in the current datasets in accordance with [GeoDCAT-AP](https://semiceu.github.io/GeoDCAT-AP/releases/) and [INSPIRE](https://inspire.ec.europa.eu/about-inspire). | +| Extension | [ckanext-scheming](https://github.com/mjanez/ckanext-scheming) | 3.0.0 | WIP | ✔️ | ✔️ | Stable installation. Customised ckanext schema[^5] based on the [Spanish Metadata Core](https://datos.gob.es/es/doc-tags/nti-risp) with the aim of completing the minimum metadata elements included in the current datasets in accordance with [GeoDCAT-AP](https://semiceu.github.io/GeoDCAT-AP/releases/) and [INSPIRE](https://inspire.ec.europa.eu/about-inspire). | | Extension | [ckanext-resourcedictionary](https://github.com/OpenDataGIS/ckanext-resourcedictionary) | main | Completed | ✔️ | ✔️ | Stable installation. This extension extends the default CKAN Data Dictionary functionality by adding possibility to create data dictionary before actual data is uploaded to datastore. | | Extension | [ckanext-pages](https://github.com/ckan/ckanext-pages) | 0.5.1 | Completed | ✔️ | ✔️ | Stable installation. This extension gives you an easy way to add simple pages to CKAN. | | Extension | [ckanext-pdfview](https://github.com/ckan/ckanext-pdfview) | 0.0.8 | Completed | ✔️ | ✔️ | Stable installation. This extension provides a view plugin for PDF files using an html object tag. | @@ -376,8 +376,9 @@ Available components: * **ckan2pycsw**: Software to achieve interoperability with the open data portals based on CKAN. To do this, ckan2pycsw reads data from an instance using the CKAN API, generates ISO-19115/ISO-19139 metadata using [pygeometa](https://geopython.github.io/pygeometa/), or a custom schema that is based on a customized CKAN schema, and populates a [pycsw](https://pycsw.org/) instance that exposes the metadata using CSW and OAI-PMH. -[^1]: Contains fields needed for the [ckanext-spatial geo search](https://docs.ckan.org/projects/ckanext-spatial/en/latest/spatial-search.html) -[^2]: Development environment. -[^3]: Production environment. -[^4]: [ckan_geodcatap](https://github.com/mjanez/ckanext-scheming/blob/036b8c6503059e0d42b0eba180d5bd39205c64a3/ckanext/scheming/ckan_geodcatap.yaml), more info: https://github.com/mjanez/ckanext-scheming/pull/1 -[^5]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. \ No newline at end of file +[^1]: Official CKAN repo: https://github.com/ckan/ckan-docker-base +[^2]: Contains fields needed for the [ckanext-spatial geo search](https://docs.ckan.org/projects/ckanext-spatial/en/latest/spatial-search.html) +[^3]: Development environment. +[^4]: Production environment. +[^5]: [ckan_geodcatap](https://github.com/mjanez/ckanext-scheming/blob/036b8c6503059e0d42b0eba180d5bd39205c64a3/ckanext/scheming/ckan_geodcatap.yaml), more info: https://github.com/mjanez/ckanext-scheming/pull/1 +[^6]: A fork of [COATNor/coat2pycsw](https://github.com/COATnor/coat2pycsw) that has been extended to meet the needs of harvesting GeoDCAT-AP metadata according to INSPIRE ISO19139. \ No newline at end of file From 3ffba6fe0dc1c941f84dfa0a48d9467a5f9e3e6c Mon Sep 17 00:00:00 2001 From: mnjnz <96422458+mjanez@users.noreply.github.com> Date: Sun, 2 Apr 2023 01:30:43 +0200 Subject: [PATCH 32/34] Fix xloader setup TODO: Setup worker background --- ckan/docker-entrypoint.d/setup_xloader.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ckan/docker-entrypoint.d/setup_xloader.sh b/ckan/docker-entrypoint.d/setup_xloader.sh index 556de7a..8aa2569 100644 --- a/ckan/docker-entrypoint.d/setup_xloader.sh +++ b/ckan/docker-entrypoint.d/setup_xloader.sh @@ -10,6 +10,6 @@ ckan config-tool $CKAN_INI \ echo "Set up ckanext.xloader.api_token in the CKAN config file" ckan config-tool $CKAN_INI "ckanext.xloader.api_token = $(ckan -c $CKAN_INI user token add ckan_admin xloader | tail -n 1 | tr -d '\t')" -# Setup worker -echo "Set up CKAN jobs worker" -ckan config-tool $CKAN_INI jobs worker default \ No newline at end of file +#TODO: Setup worker background +#echo "Set up CKAN jobs worker" +#ckan -c $CKAN_INI jobs worker default \ No newline at end of file From 4702b86449d8b27de0b1006e96ce229fea8c809e Mon Sep 17 00:00:00 2001 From: mnjnz <96422458+mjanez@users.noreply.github.com> Date: Sun, 2 Apr 2023 01:36:58 +0200 Subject: [PATCH 33/34] Fix .env.example --- .env.example | 77 ---------------------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 .env.example diff --git a/.env.example b/.env.example deleted file mode 100644 index f31d1ee..0000000 --- a/.env.example +++ /dev/null @@ -1,77 +0,0 @@ -# Container names -NGINX_CONTAINER_NAME=nginx -REDIS_CONTAINER_NAME=redis -POSTGRESQL_CONTAINER_NAME=db -SOLR_CONTAINER_NAME=solr -DATAPUSHER_CONTAINER_NAME=datapusher -CKAN_CONTAINER_NAME=ckan -WORKER_CONTAINER_NAME=ckan-worker - -# Host Ports -CKAN_PORT_HOST=5000 -NGINX_PORT_HOST=81 -NGINX_SSLPORT_HOST=8443 - -# CKAN databases -POSTGRES_USER=ckan -POSTGRES_PASSWORD=ckan -DATASTORE_READONLY_USER=datastore_ro -DATASTORE_READONLY_PASSWORD=datastore -POSTGRES_HOST=db -CKAN_SQLALCHEMY_URL=postgresql://ckan:ckan@db/ckan -CKAN_DATASTORE_WRITE_URL=postgresql://ckan:ckan@db/datastore -CKAN_DATASTORE_READ_URL=postgresql://datastore_ro:datastore@db/datastore - -# Test database connections -TEST_CKAN_SQLALCHEMY_URL=postgres://ckan:ckan@db/ckan_test -TEST_CKAN_DATASTORE_WRITE_URL=postgresql://ckan:ckan@db/datastore_test -TEST_CKAN_DATASTORE_READ_URL=postgresql://datastore_ro:datastore@db/datastore_test - -# CKAN core -CKAN_VERSION=2.10.0 -CKAN_SITE_ID=default -CKAN_SITE_URL=http://ckan:5000 -CKAN_PORT=5000 -CKAN_PORT_HOST=5000 -CKAN___BEAKER__SESSION__SECRET=CHANGE_ME -# See https://docs.ckan.org/en/latest/maintaining/configuration.html#api-token-settings -CKAN___API_TOKEN__JWT__ENCODE__SECRET=string:CHANGE_ME -CKAN___API_TOKEN__JWT__DECODE__SECRET=string:CHANGE_ME -CKAN_SYSADMIN_NAME=ckan_admin -CKAN_SYSADMIN_PASSWORD=test1234 -CKAN_SYSADMIN_EMAIL=your_email@example.com -CKAN_STORAGE_PATH=/var/lib/ckan -CKAN_SMTP_SERVER=smtp.corporateict.domain:25 -CKAN_SMTP_STARTTLS=True -CKAN_SMTP_USER=user -CKAN_SMTP_PASSWORD=pass -CKAN_SMTP_MAIL_FROM=ckan@localhost -TZ=UTC - -# Solr -SOLR_IMAGE_VERSION=2.9-solr8 -CKAN_SOLR_URL=http://solr:8983/solr/ckan -TEST_CKAN_SOLR_URL=http://solr:8983/solr/ckan - -# Redis -REDIS_VERSION=6 -CKAN_REDIS_URL=redis://redis:6379/1 -TEST_CKAN_REDIS_URL=redis://redis:6379/1 - -# Datapusher -DATAPUSHER_VERSION=0.0.19 -CKAN_DATAPUSHER_URL=http://datapusher:8800 -CKAN__DATAPUSHER__CALLBACK_URL_BASE=http://ckan:5000 -DATAPUSHER_REWRITE_RESOURCES=True -DATAPUSHER_REWRITE_URL=http://ckan:5000 - -# NGINX -NGINX_PORT=80 -NGINX_SSLPORT=443 - -# Extensions -CKAN__PLUGINS="envvars image_view text_view recline_view datastore datapusher" -CKAN__HARVEST__MQ__TYPE=redis -CKAN__HARVEST__MQ__HOSTNAME=redis -CKAN__HARVEST__MQ__PORT=6379 -CKAN__HARVEST__MQ__REDIS_DB=1 From e0eb54f61f7fe0a62fdb471439d16a339e4aa915 Mon Sep 17 00:00:00 2001 From: mnjnz <96422458+mjanez@users.noreply.github.com> Date: Sun, 2 Apr 2023 01:43:35 +0200 Subject: [PATCH 34/34] Remove solr build --- .github/workflows/build.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91123cf..6edb7d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,12 +36,4 @@ jobs: context: ./postgresql file: ./postgresql/Dockerfile push: false - tags: kowhai/ckan-docker-postgresql:test-build-only - - - name: Solr build - uses: docker/build-push-action@v2 - with: - context: ./solr - file: ./solr/Dockerfile - push: false - tags: kowhai/ckan-docker-solr:test-build-only + tags: kowhai/ckan-docker-postgresql:test-build-only \ No newline at end of file