capun 0.0.23 → 0.0.24

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: 3c6b065c5ffd8c41238ded0c7a8ef01a9d42aa26
4
- data.tar.gz: 9c894551307e0ff135d6f50a45620c5d75f1be59
3
+ metadata.gz: 978c97c1eb0c4875d6427b0f8f3c9b5d041366dd
4
+ data.tar.gz: b16cc36dffa774a4c702f9b9354de6dce034d825
5
5
  SHA512:
6
- metadata.gz: 576ce8084fe50492582b72a38f7bea98ef39fa02b2c2a4c07b6de2ae3966fdaa32743105f466927f6d9466c0b6a34bf6e3180ce1075b830ee16ae21944b8612a
7
- data.tar.gz: 6099f03a9449c0b3236e67941ef2e02047ba33b5bf0de40d8e8151d0c374fe7a08782ba1822545cdbd602e46ea8163a8a5855ba3d618afceccd68a0a95c1d048
6
+ metadata.gz: 3950cc98d2296a3c495f0511482c6f3832af9ad6258b65f05738be7c212c2f949ccefd68f3adfed6394cc4abc9c7b9afeaf920287d4afd12644d5da4f8871152
7
+ data.tar.gz: 20aae31bbc4fd6a3700a7bc7c770cf112225c10e5988a3d967c4c206c4d4580e5033165b9449741f404e9d198bcc2c759dc1206a68e3c118883c36d4d13e49c3
@@ -1,6 +1,6 @@
1
1
  require 'digest'
2
2
  set :deploy_to, -> {"/home/#{fetch(:user)}/apps/#{fetch(:application)}"}
3
- set :rvm1_ruby_version, "2.0.0"
3
+ set :rvm1_ruby_version, "ruby-2.3.0"
4
4
  set :branch, 'master'
5
5
  # Remote caching will keep a local git repository on the server you're deploying to
6
6
  # and simply run a fetch from that rather than an entire clone
@@ -18,25 +18,23 @@ set :unicorn_config_path, -> { "#{shared_path}/config/unicorn.config.rb" }
18
18
  set :uploads, []
19
19
  set :std_uploads, [
20
20
  #figaro
21
- {what: "config/application.yml", where: '#{shared_path}/config/application.yml', overwrite: true},
21
+ {what: "config/application.yml", where: '#{shared_path}/config/application.yml', upload: true, overwrite: true},
22
22
  #logstash configs
23
- {what: "config/deploy/logstash.config.erb", where: '#{shared_path}/config/logstash.config', overwrite: true},
23
+ {what: "config/deploy/logstash.config.erb", where: '#{shared_path}/config/logstash.config', upload: -> { !!fetch(:addELK) }, overwrite: true},
24
24
  #logrotate configs
25
- {what: "config/deploy/logrotate.config.erb", where: '#{shared_path}/config/logrotate.config', overwrite: true},
25
+ {what: "config/deploy/logrotate.config.erb", where: '#{shared_path}/config/logrotate.config', upload: -> { !!fetch(:addlogrotate) }, overwrite: true},
26
26
  #basic_authenticatable.rb
27
- {what: "config/deploy/basic_authenticatable.rb.erb", where: '#{release_path}/app/controllers/concerns/basic_authenticatable.rb', overwrite: true},
27
+ {what: "config/deploy/basic_authenticatable.rb.erb", where: '#{release_path}/app/controllers/concerns/basic_authenticatable.rb', upload: -> { !!fetch(:use_basic_auth) }, overwrite: true},
28
28
  #nginx.conf
29
- {what: "config/deploy/nginx.conf.erb", where: '#{shared_path}/config/nginx.conf', overwrite: true},
29
+ {what: "config/deploy/nginx.conf.erb", where: '#{shared_path}/config/nginx.conf', upload: -> { !!fetch(:addNginx) }, overwrite: true},
30
30
  #unicorn.config.rb
31
- {what: "config/deploy/unicorn.config.rb.erb", where: '#{shared_path}/config/unicorn.config.rb', overwrite: true},
32
- #secret_token.rb
33
- {what: "config/initializers/secret_token.rb", where: '#{release_path}/config/initializers/secret_token.rb', overwrite: true},
31
+ {what: "config/deploy/unicorn.config.rb.erb", where: '#{shared_path}/config/unicorn.config.rb', upload: true, overwrite: true},
34
32
  #database.yml
35
- {what: "config/deploy/database.yml.erb", where: '#{shared_path}/config/database.yml', overwrite: true},
33
+ {what: "config/deploy/database.yml.erb", where: '#{shared_path}/config/database.yml', upload: true, overwrite: true},
36
34
  #jenkins' config.xml
37
- {what: "config/deploy/jenkins.config.xml.erb", where: '#{shared_path}/config/jenkins.config.xml', overwrite: false},
35
+ {what: "config/deploy/jenkins.config.xml.erb", where: '#{shared_path}/config/jenkins.config.xml', upload: -> { !!fetch(:addJenkins) }, overwrite: false},
38
36
  #newrelic.yml
39
- {what: "config/deploy/newrelic.yml.erb", where: '#{release_path}/config/newrelic.yml', overwrite: true}
37
+ {what: "config/deploy/newrelic.yml.erb", where: '#{shared_path}/config/newrelic.yml', upload: -> { !!fetch(:addNewRelic) }, overwrite: true}
40
38
  ]
