lobot 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -0
- data/.rvmrc +1 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +78 -0
- data/Rakefile +2 -0
- data/features/ci.feature +18 -0
- data/features/config/secrets.yml.example +6 -0
- data/features/step_definitions/ci_steps.rb +98 -0
- data/features/support/env.rb +3 -0
- data/lib/generators/lobot/USAGE +8 -0
- data/lib/generators/lobot/install_generator.rb +24 -0
- data/lib/generators/lobot/templates/Capfile +6 -0
- data/lib/generators/lobot/templates/bootstrap_server.sh +57 -0
- data/lib/generators/lobot/templates/capistrano-ci.rb +68 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/attributes/nginx.rb +2 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/libraries/ci_config.rb +2 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/default.rb +7 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/git_config.rb +11 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/id_rsa.rb +14 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/jenkins.rb +45 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/xvfb.rb +24 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/templates/default/jenkins-job-config.xml.erb +62 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/libraries/marker.rb +42 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/daemontools.rb +15 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/imagemagick.rb +37 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/libxml_prereqs.rb +14 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/mysql_5_1.rb +90 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/mysql_5_5.rb +86 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/nginx.rb +65 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/postgres.rb +80 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/sqlite.rb +20 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb +17 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/templates/default/nginx-conf.erb +42 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/templates/default/nginx-htaccess.erb +3 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/templates/default/nginx-mime-types.erb +75 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/templates/default/nginx-run-script.erb +2 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_server/templates/default/postgres-run-script.erb +2 -0
- data/lib/generators/lobot/templates/ci.rake +111 -0
- data/lib/generators/lobot/templates/ci.yml +24 -0
- data/lib/generators/lobot/templates/deploy-ci.rb +5 -0
- data/lib/generators/lobot/templates/soloistrc +11 -0
- data/lib/lobot.rb +8 -0
- data/lib/lobot/version.rb +3 -0
- data/lobot.gemspec +27 -0
- data/spec/install_spec.rb +68 -0
- data/spec/spec_helper.rb +11 -0
- metadata +161 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ruby-1.9.2-p180@lobot
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2011 Pivotal Labs
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
Lobot: Your Chief Administrative Aide on Cloud City
|
2
|
+
============================
|
3
|
+
|
4
|
+

