PR #74 faced the problem of how to make database and app provisioning independent given that we had formerly been doing some of the database initialization in the ckan-odp-configuration role. Specifically, it was using a paster command to set the correct permissions on the datastore plugin's table. The solution was to check out the CKAN repository on the DB machine and use a script that came with the repo which only requires a few parameters that the Ansible role already has variables for.
Unfortunately, that script went away in CKAN 2.3, in favor of a setup that's simpler if you have a CKAN instance but problematic if you don't.
This recreates a simplified version of the script, basically using the same template file that the 'paster' command uses but getting the context variables from the command line instead of a CKAN config file.
Since I needed a post-upgrade sample database to try this on, this also includes instructions for exporting and anonymizing the database and importing it into development.
Demo
Notes
It's kind of a bummer to be adding such specific logic to the role, but it's not actually that complex, just a template filler. The template itself is the one from the repo, so I think this should be reasonably robust against changes, or at least fail in a fairly obvious way if it needs to change (i.e. if the upstream process adds or removes a context variable).
Testing Instructions
Provision a database instance from scratch. It should work rather than crashing on the "Datastore permissions" step.
Provision the app instance. It should work properly and be available at http://localhost:8025/
Import a recent (post-upgrade) database export and ~provision~ restart the services on the app instance. Everything should still work normally and the datasets should show up.
Overview
PR #74 faced the problem of how to make
database
andapp
provisioning independent given that we had formerly been doing some of the database initialization in theckan-odp-configuration
role. Specifically, it was using apaster
command to set the correct permissions on thedatastore
plugin's table. The solution was to check out the CKAN repository on the DB machine and use a script that came with the repo which only requires a few parameters that the Ansible role already has variables for.Unfortunately, that script went away in CKAN 2.3, in favor of a setup that's simpler if you have a CKAN instance but problematic if you don't.
This recreates a simplified version of the script, basically using the same template file that the 'paster' command uses but getting the context variables from the command line instead of a CKAN config file.
Since I needed a post-upgrade sample database to try this on, this also includes instructions for exporting and anonymizing the database and importing it into development.
Demo
Notes
It's kind of a bummer to be adding such specific logic to the role, but it's not actually that complex, just a template filler. The template itself is the one from the repo, so I think this should be reasonably robust against changes, or at least fail in a fairly obvious way if it needs to change (i.e. if the upstream process adds or removes a context variable).
Testing Instructions
database
instance from scratch. It should work rather than crashing on the "Datastore permissions" step.app
instance. It should work properly and be available at http://localhost:8025/app
instance. Everything should still work normally and the datasets should show up.