Skip to content
Browse files

Added app-1, 2

  • Loading branch information...
1 parent 4d2775b commit aea29c3fe77c4d878c8b781c9d516aecc02831bf @kentaro kentaro committed Mar 11, 2013
View
2 README.md
@@ -73,3 +73,5 @@ Then provision it:
```sh
$ knife solo cook ec2-user@app-1.us-west-1 -i ~/.ssh/prepan.pem
```
+
+From the 2nd time, you have to use `deployer` user
View
33 config/deploy.pl
@@ -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"
+ },
+};
View
15 nodes/app-1.us-west-1.json
@@ -0,0 +1,15 @@
+{
+ "run_list": [
+ "role[app]"
+ ],
+
+ "app": {
+ "domain": "prepan.org"
+ },
+
+ "authorization": {
+ "sudo": {
+ "users": ["ec2-user", "deployer"]
+ }
+ }
+}
View
15 nodes/app-2.us-west-1.json
@@ -0,0 +1,15 @@
+{
+ "run_list": [
+ "role[app]"
+ ],
+
+ "app": {
+ "domain": "prepan.org"
+ },
+
+ "authorization": {
+ "sudo": {
+ "users": ["ec2-user", "deployer"]
+ }
+ }
+}
View
1 roles/base.rb
@@ -1,6 +1,7 @@
name "base"
run_list %w(
recipe[base]
+ recipe[build-essential]
)
default_attributes(
View
1 roles/db.rb
@@ -1,5 +1,6 @@
name "db"
run_list %w(
+ role[base]
recipe[mysql::server]
)
View
2 roles/redis.rb
@@ -1,6 +1,6 @@
name "redis"
run_list %w(
- recipe[build-essential]
+ role[base]
recipe[redis::source]
)
View
7 site-cookbooks/daemontools/recipes/directories.rb
@@ -1,3 +1,10 @@
+directory "/service" do
+ action :create
+ owner 'root'
+ group 'root'
+ mode 0755
+end
+
node.app.services.each do |name|
directory "/service/#{name}" do
action :create
View
2 site-cookbooks/daemontools/recipes/install.rb
@@ -17,5 +17,5 @@
initctl reload-configuration
initctl start svscan
COMMAND
- not_if { system("initctl status svscan") }
+ only_if { `initctl status svscan`.match(/stop/) }
end
View
28 site-cookbooks/perl/recipes/cpan.rb
@@ -1,24 +1,16 @@
-package "perl-CPAN" do
- notifies :run, "execute[install cpanm]"
- not_if { system('which cpan') }
-end
-
execute "install cpanm" do
- command "cpan App::cpanminus"
- notifies :run, "execute[install modules]"
+ command "curl -L http://cpanmin.us | perl - --self-upgrade"
not_if { system('which cpanm') }
end
-execute "install modules" do
- [
- 'Module::Install',
- 'Module::Install::CPANfile',
- 'Module::Install::ReadmeFromPod',
- 'Module::Install::Repository',
- 'git://github.com/miyagawa/carton.git',
- ].each do |name|
- command "cpanm #{name}"
+[
+ 'Module::Install',
+ 'Module::Install::CPANfile',
+ 'Module::Install::ReadmeFromPod',
+ 'Module::Install::Repository',
+ 'git://github.com/miyagawa/carton.git',
+].each do |name|
+ execute "install #{name}" do
+ command "cpanm -n -f #{name}"
end
-
- not_if { system('which carton') }
end
View
2 site-cookbooks/perl/recipes/perl.rb
@@ -1,3 +1,3 @@
package "perl" do
- notifies :run, "package[perl-CPAN]"
+ notifies :run, "execute[install cpanm]"
end

0 comments on commit aea29c3

Please sign in to comment.
Something went wrong with that request. Please try again.