How to install CKAN 2.9.0 using Docker Compose
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:
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.
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
LinuxTips <pt-BR>: Docker and Linux lessons
Reference
- Official documentation: https://docs.ckan.org/en/2.9/maintaining/installing/install-from-docker-compose.htm