|
5
|
+
###A "one click" solution for deploying CI to EC2
|
6
|
+
|
7
|
+
Lando Calrissian relies on Lobot to keep Cloud City afloat, and now you can rely on Lobot to keep your continuous integration server running in the cloud. Lobot is a gem that will help you spin-up, bootstrap, and install Jenkins for CI for your Rails app on Amazon EC2.
|
8
|
+
|
9
|
+
# What do I get?
|
10
|
+
|
11
|
+
* rake tasks for starting a CI instance
|
12
|
+
* capistrano tasks for bootstrapping and deploying to an EC2 instance
|
13
|
+
* chef recipes for configuring a Centos server to run Jenkins and build Rails projects.
|
14
|
+
|
15
|
+
all you'll need to do is:
|
16
|
+
|
17
|
+
rails g lobot:install
|
18
|
+
edit config/ci.yml
|
19
|
+
rake ci:server_start && cap ci bootstrap && cap ci chef
|
20
|
+
|
21
|
+
## Install
|
22
|
+
|
23
|
+
Add lobot to your Gemfile
|
24
|
+
|
25
|
+
gem "lobot"
|
26
|
+
|
27
|
+
## Generate
|
28
|
+
Lobot is a Rails 3 generator. Rails 2 can be made to work, but you will need to copy the template files into your project.
|
29
|
+
|
30
|
+
rails g lobot:install
|
31
|
+
|
32
|
+
## Setup
|
33
|
+
|
34
|
+
Edit config/ci.yml
|
35
|
+
|
36
|
+
---
|
37
|
+
app_name: # a short name for your application
|
38
|
+
app_user: # the user created to run your CI process
|
39
|
+
git_location: # The location of your remote git repository which Jenkins will poll and pull from on changes.
|
40
|
+
basic_auth:
|
41
|
+
- username: # The username you will use to access the Jenkins web interface
|
42
|
+
password: # The password you will use to access the Jenkins web interface
|
43
|
+
credentials:
|
44
|
+
aws_access_key_id: # The Access Key for your Amazon AWS account
|
45
|
+
aws_secret_access_key: The Secret Access Key for your Amazon AWS account
|
46
|
+
provider: AWS # leave this one alone
|
47
|
+
server:
|
48
|
+
name: run 'rake ci:server_start to populate'
|
49
|
+
instance_id: run 'rake ci:server_start to populate'
|
50
|
+
build_command: ./cruise_build.sh
|
51
|
+
ec2_server_access:
|
52
|
+
key_pair_name: myapp_ci
|
53
|
+
id_rsa_path: ~/.ssh/id_rsa
|
54
|
+
id_rsa_for_github_access: |-
|
55
|
+
-----BEGIN RSA PRIVATE KEY-----
|
56
|
+
SSH KEY WITH ACCESS TO GITHUB GOES HERE
|
57
|
+
-----END RSA PRIVATE KEY-----
|
58
|
+
|
59
|
+
For security, you can add ci.yml to your .gitignore file and store a ci.yml.example without authentication credentials in your repository
|
60
|
+
|
61
|
+
## Dependencies
|
62
|
+
|
63
|
+
* fog
|
64
|
+
* capistrano
|
65
|
+
* capistrano-ext
|
66
|
+
* rvm (the gem - it configures capistrano to use RVM on the server)
|
67
|
+
|
68
|
+
# Tests
|
69
|
+
|
70
|
+
Lobot is tested using rspec, generator_spec and cucumber. Cucumber provides a full integration test which can generate a rails application, push it to github, start a server and bring up CI for the generated project. You'll need a git repository(which should not have any code you care about) and an AWS account to run the spec. It costs about $0.50 and takes about half an hour. It does not clean up after itself, so be sure to terminate the server when you're done, or it will cost substantially more than $0.50. Use the secrets.yml.example to create a secrets.yml file with your accounts.
|
71
|
+
|
72
|
+
# Contributing
|
73
|
+
|
74
|
+
Lobot is in its infancy and we welcome pull requests. Pull requests should have test coverage for quick consideration.
|
75
|
+
|
76
|
+
# License
|
77
|
+
|
78
|
+
Lobot is MIT Licensed and © Pivotal Labs. See LICENSE.txt for details.
|
data/Rakefile
ADDED
data/features/ci.feature
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: CI
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given the temp directory is clean
|
5
|
+
Given I am in the temp directory
|
6
|
+
|
7
|
+
Scenario: Install CI on Amazon AWS using new Rails template
|
8
|
+
When I create a new Rails project using a Rails template
|
9
|
+
And I vendor Lobot
|
10
|
+
And I put Lobot in the Gemfile
|
11
|
+
And I run bundle install
|
12
|
+
And I run the Lobot generator
|
13
|
+
And I enter my info into the ci.yml file
|
14
|
+
And I push to git
|
15
|
+
And I run the server setup
|
16
|
+
And I bootstrap
|
17
|
+
And I deploy
|
18
|
+
Then CI is green
|
@@ -0,0 +1,98 @@
|
|
1
|
+
|
2
|
+
def system!(str)
|
3
|
+
raise "Command Failed: #{str}" unless system(str)
|
4
|
+
end
|
5
|
+
|
6
|
+
Given /^the temp directory is clean$/ do
|
7
|
+
system!("rm -rf /tmp/lobot-test")
|
8
|
+
system!("mkdir -p /tmp/lobot-test")
|
9
|
+
end
|
10
|
+
|
11
|
+
Given /^I am in the temp directory$/ do
|
12
|
+
Dir.chdir('/tmp/lobot-test')
|
13
|
+
end
|
14
|
+
|
15
|
+
When /^I create a new Rails project using a Rails template$/ do
|
16
|
+
system!("echo -e '\nyes\nno\nno\nno\nno\nno\nno' | rails new testapp -m https://github.com/pivotal/guiderails/raw/master/main.rb")
|
17
|
+
end
|
18
|
+
|
19
|
+
When /^I vendor Lobot$/ do
|
20
|
+
lobot_dir = File.expand_path('../../', File.dirname(__FILE__))
|
21
|
+
system! "cd #{lobot_dir} && rake build"
|
22
|
+
system! "mkdir -p testapp/vendor/cache/"
|
23
|
+
system! "cp #{lobot_dir}/pkg/lobot-#{Lobot::VERSION}.gem testapp/vendor/cache/"
|
24
|
+
end
|
25
|
+
|
26
|
+
When /^I put Lobot in the Gemfile$/ do
|
27
|
+
lobot_path = File.expand_path('../../', File.dirname(__FILE__))
|
28
|
+
system!(%{echo "gem 'lobot'" >> testapp/Gemfile})
|
29
|
+
end
|
30
|
+
|
31
|
+
When /^I run bundle install$/ do
|
32
|
+
system("cd testapp && gem uninstall lobot")
|
33
|
+
system!("cd testapp && bundle install")
|
34
|
+
system!('cd testapp && bundle exec gem list | grep lobot')
|
35
|
+
end
|
36
|
+
|
37
|
+
When /^I run the Lobot generator$/ do
|
38
|
+
system!('cd testapp && rails generate lobot:install')
|
39
|
+
system!('ls testapp | grep -s soloistrc')
|
40
|
+
end
|
41
|
+
|
42
|
+
When /^I enter my info into the ci\.yml file$/ do
|
43
|
+
secrets = YAML.load_file(File.expand_path('../config/secrets.yml', File.dirname(__FILE__)))
|
44
|
+
|
45
|
+
ci_conf_location = 'testapp/config/ci.yml'
|
46
|
+
ci_yml = YAML.load_file(ci_conf_location)
|
47
|
+
ci_yml.merge!(
|
48
|
+
'app_name' => 'testapp',
|
49
|
+
'app_user' => 'testapp-user',
|
50
|
+
'git_location' => 'git@github.com:pivotalprivate/ci-smoke.git',
|
51
|
+
'basic_auth' => [{ 'username' => 'testapp', 'password' => 'testpass' }],
|
52
|
+
'credentials' => { 'aws_access_key_id' => secrets['aws_access_key_id'], 'aws_secret_access_key' => secrets['aws_secret_access_key'], 'provider' => 'AWS' },
|
53
|
+
'ec2_server_access' => {'key_pair_name' => 'lobot_cucumber_key_pair', 'id_rsa_path' => '~/.ssh/id_rsa'},
|
54
|
+
'id_rsa_for_github_access' => secrets['id_rsa_for_github_access']
|
55
|
+
)
|
56
|
+
# ci_yml['server']['name] = '' # This can be used to merge in a server which is already running if you want to skip the setup steps while iterating on a test
|
57
|
+
File.open(ci_conf_location, "w") do |f|
|
58
|
+
YAML.dump(ci_yml, f)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
When /^I push to git$/ do
|
63
|
+
system! "echo 'config/ci.yml' >> testapp/.gitignore"
|
64
|
+
system! "cd testapp && git add ."
|
65
|
+
system! "cd testapp && git commit -m'initial commit'"
|
66
|
+
system "cd testapp && git remote rm origin"
|
67
|
+
system! "cd testapp && git remote add origin git@github.com:pivotalprivate/ci-smoke.git"
|
68
|
+
system! "cd testapp && git push --force -u origin master"
|
69
|
+
end
|
70
|
+
|
71
|
+
When /^I run the server setup$/ do
|
72
|
+
system! "cd testapp && rake ci:server_start"
|
73
|
+
end
|
74
|
+
|
75
|
+
When /^I bootstrap$/ do
|
76
|
+
server_is_available = false
|
77
|
+
iterations = 0
|
78
|
+
until server_is_available
|
79
|
+
server_is_available = system("cd testapp && cap ci check_for_server_availability")
|
80
|
+
puts "Sleeping for 3 seconds"
|
81
|
+
sleep 3
|
82
|
+
iterations += 1
|
83
|
+
raise "server is not available" if iterations > 10
|
84
|
+
end
|
85
|
+
system! "cd testapp && cap ci bootstrap"
|
86
|
+
end
|
87
|
+
|
88
|
+
When /^I deploy$/ do
|
89
|
+
system! "cd testapp && cap ci chef"
|
90
|
+
end
|
91
|
+
|
92
|
+
Then /^CI is green$/ do
|
93
|
+
Timeout::timeout(300) do
|
94
|
+
until system("cd testapp && rake ci:status")
|
95
|
+
sleep 5
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Lobot
|
2
|
+
class InstallGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
4
|
+
|
5
|
+
def create_ci_files
|
6
|
+
template 'ci.yml', 'config/ci.yml'
|
7
|
+
template 'ci.rake', 'lib/tasks/ci.rake'
|
8
|
+
template 'bootstrap_server.sh', 'script/bootstrap_server.sh'
|
9
|
+
template 'deploy-ci.rb', 'config/deploy/ci.rb'
|
10
|
+
template 'capistrano-ci.rb', 'config/capistrano/ci.rb'
|
11
|
+
template 'soloistrc', 'soloistrc'
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_load_path_to_capfile
|
15
|
+
template 'Capfile', 'Capfile' unless File.exists?("#{destination_root}/Capfile")
|
16
|
+
prepend_to_file 'Capfile', "load 'config/capistrano/ci'\n"
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_chef_cookbooks
|
20
|
+
directory 'chef', 'chef'
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# Lobot provides the default Capfile for you in case you want to use more cap later
|
2
|
+
|
3
|
+
# load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
4
|
+
# Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
5
|
+
#
|
6
|
+
# load 'config/deploy' # remove this line to skip loading any of the default tasks
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
|
3
|
+
env | grep -q "APP_USER=" || echo "Please set APP_USER environment variable"
|
4
|
+
|
5
|
+
# perl -e 'print crypt("password", "salt"),"\n"'
|
6
|
+
getent passwd $APP_USER >/dev/null 2>&1 || useradd $APP_USER -p DEADBEEFSCRYPTEDPASSWORD #sa3tHJ3/KuYvI would be password
|
7
|
+
|
8
|
+
# copy root's authorized keys to APP_USER
|
9
|
+
mkdir -p /home/$APP_USER/.ssh
|
10
|
+
touch /home/$APP_USER/.ssh/authorized_keys
|
11
|
+
chmod 700 /home/$APP_USER/.ssh
|
12
|
+
chmod 600 /home/$APP_USER/.ssh/authorized_keys
|
13
|
+
chown -R $APP_USER /home/$APP_USER/.ssh
|
14
|
+
|
15
|
+
authorized_keys_string=`cat /root/.ssh/authorized_keys`
|
16
|
+
grep -sq "$authorized_keys_string" /home/$APP_USER/.ssh/authorized_keys || cat /root/.ssh/authorized_keys >> /home/$APP_USER/.ssh/authorized_keys
|
17
|
+
|
18
|
+
|
19
|
+
## enable ssh password auth
|
20
|
+
perl -p -i -e 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
21
|
+
/etc/init.d/sshd reload
|
22
|
+
|
23
|
+
# install epel
|
24
|
+
rpm -q epel-release-5-4.noarch || rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
|
25
|
+
|
26
|
+
# install git
|
27
|
+
yum -y install git
|
28
|
+
|
29
|
+
# rvm prereqs
|
30
|
+
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libffi-devel openssl-devel iconv-devel java
|
31
|
+
|
32
|
+
# passwordless sudo
|
33
|
+
sudo_string='ALL ALL = (ALL) NOPASSWD: ALL'
|
34
|
+
grep "$sudo_string" /etc/sudoers || echo "$sudo_string" >> /etc/sudoers
|
35
|
+
|
36
|
+
cat <<'BOOTSTRAP_AS_USER' > /home/$APP_USER/bootstrap_as_user.sh
|
37
|
+
set -e
|
38
|
+
|
39
|
+
export APP_USER=$1
|
40
|
+
|
41
|
+
mkdir -p /home/$APP_USER/rvm/src
|
42
|
+
curl -Lskf http://github.com/wayneeseguin/rvm/tarball/156d0b42feba4922ad04 | tar xvz -C/home/$APP_USER/rvm/src --strip 1
|
43
|
+
cd "/home/$APP_USER/rvm/src" && ./install
|
44
|
+
|
45
|
+
rvm_include_string='[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"'
|
46
|
+
grep "$rvm_include_string" ~/.bashrc || echo "$rvm_include_string" >> ~/.bashrc
|
47
|
+
|
48
|
+
cat <<'RVMRC_CONTENTS' > ~/.rvmrc
|
49
|
+
rvm_install_on_use_flag=1
|
50
|
+
rvm_trust_rvmrcs_flag=1
|
51
|
+
rvm_gemset_create_on_use_flag=1
|
52
|
+
RVMRC_CONTENTS
|
53
|
+
BOOTSTRAP_AS_USER
|
54
|
+
|
55
|
+
chmod a+x /home/$APP_USER/bootstrap_as_user.sh
|
56
|
+
su - $APP_USER /home/$APP_USER/bootstrap_as_user.sh $APP_USER
|
57
|
+
rm /home/$APP_USER/bootstrap_as_user.sh
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'capistrano/ext/multistage'
|
2
|
+
require "rvm/capistrano" # Use the gem, don't unshift RVM onto the load path, that's crazy.
|
3
|
+
|
4
|
+
task :ci_setup do
|
5
|
+
ci_conf_location ||= File.expand_path('../../../config/ci.yml', __FILE__)
|
6
|
+
ci_conf ||= YAML.load_file(ci_conf_location)
|
7
|
+
|
8
|
+
raise "rvm_ruby_string not set - are you using RVM" unless ENV['rvm_ruby_string']
|
9
|
+
set :rvm_ruby_string, ENV['rvm_ruby_string']
|
10
|
+
set :rvm_type, :user
|
11
|
+
set :app_name, ci_conf['app_name']
|
12
|
+
set(:app_dir) { "/var/#{stage}/#{app_name}" }
|
13
|
+
set :user, ci_conf['app_user']
|
14
|
+
ssh_options[:keys] = [ci_conf['ec2_server_access']['id_rsa_path']]
|
15
|
+
default_run_options[:pty] = true
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "check for server availability - run this task in a loop to see if the slice is ready to connect to"
|
19
|
+
task :check_for_server_availability do
|
20
|
+
ci_setup
|
21
|
+
set :user, "root"
|
22
|
+
run "echo Server is available"
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "bootstrap"
|
26
|
+
task :bootstrap do
|
27
|
+
ci_setup
|
28
|
+
app_user = user
|
29
|
+
set :user, "root"
|
30
|
+
set :default_shell, "/bin/bash"
|
31
|
+
upload "script/bootstrap_server.sh", "/root/bootstrap_server.sh"
|
32
|
+
run "chmod a+x /root/bootstrap_server.sh"
|
33
|
+
run "APP_USER=#{app_user} /root/bootstrap_server.sh"
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "setup and run chef"
|
37
|
+
task :chef do
|
38
|
+
ci_setup
|
39
|
+
install_base_gems
|
40
|
+
upload_cookbooks
|
41
|
+
run_soloist
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Install gems that are needed for a chef run"
|
45
|
+
task :install_base_gems do
|
46
|
+
ci_setup
|
47
|
+
p rvm_ruby_string
|
48
|
+
run "gem list | grep soloist || gem install soloist --no-rdoc --no-ri"
|
49
|
+
run "gem list | grep bundler || gem install bundler --no-rdoc --no-ri"
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Upload cookbooks"
|
53
|
+
task :upload_cookbooks do
|
54
|
+
ci_setup
|
55
|
+
run "sudo mkdir -p #{app_dir}"
|
56
|
+
run "sudo chown -R #{user} #{app_dir}"
|
57
|
+
run "rm #{app_dir}/soloistrc || true"
|
58
|
+
run "rm -r #{app_dir}/chef || true"
|
59
|
+
upload("soloistrc", "#{app_dir}/soloistrc")
|
60
|
+
upload("config/ci.yml", "#{app_dir}/ci.yml")
|
61
|
+
upload("chef/", "#{app_dir}/chef/", :via => :scp, :recursive => true)
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Run soloist"
|
65
|
+
task :run_soloist do
|
66
|
+
ci_setup
|
67
|
+
run "cd #{app_dir} && PATH=/usr/sbin:$PATH APP_NAME=#{fetch(:app_name)} APP_DIR=#{fetch(:app_dir)} LOG_LEVEL=debug soloist"
|
68
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
include_recipe "pivotal_server::imagemagick"
|
2
|
+
include_recipe "pivotal_server::postgres"
|
3
|
+
include_recipe "pivotal_server::sqlite"
|
4
|
+
include_recipe "pivotal_server::libxml_prereqs"
|
5
|
+
include_recipe "pivotal_server::nginx"
|
6
|
+
include_recipe "pivotal_ci::id_rsa"
|
7
|
+
include_recipe "pivotal_ci::jenkins"
|