A Vagrant deployment of CKAN using Chef as provisioner.
Sets up remote machine to run Postgres 9.4, Solr, Jetty, CKAN (2.3) and Datastore.
Install Ubuntu, Vagrant, Berkshelf and vagrant plugins:
- Install Ubuntu 14.04 and set up ssh root access
- Install Vagrant v1.7.x
- Install Berkshelf by installing the ChefDK
- Install vagrant-berkshelf plugin with:
$ vagrant plugin install vagrant-berkshelf
- Install vagrant-hostmanager plugin with:
$ vagrant plugin install vagrant-hostmanager
- Install vagrant-managed-servers plugin with:
vagrant plugin install vagrant-managed-servers
vagrant init tknerr/managed-server-dummy; vagrant up --provider managed
Clone this repository, then:
$ vagrant up
Log in to the Vagrant VM:
$ vagrant ssh
Start the development server in the Vagrant VM:
$ cd /usr/lib/ckan/default/src/ckan
$ source ../../bin/activate
$ paster serve /etc/ckan/default/development.ini
View CKAN in your browser at http://localhost:5000
.
If you're working on frontend development and want to watch for changes to less files, run the less
file from the ckan source directory:
$ cd /usr/lib/ckan/default/src/ckan
$ source ../../bin/activate
$ node ./bin/less
Add recipe[ckan::ckan_production]
to your run_list to install the dependencies needed for a production instance of CKAN that uses Apache/Nginx.
To use with Vagrant, uncomment include_recipe "ckan::ckan_production"
in the default recipe ckan/recipes/default.rb
, then,
$ vagrant up
$ vagrant provision
The production instance can be viewed with the host machine's browser at http://default.ckanhosted.dev/
, by default.
To make it easier to edit CKAN source and configuration files from the host machine, Vagrant synced_folders are defined as follows by default.
synced_folders/config
: maps to/etc/ckan/default
on the guest VM.synced_folders/src
: maps to/usr/lib/ckan/default/src
on the guest VM.synced_folders/file_storage
: maps to/var/lib/ckan/default
on the guest VM.
These mappings are defined in the Vagrantfile
.
Some useful Vagrant commands:
$ vagrant up
Create and configure the guest machine.
$ vagrant ssh
Login to the guest machine.
$ vagrant suspend
Suspend the current state of the guest machine.
$ vagrant halt
Attempt a shutdown of the guest machine.
$ vagrant provision
Re-provision the guest machine according to the Chef cookbook.
$ vagrant reload
Restart the guest machine. Add the --provision
flag to also re-provision.
$ vagrant destroy
Stops the guest machine and removes all of its resources. This will destroy the CKAN database and any uncommitted changes to the source code in the guest machine.
See Vagrant documentation for a full list of commands.
recipe[ckan::default]
collects togetherckan_base
andckan_datastore
.recipe[ckan::ckan_base]
sets up everything needed for a CKAN instance ready for development.recipe[ckan::ckan_datastore]
sets up the Datastore extension.recipe[ckan::ckan_production]
sets up an Apache/Nginx server for serving CKAN in production.recipe[ckan::ckan_tests]
sets up test database for ckan and ckanext tests.
CKAN configuration properties and installation locations can be tweaked in the attributes file: /ckan/attributes/default.rb
.
Based on Victor Baptista's chef-ckan.