pushapp 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6087f97376d51ff71653aa1e8bae7d43fad3996f
4
- data.tar.gz: 3bf44bdfe73b940d6aa433a3fc38f623c61e83d4
3
+ metadata.gz: 581802672a70b770190de57da287d0b9a642b729
4
+ data.tar.gz: ff36bd457647002226a93f6e1333fe6595bfe945
5
5
  SHA512:
6
- metadata.gz: dc18dcdb79729f45675bee73c64242ed9de16a614a5d4b99a9c18d06636d1bd8b56968d38c7c56f31f8a222875c1fecbad345d1d4d3c250a99c421bb4b0ae635
7
- data.tar.gz: d51bbec53b29f95e312ea6eaa44c0f42e48a98552bf6862956a23d9db481736a06668e5b296b38658ffc4716433f0f533d68700edfd8fc97744e0b3101bdd465
6
+ metadata.gz: 6d180c3770161ae1b9902bbd472c012c6f4b7891065d0f8f36dcf9e5d2d0ce443d293bace1fa40654a3724dbeaaf9c2e99e1f9c5967d3238d7db5d6544ef5d2d
7
+ data.tar.gz: 65fe24e674fdfbe7b07dd6a8a4aa761f87ce0689353f0b113e1c44c693510ac5b9d7bd1a6a73bb16ed6b89cf887380e85f541721951af8dce6d03b973b4a9fe8
@@ -11,29 +11,45 @@ module Pushapp
11
11
  class_option :file, default: Pushapp::DEFAULT_CONFIG_LOCATION,
12
12
  type: :string, aliases: '-f', banner: 'Specify a pushapp configuration file'
13
13
 
14
+ desc 'web REMOTE', 'generates all configs for REMOTE web (nginx, unicorn and gems)'
15
+ def web(remote)
16
+ options[:remote]
17
+ options[:listen] = "80"
18
+
19
+ uncomment_lines 'Gemfile', /gem 'unicorn'/
20
+ uncomment_lines 'Gemfile', /gem 'therubyracer'/
21
+ insert_into_file 'Gemfile', "\ngem 'pushapp'\ngem 'foreman'\ngem 'foreman'\ngem 'dotenv-rails'", after: /gem 'unicorn'/
22
+ unicorn_upstart
23
+ unicorn_nginx(remote)
24
+ unicorn(remote)
25
+
26
+ template 'Procfile'
27
+ template '.env.erb', ".env.#{app_env}"
28
+ end
29
+
14
30
  desc 'unicorn-nginx REMOTE', 'generates nginx config for unicorn'
15
31
  method_option :host, desc: 'Nginx host, will use remote host as default.'
16
- method_option :env, desc: "unicorn env, will use remote RAILS_ENV as default."
17
- method_option :listen, default: '80', desc: "Nginx port to listen. Default: 80"
32
+ method_option :env, desc: 'unicorn env, will use remote RAILS_ENV as default.'
33
+ method_option :listen, default: '80', desc: 'Nginx port to listen. Default: 80'
18
34
 
19
35
  def unicorn_nginx(remote)
20
36
  options[:remote] = remote
21
37
  template 'unicorn_nginx.conf.erb', "config/deploys/#{app_name}.nginx.conf"
22
38
  end
23
39
 
24
- desc "unicorn-upstart", "generates unicorn binary for upstart/foreman"
40
+ desc 'unicorn-upstart', 'generates unicorn binary for upstart/foreman'
25
41
  def unicorn_upstart
26
42
  template 'unicorn_upstart.erb', 'bin/unicorn_upstart'
27
43
  chmod 'bin/unicorn_upstart', 'a+x'
28
44
  end
29
45
 
30
- desc "unicorn REMOTE", "generates unicorn config"
46
+ desc 'unicorn REMOTE', 'generates unicorn config'
31
47
  def unicorn(remote)
32
48
  options[:remote] = remote
33
49
  template 'unicorn.rb.erb', 'config/unicorn.rb'
34
50
  end
35
51
 
