How to install CKAN 2.9.0 using Docker Compose

docker Aug 18, 2020

This guide will show you how to install CKAN platform using docker-compose .

What reference should I choose?

Does exist many different guides available on internet about CKAN installation and even the official documentation does offers options like "from package", "from source", and "with Docker Compose".

You can use as reference the original documentation for docker-compose, but I didn't have a good experience. The application fail without useful log information. But searching on internet I found a project from Open Knowledge Foundation with contributions made by CKAN core developers:

okfn/docker-ckan
Docker images and Docker Compose setup for CKAN. Contribute to okfn/docker-ckan development by creating an account on GitHub.

Before start, it's important check the repository's README.md. Things will change over time and you'll need to make some changes to setup your environment.

Before we  start...

This guide will show you how to do a basic CKAN installation. If you need something more customizable, with custom plugins, I strongly recommend you to check the Augusto Herrmann's post.

He is the mind behind the Brazilian Open Data Portal (dados.gov.br) and close to the Open Knowledge Foundation, the organization that maintains the CKAN platform.

How to install and configure CKAN 2.9.0 using Docker – herrmann.tech
After a few years, I try using CKAN again with Docker. Let’s find out just how much straightforward (or not) it is to set up an open data catalog with version 2.9.0 of CKAN.
English version
Como instalar e configurar o CKAN 2.9.0 usando o Docker – herrmann.tech
Depois de alguns anos, tento novamente usar o CKAN com o Docker. Vamos descobrir o quão simples (ou não) é subir um catálogo de dados abertos com a versão 2.9.0 do CKAN.
Portuguese version

Requirements

You will need to install the following packages:

  • git
  • docker
  • docker-compose

Considering the you're using Ubuntu 18.04 or Ubuntu 20.04, run the following lines:

# Update your packages
sudo apt update

# Install packages
sudo apt install -y git docker.io docker-compose

# Add your user to the "docker" group
sudo usermod -aG docker <myUser>

# Restart your system
sudo shutdown -rf 0

Clone the repo and configure

Now that you have everything that you need installed on your system, clone the repository and create you settings file .env.

# Go to the dir where you'll put the files
mkdir ~/projects
cd ~/projects

# Clone the repo
git clone https://github.com/okfn/docker-ckan
cd docker-ckan

# Copy config file
cp .env.example .env

# Edit your ".env"
nano .env

You should notice that this file has a lot of options. You need to change those settings to your environment needs.

Do not use default settings on production!

Example of how to setup CKAN to run locally over port 5000:

Build and start CKAN

With everything setting up, start the environment with docker-compose:

# Run docker-compose
#   -d      : run containers in background
#   --build : build container images before start
docker-compose -d --build

You can check the CKAN logs:

# Check CKAN logs
# (press Ctrl+C to exit)
docker logs -f docker-ckan_ckan

When the initialization is finished, check the URL: http://localhost:5000/

Done

Now you have your CKAN platform running. For production environment is important that you know how Docker works and how to setup your own Container Registry.

For everything that you'll need, here is some tips:

KodeKloud <en>: Docker and Network lessons

KodeKloud
Learn DevOps online from experts with hands-on training on different DevOps tools and become a DevOps engineer from beginner to expert.

LinuxTips <pt-BR>: Docker and Linux lessons

LINUXtips
Bem-vindo ao Canal LinuxTips! Toda semana um novo vídeo, sempre com dicas interessantes sobre Linux e com uma abordagem leve e descontraída.

Reference

Tags

Luiz Felipe F M Costa

I am a quality engineer at Red Hat / Ansible. I love automation tools, games, and coffee. I am also an active contributor to open-source projects on GitHub.