Select Page

A few days ago I submitted a pull request to share my work on Docker for CKAN with the rest of the community.

But it’s a little too big πŸ™‚ … 37 files changed with 1,266 additions and 115 deletions.

So we’ve decided to move the Docker, Fig & Vagrant stuff out of the main CKAN repo, which makes a lot of sense.

In the meantime I’ve officially become a member of the CKAN organisation on Github which is pretty cool!

Extracting the Docker stuff out got me thinking a lot, and I re-factored even more stuff.

I’ve come up with a radically different tree structure:

β”œβ”€β”€ Dockerfile 			# CKAN Dockerfile
β”œβ”€β”€ LICENCE
β”œβ”€β”€ Vagrantfile			# CKAN Vagrantfile
β”œβ”€β”€ _etc 			# config files copied to /etc
β”‚Β Β  β”œβ”€β”€
β”‚Β Β  β”œβ”€β”€ apache2
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ apache.conf
β”‚Β Β  β”‚Β Β  └── apache.wsgi
β”‚Β Β  β”œβ”€β”€ ckan
β”‚Β Β  β”‚Β Β  └── custom_options.ini
β”‚Β Β  β”œβ”€β”€ cron.d
β”‚Β Β  β”‚Β Β  └── ckan
β”‚Β Β  β”œβ”€β”€ my_init.d
β”‚Β Β  β”‚Β Β  └── 55_configure
β”‚Β Β  β”œβ”€β”€ nginx
β”‚Β Β  β”‚Β Β  └── nginx.conf
β”‚Β Β  β”œβ”€β”€ postfix
β”‚Β Β  β”‚Β Β  └──
β”‚Β Β  └── supervisor
β”‚Β Β      └── conf.d
β”œβ”€β”€ _service-provider 		# any service provider used in the portal
β”‚Β Β  β”œβ”€β”€
β”‚Β Β  └── datapusher
β”œβ”€β”€ _solr			# any custom schema
β”‚Β Β  β”œβ”€β”€
β”‚Β Β  └── schema.xml
β”œβ”€β”€ _src 			# CKAN & extensions source code
β”‚Β Β  β”œβ”€β”€
β”‚Β Β  β”œβ”€β”€ ckan
β”‚Β Β  └── ckanext-...
β”œβ”€β”€ docker 			# Dockerfiles & supporting files
β”‚Β Β  β”œβ”€β”€ ckan
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ my_init.d
β”‚Β Β  β”‚Β Β  β”œβ”€β”€
β”‚Β Β  β”‚Β Β  └── svc
β”‚Β Β  β”œβ”€β”€ fig
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Dockerfile
β”‚Β Β  β”‚Β Β  └──
β”‚Β Β  β”œβ”€β”€ insecure_key
β”‚Β Β  β”œβ”€β”€ nginx
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Dockerfile
β”‚Β Β  β”‚Β Β  └──
β”‚Β Β  β”œβ”€β”€ postgres
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Dockerfile
β”‚Β Β  β”‚Β Β  └── svc
β”‚Β Β  └── solr
β”‚Β Β      β”œβ”€β”€ Dockerfile
β”‚Β Β      └── svc
β”œβ”€β”€ fig.yml
β”œβ”€β”€ vagrant			# Vagrant Docker host (used in OS X & Windows)
└── docker-host
    └── Vagrantfile

The point of this structure if that it should be easy to manage your entire project. This should be able to wrap everything you need in there, and package it.

I’ve also consolidated the various Dockerfiles I wrote for CKAN (default, custom & dev) into one πŸ™‚

  • all processes are managed by supervisor, which makes it easier to shut-down Apache in a development context, and use paster instead.
  • Nginx now gone from the CKAN Dockerfile, and this service is now handled by another container as it should
  • The requirement of being able to make live edits on the code for development is covered by mounting a volume as source directory, which overrides the data that was initially copied in the container. Pip requirements remain and I just have to re-install the packages automatically as part of the init process.
  • I’ve added a lot of ONBUILD triggers that allow building children images for dev & prod, which covers what I was initially doing with my custom Dockerfile. -I’ve also extracted the datapusher from the CKAN config, into a separate container.

And there is more…

Check this out on CKAN Github repo