41
39
 
42
40
  set :symlinks, []
@@ -46,7 +44,8 @@ set :std_symlinks, [
46
44
  {what: "logrotate.config", where: '/etc/logrotate.d/#{fetch(:application)}'},
47
45
  {what: "database.yml", where: '#{release_path}/config/database.yml'},
48
46
  {what: "application.yml", where: '#{release_path}/config/application.yml'},
49
- {what: "jenkins.config.xml", where: '/var/lib/jenkins/jobs/#{fetch(:application)}/config.xml'}
47
+ {what: "jenkins.config.xml", where: '/var/lib/jenkins/jobs/#{fetch(:application)}/config.xml'},
48
+ {what: "newrelic.yml", where: '#{release_path}/config/newrelic.yml'}
50
49
  ]
51
50
 
52
51
  before 'deploy', 'rvm1:install:rvm' # install/update RVM
@@ -71,7 +70,8 @@ namespace :deploy do
71
70
  uploads = fetch(:uploads).concat(fetch(:std_uploads))
72
71
  uploads.each do |file_hash|
73
72
  what = file_hash[:what]
74
- next if !File.exists?(what)
73
+ next if !file_hash[:upload] || ( file_hash[:upload].is_a?(Proc) && !file_hash[:upload].call )
74
+ next unless File.exists?(what)
75
75
  where = eval "\"" + file_hash[:where] + "\""
76
76
  next if !file_hash[:overwrite] && test("[ -f #{where} ]")
77
77
  #compile temlate if it ends with .erb before upload
@@ -146,8 +146,10 @@ namespace :deploy do
146
146
 
147
147
  desc 'Restart nginx'
148
148
  task :restart_nginx do
149
- on roles(:app) do
150
- execute :sudo, "service nginx reload"
149
+ if fetch(:addNginx)
150
+ on roles(:app) do
151
+ execute :sudo, "service nginx reload"
152
+ end
151
153
  end
152
154
  end
153
155
 
@@ -170,4 +172,4 @@ after "deploy:publishing", "deploy:set_up_jenkins"
170
172
  after "deploy:publishing", "deploy:prepare_logrotate"
171
173
  after "deploy:publishing", "deploy:restart_nginx"
172
174
  after "deploy:publishing", "deploy:restart_logstash"
173
- after "deploy:publishing", "unicorn:restart"
175
+ after "deploy:publishing", "unicorn:legacy_restart"
@@ -1,3 +1,3 @@
1
1
  module Capun
2
- VERSION = "0.0.23"
2
+ VERSION = "0.0.24"
3
3
  end
@@ -16,15 +16,12 @@ module Capun
16
16
  def copy_files
17
17
  empty_directory "config/deploy"
18
18
  copy_file "database.yml.erb", "config/deploy/database.yml.erb"
19
- copy_file "nginx.conf.erb", "config/deploy/nginx.conf.erb"
20
19
  copy_file "unicorn.config.rb.erb", "config/deploy/unicorn.config.rb.erb"
21
20
  copy_file "Capfile", "Capfile"
22
21
  end
23
22
 
24
23
  def add_to_gitignore
25
- gsub_file ".gitignore", "\nconfig/initializers/secret_token.rb", '' if File.exists?("./.gitignore")
26
24
  gsub_file ".gitignore", "\nconfig/deploy/database.yml.erb", '' if File.exists?("./.gitignore")
27
- append_to_file ".gitignore", "\nconfig/initializers/secret_token.rb" if File.exists?("./.gitignore")
28
25
  append_to_file ".gitignore", "\nconfig/deploy/database.yml.erb" if File.exists?("./.gitignore")
29
26
  end
30
27
 
@@ -15,10 +15,8 @@ module Capun
15
15
  @username = ask("Basic authentication username [ex.: mike]:")
16
16
  @password = ask("Basic authentication password [ex.: secret]:")
17
17
  end
18
+ @addNginx = ask("Would you like to add nginx configuration file? [Y/n]").capitalize == 'Y'
18
19
  @addJenkins = ask("Would you like to add Jenkins configuration file? [Y/n]").capitalize == 'Y'
19
- if @addJenkins
20
- @jenkinsToken = ask("New Jenkins token key:")
21
- end
22
20
  @addNewRelic = ask("Would you like to add New Relic configuration file? [Y/n]").capitalize == 'Y'
23
21
  if @addNewRelic
24
22
  @newRelicKey = ask("New relic key:")
@@ -50,6 +48,13 @@ module Capun
50
48
  end
51
49
  end
52
50
 
51
+ def add_nginx
52
+ if @addNginx
53
+ copy_file "nginx.conf.erb", "config/deploy/nginx.conf.erb"
54
+ append_to_file "config/deploy/#{singular_name}.rb", "\nset :addNginx, true"
55
+ end
56
+ end
57
+
53
58
  def add_secret
54
59
  if File.exists?("config/secrets.yml")
55
60
  secret_token_does_not_exist = Thor::CoreExt::HashWithIndifferentAccess.new(::YAML::load_file("config/secrets.yml"))[singular_name].nil?
@@ -91,7 +96,8 @@ module Capun
91
96
  def add_jenkins
92
97
  if @addJenkins
93
98
  copy_file "jenkins.config.xml.erb", "config/deploy/jenkins.config.xml.erb"
94
- append_to_file "config/deploy/#{singular_name}.rb", "\nset :addJenkins, true\nset :jenkinsToken, \"#{@jenkinsToken}\""
99
+ jenkinsToken = Digest::MD5.hexdigest(@appname + Time.now.to_f.to_s)
100
+ append_to_file "config/deploy/#{singular_name}.rb", "\nset :addJenkins, true\nset :jenkinsToken, \"#{jenkinsToken}\""
95
101
  end
96
102
  end
97
103
 
@@ -9,6 +9,6 @@ server '<%= @server %>', user: fetch(:user), roles: %w{web app db}
9
9
  set :repo_url, '<%= @repo %>'
10
10
  # set :branch, 'master'
11
11
 
12
- set :rvm1_ruby_version, "ruby-2.0.0-p481"
12
+ set :rvm1_ruby_version, "ruby-2.3.0"
13
13
 
14
- # set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets public/system}
14
+ # set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets public/system}
@@ -54,7 +54,6 @@
54
54
  source ~/.bash_profile
55
55
  rvm use <%= fetch(:rvm1_ruby_version) %>
56
56
  ln -s ../../common/application.yml config/application.yml
57
- ln -s ../../../common/secret_token.rb config/initializers/secret_token.rb
58
57
 
59
58
  bundle install
60
59
 
@@ -28,7 +28,7 @@ common: &default_settings
28
28
  # If your application has other named environments, configure them here.
29
29
  development:
30
30
  <<: *default_settings
31
- app_name: <%= fetch(:application) %> (Development)
31
+ app_name: <%= fetch(:application) %>
32
32
 
33
33
  # NOTE: There is substantial overhead when running in developer mode.
34
34
  # Do not use for production or load testing.
@@ -41,4 +41,4 @@ test:
41
41
 
42
42
  <%= fetch(:stage) %>:
43
43
  <<: *default_settings
44
- app_name: <%= fetch(:application) %> (Production)
44
+ app_name: <%= fetch(:application) %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Zamylin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-29 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler