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

Commit

Permalink
Added app-1, 2
Browse files Browse the repository at this point in the history
  • Loading branch information
kentaro committed Mar 10, 2013
1 parent 4d2775b commit aea29c3
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 21 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ Then provision it:
```sh ```sh
$ knife solo cook ec2-user@app-1.us-west-1 -i ~/.ssh/prepan.pem $ knife solo cook ec2-user@app-1.us-west-1 -i ~/.ssh/prepan.pem
``` ```

From the 2nd time, you have to use `deployer` user
33 changes: 33 additions & 0 deletions config/deploy.pl
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env perl

use strict;
use warnings;
use Cinnamon::DSL;

role local => [qw(local.prepan.org)], {
user => 'vagrant',
};

role redis => [qw(redis-1.us-west-1)], {
user => 'ec2-user',
};

role app => [qw(app-1.us-west-1 app-2.us-west-1)], {
user => 'ec2-user',
};

task chef => {
prepare => sub {
my ($host, @args) = @_;
my $user = get('user');

run "knife", "solo", "prepare", "$user\@$host", "-c", "config/knife.rb", "-i", "~/.ssh/prepan.pem", "-F", "~/.ssh/config"
},

cook => sub {
my ($host, @args) = @_;
my $user = get('user');

run "knife", "solo", "cook", "$user\@$host", "-c", "config/knife.rb", "-i", "~/.ssh/prepan.pem", "-F", "~/.ssh/config"
},
};
15 changes: 15 additions & 0 deletions nodes/app-1.us-west-1.json
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"run_list": [
"role[app]"
],

"app": {
"domain": "prepan.org"
},

"authorization": {
"sudo": {
"users": ["ec2-user", "deployer"]
}
}
}
15 changes: 15 additions & 0 deletions nodes/app-2.us-west-1.json
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"run_list": [
"role[app]"
],

"app": {
"domain": "prepan.org"
},

"authorization": {
"sudo": {
"users": ["ec2-user", "deployer"]
}
}
}
1 change: 1 addition & 0 deletions roles/base.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,7 @@
name "base" name "base"
run_list %w( run_list %w(
recipe[base] recipe[base]
recipe[build-essential]
) )


default_attributes( default_attributes(
Expand Down
1 change: 1 addition & 0 deletions roles/db.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,6 @@
name "db" name "db"
run_list %w( run_list %w(
role[base]
recipe[mysql::server] recipe[mysql::server]
) )


Expand Down
2 changes: 1 addition & 1 deletion roles/redis.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
name "redis" name "redis"
run_list %w( run_list %w(
recipe[build-essential] role[base]
recipe[redis::source] recipe[redis::source]
) )


Expand Down
7 changes: 7 additions & 0 deletions site-cookbooks/daemontools/recipes/directories.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,10 @@
directory "/service" do
action :create
owner 'root'
group 'root'
mode 0755
end

node.app.services.each do |name| node.app.services.each do |name|
directory "/service/#{name}" do directory "/service/#{name}" do
action :create action :create
Expand Down
2 changes: 1 addition & 1 deletion site-cookbooks/daemontools/recipes/install.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
initctl reload-configuration initctl reload-configuration
initctl start svscan initctl start svscan
COMMAND COMMAND
not_if { system("initctl status svscan") } only_if { `initctl status svscan`.match(/stop/) }
end end
28 changes: 10 additions & 18 deletions site-cookbooks/perl/recipes/cpan.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,24 +1,16 @@
package "perl-CPAN" do
notifies :run, "execute[install cpanm]"
not_if { system('which cpan') }
end

execute "install cpanm" do execute "install cpanm" do
command "cpan App::cpanminus" command "curl -L http://cpanmin.us | perl - --self-upgrade"
notifies :run, "execute[install modules]"
not_if { system('which cpanm') } not_if { system('which cpanm') }
end end


execute "install modules" do [
[ 'Module::Install',
'Module::Install', 'Module::Install::CPANfile',
'Module::Install::CPANfile', 'Module::Install::ReadmeFromPod',
'Module::Install::ReadmeFromPod', 'Module::Install::Repository',
'Module::Install::Repository', 'git://github.com/miyagawa/carton.git',
'git://github.com/miyagawa/carton.git', ].each do |name|
].each do |name| execute "install #{name}" do
command "cpanm #{name}" command "cpanm -n -f #{name}"
end end

not_if { system('which carton') }
end end
2 changes: 1 addition & 1 deletion site-cookbooks/perl/recipes/perl.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,3 @@
package "perl" do package "perl" do
notifies :run, "package[perl-CPAN]" notifies :run, "execute[install cpanm]"
end end

0 comments on commit aea29c3

Please sign in to comment.