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 +4 -4
- data/lib/pushapp/generators.rb +42 -24
- data/lib/pushapp/version.rb +1 -1
- data/pushapp.gemspec +2 -2
- data/templates/.env.erb +1 -0
- data/templates/Cheffile.erb +13 -12
- data/templates/Procfile +1 -0
- data/templates/config.rb.erb +1 -1
- data/templates/solo.rb.erb +6 -0
- data/templates/unicorn.rb.erb +2 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 581802672a70b770190de57da287d0b9a642b729
|
4
|
+
data.tar.gz: ff36bd457647002226a93f6e1333fe6595bfe945
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d180c3770161ae1b9902bbd472c012c6f4b7891065d0f8f36dcf9e5d2d0ce443d293bace1fa40654a3724dbeaaf9c2e99e1f9c5967d3238d7db5d6544ef5d2d
|
7
|
+
data.tar.gz: 65fe24e674fdfbe7b07dd6a8a4aa761f87ce0689353f0b113e1c44c693510ac5b9d7bd1a6a73bb16ed6b89cf887380e85f541721951af8dce6d03b973b4a9fe8
|
data/lib/pushapp/generators.rb
CHANGED
@@ -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:
|
17
|
-
method_option :listen, default: '80', desc:
|
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
|
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
|
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
|
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:
|
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:
|
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
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
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:
|
254
|
+
comment: 'Application User',
|
237
255
|
ssh_keys: [File.read(options[:ssh_pub_key])],
|
238
|
-
groups:
|
239
|
-
shell:
|
256
|
+
groups: %w{sysadmin sudo staff},
|
257
|
+
shell: '/bin/bash'
|
240
258
|
}
|
241
259
|
end
|
242
260
|
|
data/lib/pushapp/version.rb
CHANGED
data/pushapp.gemspec
CHANGED
@@ -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 = [
|
10
|
-
spec.email = [
|
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'
|
data/templates/.env.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
RAILS_ENV=<%= app_env %>
|
data/templates/Cheffile.erb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
site 'http://community.opscode.com/api/v1'
|
2
2
|
|
3
|
-
cookbook
|
3
|
+
cookbook 'apt'
|
4
|
+
cookbook 'memcached'
|
4
5
|
<% if options[:database] == 'mysql' %>
|
5
|
-
cookbook
|
6
|
+
cookbook 'mysql', {}
|
6
7
|
<% elsif options[:database] == 'postgresql' %>
|
7
|
-
cookbook
|
8
|
+
cookbook 'postgresql', {}
|
8
9
|
<% end %>
|
9
|
-
cookbook
|
10
|
-
cookbook
|
11
|
-
cookbook
|
12
|
-
cookbook
|
13
|
-
cookbook
|
14
|
-
cookbook
|
15
|
-
cookbook
|
16
|
-
cookbook
|
17
|
-
cookbook
|
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', {}
|
data/templates/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
web: bin/unicorn_upstart
|
data/templates/config.rb.erb
CHANGED
data/templates/unicorn.rb.erb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
|
4
4
|
# documentation.
|
5
|
-
env ||= ENV[
|
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 %>.#{
|
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.
|
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-
|
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
|