Created
February 12, 2014 17:38
-
-
Save anonymous/8960568 to your computer and use it in GitHub Desktop.
Recipe to install dashing and deploy the dashboard on thin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: program_dashboard | |
# Recipe:: default | |
# | |
include_recipe "ruby_build" | |
branch_name = node['program-dashboard']['branch_or_tag'] | |
ruby_version = node['ruby']['version'] | |
repo_url = node['dashboard_repo'] | |
ruby_prefix_path = node['ruby']['prefix_path'] | |
dashboard_repo_path = node['dashboard_repo_path'] | |
ruby_home = ::File.expand_path('bin',ruby_prefix_path) | |
dashing = ::File.expand_path('dashing', ruby_home) | |
bundle_install = "#{::File.expand_path('bundle', ruby_home)} install" | |
package 'git' do | |
action :install | |
not_if "which git" | |
end | |
ruby_build_ruby ruby_version do | |
user "root" | |
prefix_path ruby_prefix_path | |
definition ruby_version | |
action :install | |
end | |
#Getting the latest from repository | |
log "Getting the latest from the program-dev-dashboard repo" | |
git dashboard_repo_path do | |
repository repo_url | |
reference branch_name | |
user "root" | |
end | |
%w{bundler dashing}.each do |pkg| | |
gem_package pkg do | |
gem_binary "#{ruby_home}/gem" | |
end | |
end | |
execute bundle_install do | |
cwd dashboard_repo_path | |
not_if "bundle check --gemfile #{::File.expand_path('Gemfile',dashboard_repo_path)}" | |
end | |
#Cycle the webserver | |
log "Getting the Dashboard Up and Running" | |
bash "cycle server" do | |
user "root" | |
cwd dashboard_repo_path | |
flags "-e" | |
code <<-EOH | |
echo "Stopping the dashing server" | |
#{dashing} stop | |
echo "Starting the dashing server" | |
#{dashing} start -d | |
EOH | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment