Skip to content

merkelct/ckan-chef

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CKAN-Chef

A Vagrant deployment of CKAN using Chef as provisioner.

Creates an Ubuntu 12.04 VM running Postgres 9.4, Solr, Jetty, CKAN (master) and Datastore.

Installation

Install VirtualBox, Vagrant, Berkshelf and vagrant plugins:

  1. Install VirtualBox
  2. Install Vagrant
  3. Install Berkshelf by installing the ChefDK
  4. Install vagrant-berkshelf plugin with: $ vagrant plugin install vagrant-berkshelf
  5. Install vagrant-hostmanager plugin with: $ vagrant plugin install vagrant-hostmanager
  6. Install vagrant-omnibus plugin with: $ vagrant plugin install vagrant-omnibus

Clone this repository, then:

Update config_sample.json to config.json in /ckan

This is to check out the proper private repos.

{"egit": "<YOUR TOKEN HERE>",
  "git": "<YOUR TOKEN HERE>"}

For Development

$ 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

to get the monsanto theme you will have to git clone https://github.com/MonsantoCo/ckanext-monsanto.git into the sync_folders/src dir then run

paster serve --reload -n nonroot /etc/ckan/default/development.ini

this will run not under root it will run under /frontdoor

you can then create test search data by running

paster create-test-data search -c /etc/ckan/default/development.ini

you need to add a sysadmin user

paster sysadmin add <username> -c /etc/ckan/default/development.ini

you aslo need to add a general user

paster user add <username> -c /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

For Production

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

The production instance can be viewed with the host machine's browser at http://default.ckanhosted.dev/, by default.

Vagrant synced folders

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.

Vagrant commands

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.

Recipes

  • recipe[ckan::default] collects together ckan_base and ckan_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.

Attributes

CKAN configuration properties and installation locations can be tweaked in the attributes file: /ckan/attributes/default.rb.

Based on Victor Baptista's chef-ckan.

About

Install and configure CKAN instance using Vagrant and Chef

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Ruby 84.3%
  • Python 8.2%
  • HTML 7.5%