/dmponline-chef-repo

A barebones Chef repo for using dmponline-chef-recipe

Primary LanguageRuby

DMPOnline + Sword "Getting Started" Chef Repository

Introduction

This Chef repository allows you to quickly build and provision an instance of DMPOnline + Simple Sword Server on a virtual server, either running locally using Virtual Box or on the cloud (e.g. via OpenStack, Rackspace or AWS).

Requirements

In order to run the Chef recipe, you will need:

In addition you may also need:

  • An OpenStack account and node, if deploying to the OpenStack cloud
  • An OpsCode account, if provisioning with Hosted Chef
  • Oracle Virtual Box, if deploying to a local virtual machine
  • Vagrant, if deploying to a local virtual machine
  • A Centos 6 base box, if deploying to a local virtual machine with Vagrant and Virtual Box

Deploying to a local Virtual Box with Vagrant and Chef Solo

  1. First of all, make sure you have successfully installed on the prerequisite software: Ruby, Gem, Git, Chef Solo, Librarian Chef, Virtual Box and Vagrant (see links above). If you have installed software, its a good idea to reload open terminal windows to ensure all the new paths are added to your environment.

  2. Clone this Chef repository onto your computer

     mkdir ~/projects
     cd ~/projects
     git clone https://github.com/CottageLabs/dmponline-chef-repo.git dmponline-chef-repo
    
  3. Install the cookbooks with Librarian Chef

     cd ~/projects/dmponline-chef-repo
     librarian-chef install
    
  4. Review the Vagrantfile with your favourite text editor. Pay special attention to the base box used (e.g. centos63_minimal and its associated URL), and also to the IP port mappings assigned to the virtual machine (e.g. http://localhost:80/ and http://localhost:8080/). Adjust these settings to suit your requirements and base box availability. See www.vagrantbox.es for a list of base boxes. A minimal Centos 6.3 is recommended, but, with tweaking, the recipe should work with most versions of Linux.

     vi Vagrantfile
    
  5. With the Vagrantfile configured, its time to download the base box, provision the server and install DMPOnline. This process will take some time to run, depending on your network and computer speed. Allow around 30-60 minutes to run.

     vagrant up
    
  6. If the command completed successfully, open up a web browser and navigate to http://localhost:80/ (or whatever you set for the IP address/port mapping in the Vagrantfile). If everything worked, you should see the DMPOnline welcome page!

DMPOnline screen shot

You should also see Simple Sword Server running on the other address mapped in the Vagrantfile, http://localhost:8080/ (NB. Simple Sword Server assumes it will be running at http://localhost:8080/)

Simple Sword Server screen shot

Deploying to OpenStack using Hosted Chef

  1. First of all, make sure you have successfully installed on the prerequisite software: Ruby, Gem, Git, Chef Client and Librarian Chef (see links above). If you have installed software, its a good idea to reload open terminal windows to ensure all the new paths are added to your environment. You will also need an OpsCode account to use Hosted Chef (a free trial account should be sufficient) and access to OpenStack where you can build virtual machines.

  2. Configure your Chef's knife.rb file with your keys so that it can access your Hosted Chef organisation and your Openstack account

     #An example knife.rb - update your file for your environment, organisation name and Hosted Chef keys
     current_dir = File.dirname(__FILE__)
     log_level                :info
     log_location             STDOUT
     node_name                "martynw"
     client_key               "#{current_dir}/martynw.pem"
     validation_client_name   "organisationname-validator"
     validation_key           "#{current_dir}/organisationname-validator.pem"
     chef_server_url          "https://api.opscode.com/organizations/organisationname"
     cache_type               'BasicFile'
     cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
     cookbook_path            ["#{current_dir}/../chef/cookbooks"]
    

Verify that your knife.rb file is correctly configured for Hosted Chef by running:

	knife cookbook list
  1. Clone this Chef repository onto your computer

     mkdir ~/projects
     cd ~/projects
     git clone https://github.com/CottageLabs/dmponline-chef-repo.git dmponline-chef-repo
    
  2. Install the cookbooks with Librarian Chef

     cd ~/projects/dmponline-chef-repo
     librarian-chef install
    
  3. Upload the cookbooks to your Hosted Chef

     knife cookbook upload --all
    
  4. Create a Chef role and name the file dmponline.json

     {
      "run_list": [
     		"recipe[dmponline]"
      ],
      "json_class": "Chef::Role",
      "env_run_lists": {
      },
      "chef_type": "role",
      "override_attributes": {
      },
      "description": "",
      "name": "dmponline",
      "default_attributes": {
      }
     }
    
  5. Upload the role to your Hosted Chef

     knife role from file /roles/dmponline.json
    
  6. Generate an SSH key-pair on the OpenStack dashboard (mykey.pem) and save on your local chef folder then bootstrap

     knife bootstrap $OpenStack_VM_IP -x $OpenStack_VM_ACCOUNT --no-host-key-verify -i mykey.pem --sudo -r 'role[dmponline]'
    
  7. If everything worked well you will be able to open a web browser and point to your VM's IP address