Skip to content

Deploying CKAN (including PostgreSQL, Solr, Redis and Nginx) using Docker Compose

Notifications You must be signed in to change notification settings

TIBHannover/docker-ckan

Repository files navigation

docker-ckan

The deployment is composed of several Docker services, including CKAN itself, PostgreSQL for database management, Solr for search functionality, Redis for caching, and Nginx for handling SSL traffic. Additionally, the deployment includes the DataPusher service for handling resource uploads.

We use Make as main entry point and command line interface to build, run and destroy docker-ckan instances.

Quick Start

git clone https://github.com/TIBHannover/docker-ckan
cd docker-ckan
cp .env.example .env
make up

Open your browser at https://localhost:8443. Login as ckan_admin with password test1234 (see .env).

Key Features

Dockerized CKAN Setup

CKAN and its dependencies (PostgreSQL, Solr, Redis, Nginx) are fully containerized using Docker Compose, making it easy to spin up and manage the entire stack.

Custom Initialization and Configuration

  • The setup includes custom entrypoint scripts that handle initialization tasks, such as:

    • Setting up plugins, including the CKAN datapusher plugin.

    • Automatically generating and configuring security tokens (e.g., JWT, session secrets).

    • Configuring system settings through environment variables and initialization scripts.

  • The initialization process uses Python-based scripts located in the ckan/setup/ folder to manage essential CKAN setup tasks.

Modular Service Architecture

  • The repository is divided into distinct contexts for each service:

    • nginx/: Configures Nginx to act as a reverse proxy for CKAN, handling SSL termination.

    • ckan/: Builds CKAN from the ckan-base image, installs extensions, and applies patches. It also includes custom scripts in docker-entrypoint.d/ to handle plugin setup (like DataPusher).

    • postgresql/: Sets up a PostgreSQL instance with a main CKAN database and a DataStore database.

    • solr/: Provides a Solr instance to power CKAN’s search functionality.

    • redis/: Configures Redis for caching CKAN’s data.

Makefile for Easy Management

A Makefile is provided to streamline the management of Docker Compose commands. Some key targets include:

  • make build: Build the containers. Required after changing Dockerfiles or files added to the containers.

  • make up: Starts the CKAN stack in the background.

  • make down: Stops and removes all containers, networks, and volumes (keeping data).

  • make show-logs: Shows logs from all services in real-time.

  • make destroy: Completely tears down the environment, removing all associated volumes (including persistent data).

Patches and Customizations

The ckan/ context includes support for applying patches to CKAN core and installed extensions. These patches are applied automatically during the build process, allowing for easy customization and updates.

Environment-Driven Configuration

The configuration of services is driven by environment variables defined in the .env file. This allows for flexible configuration of:

  • Service ports, database credentials, plugin activation, and more.

  • CKAN’s core functionality, such as enabling plugins or configuring API tokens for services like DataPusher.

See .env.example for a list of available environment variables.

Folder Structure

  • nginx/: Contains the Nginx Dockerfile and configuration files for serving CKAN over HTTPS.

  • ckan/: Includes the CKAN Dockerfile, custom entrypoint scripts (in docker-entrypoint.d), patches, and setup scripts.

  • postgresql/: Contains the Docker setup for PostgreSQL, including database initialization.

  • setup/: Houses the initialization scripts that handle database setup, plugin configuration, Solr checks, and sysadmin creation.

About

Deploying CKAN (including PostgreSQL, Solr, Redis and Nginx) using Docker Compose

Resources

Stars

Watchers

Forks

Packages