Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #6 from CPAN-API/use-xbuild
Browse files Browse the repository at this point in the history
use xbuild-perl to run application
  • Loading branch information
shibayu36 committed Aug 9, 2013
2 parents 998ee48 + 27b2dae commit ec4fdbf
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 51 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -2,4 +2,7 @@
/cookbooks
/tmp
/.bundle/
/vendor/
/vendor/
/cookbooks/
/tmp/librarian/
/.chef/
2 changes: 1 addition & 1 deletion Cheffile
Expand Up @@ -8,4 +8,4 @@ cookbook "build-essential"
cookbook "git"
cookbook "sudo"
cookbook "redis", git: "git://github.com/kentaro/chef-redis.git"
cookbook "plenv", git: "git://github.com/kentaro/chef-plenv.git"
cookbook "xbuild", git: "git://github.com/studio3104/chef-xbuild.git"
19 changes: 10 additions & 9 deletions Cheffile.lock
Expand Up @@ -18,26 +18,27 @@ SITE
yum (2.2.0)

GIT
remote: git://github.com/kentaro/chef-plenv.git
remote: git://github.com/kentaro/chef-redis.git
ref: master
sha: 2a87e9091b5667f96a52be9bd70c9d05545ae0d2
sha: 54a20fe89da33812034e64ab69a371e7b2e918d4
specs:
plenv (0.1.0)
build-essential (>= 0.0.0)
git (>= 0.0.0)
redis (0.0.4)

GIT
remote: git://github.com/kentaro/chef-redis.git
remote: git://github.com/studio3104/chef-xbuild.git
ref: master
sha: 54a20fe89da33812034e64ab69a371e7b2e918d4
sha: 9c2bc1d573798ba0114c412899e73ac6e8db64b4
specs:
redis (0.0.4)
xbuild (0.1.0)
build-essential (>= 0.0.0)
git (>= 0.0.0)
yum (>= 0.0.0)

DEPENDENCIES
build-essential (>= 0)
git (>= 0)
plenv (>= 0)
redis (>= 0)
sudo (>= 0)
xbuild (>= 0)
yum (>= 0)

1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -2,3 +2,4 @@ source "https://rubygems.org"

gem "knife-solo"
gem "librarian"
gem "librarian-chef"
29 changes: 16 additions & 13 deletions Gemfile.lock
Expand Up @@ -2,7 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
archive-tar-minitar (0.5.2)
chef (11.4.0)
chef (11.6.0)
erubis
highline (>= 1.6.9)
json (>= 1.4.4, <= 1.7.7)
Expand All @@ -17,32 +17,34 @@ GEM
rest-client (>= 1.0.4, < 1.7.0)
yajl-ruby (~> 1.1)
erubis (2.7.0)
highline (1.6.16)
highline (1.6.19)
ipaddress (0.8.0)
json (1.7.7)
knife-solo (0.2.0)
knife-solo (0.3.0)
chef (>= 10.12)
librarian (~> 0.0.20)
erubis (~> 2.7.0)
net-ssh (>= 2.2.2, < 3.0)
librarian (0.0.26)
archive-tar-minitar (>= 0.5.2)
chef (>= 0.10)
librarian (0.1.0)
highline
thor (~> 0.15)
mime-types (1.21)
librarian-chef (0.0.1)
archive-tar-minitar (>= 0.5.2)
chef (>= 0.10)
librarian (~> 0.1.0)
mime-types (1.23)
mixlib-authentication (1.3.0)
mixlib-log
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-log (1.4.1)
mixlib-shellout (1.1.0)
net-ssh (2.6.6)
mixlib-log (1.6.0)
mixlib-shellout (1.2.0)
net-ssh (2.6.8)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
net-ssh-multi (1.1)
net-ssh (>= 2.1.4)
net-ssh-gateway (>= 0.99.0)
ohai (6.16.0)
ohai (6.18.0)
ipaddress
mixlib-cli
mixlib-config
Expand All @@ -53,7 +55,7 @@ GEM
rest-client (1.6.7)
mime-types (>= 1.16)
systemu (2.5.2)
thor (0.17.0)
thor (0.18.1)
yajl-ruby (1.1.0)

PLATFORMS
Expand All @@ -62,3 +64,4 @@ PLATFORMS
DEPENDENCIES
knife-solo
librarian
librarian-chef
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -81,27 +81,27 @@ Then provision it:

```sh
$ bundle exec knife solo prepare local.prepan.org
$ bundle exec knife solo cook local.prepan.org -c config/knife.rb
$ bundle exec knife solo cook local.prepan.org
```

## Provision Hosts on Production (EC2)

Prepare remote host:

```sh
$ bundle exec knife solo prepare ec2-user@app-1.us-west-1 -i ~/.ssh/prepan.pem -c config/knife.rb
$ bundle exec knife solo prepare ec2-user@app-1.us-west-1 -i ~/.ssh/prepan.pem
```

Edit `node/${hostname}.json` if it's not thre.

Then provision it:

```sh
$ bundle exec knife solo cook ec2-user@app-1.us-west-1 -i ~/.ssh/prepan.pem -c config/knife.rb
$ bundle exec knife solo cook ec2-user@app-1.us-west-1 -i ~/.ssh/prepan.pem
```

From the 2nd time, you have to use `deployer` user for login user:

```sh
$ bundle exec knife solo cook deployer@app-1.us-west-1 -i ~/.ssh/prepan.pem -c config/knife.rb
$ bundle exec knife solo cook deployer@app-1.us-west-1 -i ~/.ssh/prepan.pem
```
14 changes: 10 additions & 4 deletions Vagrantfile
@@ -1,9 +1,15 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|
Vagrant.configure("2") do |config|
config.vm.box = "centos-6.4"
config.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130309.box"
config.vm.host_name = "local.prepan.org"
config.vm.forward_port 8000, 8000
config.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130427.box"

config.vm.hostname = "local.prepan.org"
config.vm.network :forwarded_port, :guest => 8080, :host => 8080

config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--natdnsproxy1", "off"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "off"]
end
end
3 changes: 2 additions & 1 deletion roles/app.rb
Expand Up @@ -3,7 +3,7 @@
role[base]
recipe[sudo]
recipe[nginx]
recipe[plenv]
recipe[xbuild]
recipe[perl]
recipe[mysql::client]
recipe[daemontools]
Expand All @@ -30,6 +30,7 @@
},
"perl" => {
"version" => "5.16.3",
'prefix' => '/usr/local/perl-prepan',
"modules" => %w[
Module::Install
Module::Install::CPANfile
Expand Down
19 changes: 7 additions & 12 deletions site-cookbooks/perl/recipes/install.rb
@@ -1,18 +1,13 @@
plenv_install node.app.perl.version do
user node.base.user.name
action :install
end
include_recipe "xbuild"

plenv_global node.app.perl.version do
user node.base.user.name
action :run
xbuild_perl "install perl #{node['app']['perl']['version']}" do
version node['app']['perl']['version']
prefix node['app']['perl']['prefix']
end

node.app.perl.modules.each do |mod|
plenv_cpanm mod do
user user node.base.user.name
version node.app.perl.version
options "--force"
action :install
xbuild_cpanm mod do
options '--force'
perl_root node['app']['perl']['prefix']
end
end
6 changes: 0 additions & 6 deletions solo.rb

This file was deleted.

0 comments on commit ec4fdbf

Please sign in to comment.