36
- desc "chef-solor REMOTE", "generates chef-solor with knife-solo configs"
52
+ desc 'chef-solor REMOTE', 'generates chef solo with knife solo configs'
37
53
  method_option :database,
38
54
  type: :string,
39
55
  default: 'postgresql',
@@ -46,11 +62,11 @@ module Pushapp
46
62
 
47
63
  method_option :vagrant_box,
48
64
  type: :string,
49
- default: "opscode_ubuntu-12.04-i386_chef-11.4.4"
65
+ default: 'opscode_ubuntu-12.04-i386_chef-11.4.4'
50
66
 
51
67
  method_option :vagrant_box_url,
52
68
  type: :string,
53
- default: "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04-i386_chef-11.4.4.box"
69
+ default: 'https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04-i386_chef-11.4.4.box'
54
70
 
55
71
  method_option :db_password,
56
72
  type: :string,
@@ -65,6 +81,7 @@ module Pushapp
65
81
 
66
82
  template 'Cheffile.erb', 'config/deploys/chef/Cheffile'
67
83
  template 'Vagrantfile.erb', 'config/deploys/chef/Vagrantfile'
84
+ template 'solo.rb.erb', 'config/deploys/chef/solo.rb'
68
85
  template 'node.json.erb', "config/deploys/chef/nodes/#{app_host}.json"
69
86
  template 'user.json.erb', "config/deploys/chef/data_bags/users/#{app_user}.json"
70
87
 
@@ -213,30 +230,31 @@ module Pushapp
213
230
 
214
231
  def run_list
215
232
  [
216
- "apt",
217
- "chef-solo-search",
218
- "locale",
219
- "users::sysadmins",
220
- "sudo",
221
- "runit",
222
- mysql? ? "mysql::server" : nil,
223
- postgresql? ? "postgresql::server" : nil,
224
- "imagemagick",
225
- "ruby_build",
226
- "rbenv::user",
227
- "nginx::repo",
228
- "nginx",
229
- "git"
233
+ 'apt',
234
+ 'chef-solo-search',
235
+ 'locale',
236
+ 'users::sysadmins',
237
+ 'sudo',
238
+ 'runit',
239
+ 'memcached',
240
+ mysql? ? 'mysql::server' : nil,
241
+ postgresql? ? 'postgresql::server' : nil,
242
+ 'imagemagick',
243
+ 'ruby_build',
244
+ 'rbenv::user',
245
+ 'nginx::repo',
246
+ 'nginx',
247
+ 'git'
230
248
  ].compact
231
249
  end
232
250
 
233
251
  def user_json
234
252
  {
235
253
  id: app_user,
236
- comment: "Application User",
254
+ comment: 'Application User',
237
255
  ssh_keys: [File.read(options[:ssh_pub_key])],
238
- groups: ["sysadmin", "sudo", "staff"],
239
- shell: "/bin/bash"
256
+ groups: %w{sysadmin sudo staff},
257
+ shell: '/bin/bash'
240
258
  }
241
259
  end
242
260
 
@@ -1,3 +1,3 @@
1
1
  module Pushapp
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -6,8 +6,8 @@ require 'pushapp/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'pushapp'
8
8
  spec.version = Pushapp::VERSION
9
- spec.authors = ["Yury Korolev"]
10
- spec.email = ["yurykorolev@me.com"]
9
+ spec.authors = ['Yury Korolev']
10
+ spec.email = ['yurykorolev@me.com']
11
11
  spec.description = %q{Push your App}
12
12
  spec.summary = %q{Push your App}
13
13
  spec.homepage = 'https://github.com/anjlab/pushapp'
@@ -0,0 +1 @@
1
+ RAILS_ENV=<%= app_env %>
@@ -1,17 +1,18 @@
1
1
  site 'http://community.opscode.com/api/v1'
2
2
 
3
- cookbook "apt"
3
+ cookbook 'apt'
4
+ cookbook 'memcached'
4
5
  <% if options[:database] == 'mysql' %>
5
- cookbook "mysql", {}
6
+ cookbook 'mysql', {}
6
7
  <% elsif options[:database] == 'postgresql' %>
