Skip to main content

CKAN: Installation and configuration

Clone and configure .env

The site is configured using environment variables that you can set in the .env file.

  1. Clone project

    cd /path/to/my/project
    git clone https://github.com/mjanez/ckan-docker.git & cd ckan-docker
  2. Copy the .env.example template and modify the resulting .env to suit your needs.

    cp .env.example .env

    Modify the .env variables as needed:

    # Host Ports
    CKAN_PORT_HOST=5000
    NGINX_PORT_HOST=81
    NGINX_SSLPORT_HOST=8443
    APACHE_PORT_HOST=81
    PYCSW_PORT_HOST=8000

    ...

    #NGINX/APACHE
    ## Check CKAN__ROOT_PATH and CKANEXT__DCAT__BASE_URI and CKANEXT__SCHEMINGDCAT_GEOMETADATA_BASE_URI. If you don't need to use domain locations, it is better to use the nginx configuration. Leave blank or use the root `/`.
    PROXY_SERVER_NAME=localhost
    PROXY_CKAN_LOCATION=/catalog
    PROXY_PYCSW_LOCATION=/csw

    ...

    # CKAN_SITE_URL = http:/ or https:/ + PROXY_SERVER_NAME. Optionally the APACHE_HOST_PORT if different from 80
    CKAN_SITE_URL=http://localhost:81
    CKAN__ROOT_PATH=/catalog/{{LANG}}
    CKAN_PORT=5000
    CKAN__FAVICON=/catalog/base/images/ckan.ico
    CKAN__SITE_LOGO=/images/default/ckan-logo.png
    warning

    Using the default values on the .env 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). All ennvars with API_TOKEN are automatically regenerated when CKAN is loaded, no editing is required.

    This should be obviously changed before running this setup as a public CKAN instance.

You are now ready to proceed with deployment.

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.

  1. Build the images:
    docker compose build 
  2. Start the containers:
    docker compose up

This will start up the containers in the current window. By default the containers will log direct to this window with each container 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.

tip
  • Or build & up the containers:
    docker compose up -d --build
  • Or use the Apache HTTP Server version:
    docker compose -f docker-compose.apache.yml up -d --build
Learn more about configuring this ckan-docker

Quick mode

If you just want to test the package and see the general functionality of the platform, you can use the ckan-docker image from the Github container registry:

# Edit the envvars in the .env as you like and start the containers.
docker compose -f docker-compose.ghcr.yml up -d --build
info

It will download the pre-built image and deploy all the containers. Remember to use your own domain by changing localhost in the .env file.

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 build the images:

docker compose -f docker-compose.dev.yml build

To start the containers:

docker compose -f docker-compose.dev.yml up
tip

See CKAN images for more details of what happens when using development mode.

Check the containers are running

At the end of the container start sequence there should be 6 containers running.

After this step, CKAN should be running at http://{PROXY_SERVER_NAME}/{PROXY_CKAN_LOCATION} and ckan-pycsw at http://{PROXY_SERVER_NAME}/{PROXY_PYCSW_LOCATION}, i.e: http://localhost/catalog or http://localhost/csw

CONTAINER IDIMAGECOMMANDCREATEDSTATUSPORTSNAMES
0217537f717eckan-docker-nginx/ckan-docker-apache/docker-entrypoint.…6 minutes agoUp 4 minutes80/tcp,0.0.0.0:80->80/tcp,0.0.0.0:8443->443/tcpckan-docker-nginx-1/ckan-docker-apache-1
7b06ab2e060ackan-docker-ckan/srv/app/start_ckan…6 minutes agoUp 5 minutes (healthy)0.0.0.0:5000->5000/tcpckan-docker-ckan-1
1b8d9789c29aredis:7-alpinedocker-entrypoint.s…6 minutes agoUp 4 minutes (healthy)6379/tcpckan-docker-redis-1
7f162741254dckan/ckan-solr:2.9-solr9-spatialdocker-entrypoint.s…6 minutes agoUp 4 minutes (healthy)8983/tcpckan-docker-solr-1
2cdd25cea0deckan-docker-dbdocker-entrypoint.s…6 minutes agoUp 4 minutes (healthy)5432/tcpckan-docker-db-1
9cdj25dae6grckan-docker-pycswdocker-entrypoint.s…6 minutes agoUp 4 minutes (healthy)8000/tcpckan-docker-pycsw-1