Skip to content

Instantly share code, notes, and snippets.

Created February 12, 2014 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8960568 to your computer and use it in GitHub Desktop.
Save anonymous/8960568 to your computer and use it in GitHub Desktop.
Recipe to install dashing and deploy the dashboard on thin
#
# 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