7
- cookbook "postgresql", {}
8
+ cookbook 'postgresql', {}
8
9
  <% end %>
9
- cookbook "sudo", {:gihub => "patcon/chef-sudo"}
10
- cookbook "locale", {:github => "yury/hw-chef-locale"}
11
- cookbook "imagemagick"
12
- cookbook "chef-solo-search", {:github => "edelight/chef-solo-search"}
13
- cookbook "users"
14
- cookbook "ruby_build", {:github=>"fnichol/chef-ruby_build", :ref=>"v0.7.2"}
15
- cookbook "rbenv", {:github=>"fnichol/chef-rbenv"}
16
- cookbook "nginx", {:github=> "opscode-cookbooks/nginx"}
17
- cookbook "git", {}
10
+ cookbook 'sudo', {:gihub => 'patcon/chef-sudo'}
11
+ cookbook 'locale', {:github => 'yury/hw-chef-locale'}
12
+ cookbook 'imagemagick'
13
+ cookbook 'chef-solo-search', {:github => 'edelight/chef-solo-search'}
14
+ cookbook 'users'
15
+ cookbook 'ruby_build', {:github => 'fnichol/chef-ruby_build', :ref=>'v0.7.2'}
16
+ cookbook 'rbenv', {:github => 'fnichol/chef-rbenv'}
17
+ cookbook 'nginx', {:github => 'opscode-cookbooks/nginx'}
18
+ cookbook 'git', {}
@@ -0,0 +1 @@
1
+ web: bin/unicorn_upstart
@@ -17,7 +17,7 @@
17
17
  # worker: true
18
18
  # end
19
19
 
20
- remote 'production', 'app@server3:/home/app/app',
20
+ remote :production, 'app@server3:/home/app/app',
21
21
  upstart_jobs: ['worker']
22
22
  env: {RAILS_ENV: 'production'}
23
23
 
@@ -0,0 +1,6 @@
1
+ file_cache_path '/tmp/chef-solo'
2
+ data_bag_path '/tmp/chef-solo/data_bags'
3
+ encrypted_data_bag_secret '/tmp/chef-solo/data_bag_key'
4
+ cookbook_path [ '/tmp/chef-solo/site-cookbooks',
5
+ '/tmp/chef-solo/cookbooks' ]
6
+ role_path '/tmp/chef-solo/roles'
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
4
4
  # documentation.
5
- env ||= ENV["RACK_ENV"] || "development"
5
+ env ||= ENV['RACK_ENV'] || 'development'
6
6
  root = File.expand_path('../..', __FILE__)
7
7
  # Use at least one worker per core if you're on a dedicated server,
8
8
  # more will usually help for _short_ waits on databases/caches.
@@ -14,7 +14,7 @@ working_directory root # available in 0.94.0+
14
14
 
15
15
  # listen on both a Unix domain socket and a TCP port,
16
16
  # we use a shorter backlog for quicker failover when busy
17
- listen "/tmp/unicorn.<%= app_name %>.#{app_env}.sock", :backlog => 64
17
+ listen "/tmp/unicorn.<%= app_name %>.#{env}.sock", :backlog => 64
18
18
 
19
19
  # nuke workers after 60 seconds (the default)
20
20
  timeout 60
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Korolev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-03 00:00:00.000000000 Z
11
+ date: 2013-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -114,7 +114,9 @@ files:
114
114
  - lib/pushapp/tasks/upstart.rb
115
115
  - lib/pushapp/version.rb
116
116
  - pushapp.gemspec
117
+ - templates/.env.erb
117
118
  - templates/Cheffile.erb
119
+ - templates/Procfile
118
120
  - templates/Vagrantfile.erb
119
121
  - templates/chef.gitignore
120
122
  - templates/config.rb.erb
@@ -124,6 +126,7 @@ files:
124
126
  - templates/hook/setup.erb
125
127
  - templates/hook/tasks.erb
126
128
  - templates/node.json.erb
129
+ - templates/solo.rb.erb
127
130
  - templates/unicorn.rb.erb
128
131
  - templates/unicorn_nginx.conf.erb
129
132
  - templates/unicorn_upstart.erb