teleporter 2.0.2 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd3bfd6ab9aa51b82bdf55e62bc78d5f84e98731
4
- data.tar.gz: 0bf8a52a8fd1b3c43c844e721b4766d66b8f8c3c
3
+ metadata.gz: e6b2a6a6634c7504aef79b5cfdc9e7cfee317f4e
4
+ data.tar.gz: 17bb181ba69dea0f059f129e2dd9b59c84c0e2f6
5
5
  SHA512:
6
- metadata.gz: aae78bdd4af43687e11df0470238793e592f48e73ea77f19ff8b0e44718533f0b4d16a5bc3b0af0b7606b518a28b63b3c785e39ec0b48300c22c00277abc5550
7
- data.tar.gz: 3fffddcc4b613a5b19dfab469493a59ede74719133545e81e4a9e805e846fa47df5d9350f91f763a3c690ce1a82889b3fba3c5fb3da32640eb802fc9cd3c5abc
6
+ metadata.gz: aef3737dcab25ce8bd63cde3a2a35a352a6292f833d2a90f698b6627eab7911a8e81d18ec49723cbb0224b5ea5460457e83b02f2ce205ae4a8e6fb695eedfdd1
7
+ data.tar.gz: 739dd01b4a55e0ec86d2cef49c5a15fec2bf39ac0929a35cd2b3e7e40e4151d6c89a588946cf77afc117a3ec32b450f68c423029cc7169938afbeb2e0e729327
@@ -38,7 +38,7 @@ module Teleport
38
38
  @app_name = ask 'App name', :bold, default: 'blog'
39
39
  @git_repo_url = ask 'Git repo', :bold, default: 'git@github.com:itsNikolay/puma-testing.git'
40
40
  @deploy_user = ask 'Deploy username default', :bold, default: 'deploy'
41
- @ruby_version = ask 'Ruby version', :bold, limited_to: ['2.1.3', '2.1.2', '1.9.3']
41
+ @ruby_version = ask 'Ruby version', :bold, limited_to: ['2.1.4', '2.1.3', '2.1.2', '1.9.3']
42
42
  @production_server_address = ask 'Production server', :bold, default: '192.X.X.X'
43
43
 
44
44
  template 'capistrano/deploy/deploy.rb', 'config/deploy.rb'
@@ -1,8 +1,6 @@
1
1
  lock '3.2.1'
2
2
 
3
- set :application, '<%= @app_name %>'
4
3
  set :repo_url, '<%= @git_repo_url %>'
5
- set :deploy_user, '<%= @deploy_user %>'
6
4
 
7
5
  set :puma_init_active_record, true
8
6
 
@@ -10,91 +8,5 @@ set :rbenv_type, :system
10
8
  set :rbenv_ruby, '<%= @ruby_version %>'
11
9
  set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
12
10
  set :rbenv_map_bins, %w{rake gem bundle ruby rails}
13
- set :linked_files, %w{config/database.yml config/application.yml config/secrets.yml}
11
+ set :linked_files, %w{config/database.yml}
14
12
  set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads}
15
- set(:config_files, %w(
16
- nginx.conf
17
- application.yml
18
- database.example.yml
19
- log_rotation
20
- monit
21
- monit_sidekiq
22
- puma.conf
23
- puma
24
- run-puma
25
- sidekiq_init.sh
26
- secrets.yml
27
- ))
28
- set(:executable_config_files, %w(
29
- puma
30
- run-puma
31
- sidekiq_init.sh
32
- ))
33
- set(:symlinks, [
34
- {
35
- source: "nginx.conf",
36
- link: "/etc/nginx/sites-enabled/{{full_app_name}}"
37
- },
38
- {
39
- source: "puma",
40
- link: "/etc/init.d/puma"
41
- },
42
- {
43
- source: "run-puma",
44
- link: "/usr/local/bin/run-puma"
45
- },
46
- {
47
- source: "puma.conf",
48
- link: "/etc/puma.conf"
49
- },
50
- {
51
- source: "log_rotation",
52
- link: "/etc/logrotate.d/{{full_app_name}}"
53
- },
54
- {
55
- source: "monit",
56
- link: "/etc/monit/conf.d/{{full_app_name}}.conf"
57
- },
58
- {
59
- source: "monit_sidekiq",
60
- link: "/etc/monit/conf.d/sidekiq_{{full_app_name}}.conf"
61
- },
62
- {
63
- source: "sidekiq_init.sh",
64
- link: "/etc/init.d/sidekiq_{{full_app_name}}"
65
- },
66
- ])
67
- namespace :deploy do
68
- desc 'Normalize asset timestamps'
69
- task migr: fetch(:stage) do
70
- on roles(:app) do
71
- within release_path do
72
- execute :rake, "migrate:users", "RAILS_ENV=#{fetch(:stage)}"
73
- end
74
- end
75
- end
76
- end
77
-
78
- namespace :deploy do
79
- task clear_cache: fetch(:stage) do
80
- on roles(:app) do
81
- within release_path do
82
- execute :rake, 'tmp:cache:clear'
83
- end
84
- end
85
- end
86
- end
87
-
88
- namespace :deploy do
89
- # make sure we're deploying what we think we're deploying
90
- before :deploy, "deploy:check_revision"
91
- # only allow a deploy with passing tests to deployed
92
- # compile assets locally then rsync
93
- #after 'deploy:symlink:shared', 'deploy:compile_assets_locally'
94
- after :finishing, 'deploy:cleanup'
95
- after :finishing, 'deploy:restart'
96
- after :finishing, 'deploy:clear_cache'
97
- #after :finishing, 'sidekiq:restart'
98
- #after :finishing, 'deploy:migr'
99
- end
100
-
@@ -1,13 +1,14 @@
1
1
  set :stage, :production
2
-
3
- set :branch, "master"
4
-
5
- set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
6
-
7
- server '<%= @production_server_address %>', user: '<%= @deploy_user %>', roles: %w{web app db}, primary: true
8
-
9
- set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
10
-
11
2
  set :rails_env, :production
3
+ set :application, "<%= @app_name %>_#{fetch(:stage)}"
4
+ set :branch, "master"
5
+ set :deploy_user, '<%= @deploy_user %>'
6
+ set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:application)}"
7
+ set :ip, '<%= @production_server_address %>'
8
+
9
+ role :web, ["#{fetch(:deploy_user)}@#{fetch(:ip)}"]
10
+ role :app, ["#{fetch(:deploy_user)}@#{fetch(:ip)}"]
11
+ role :db, ["#{fetch(:deploy_user)}@#{fetch(:ip)}"]
12
+ role :puma_nginx, ["#{fetch(:deploy_user)}@#{fetch(:ip)}"]
12
13
 
13
14
  set :enable_ssl, false
@@ -1,13 +1,14 @@
1
1
  set :stage, :staging
2
-
3
- set :branch, "master"
4
-
5
- set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
6
-
7
- server '<%= @staging_server_address %>', user: '<%= @deploy_user %>', roles: %w{web app db}, primary: true
8
-
9
- set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
10
-
11
2
  set :rails_env, :staging
3
+ set :application, "<%= @app_name %>_#{fetch(:stage)}"
4
+ set :branch, "master"
5
+ set :deploy_user, '<%= @deploy_user %>'
6
+ set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:application)}"
7
+ set :ip, '<%= @staging_server_address %>'
8
+
9
+ role :web, ["#{fetch(:deploy_user)}@#{fetch(:ip)}"]
10
+ role :app, ["#{fetch(:deploy_user)}@#{fetch(:ip)}"]
11
+ role :db, ["#{fetch(:deploy_user)}@#{fetch(:ip)}"]
12
+ role :puma_nginx, ["#{fetch(:deploy_user)}@#{fetch(:ip)}"]
12
13
 
13
14
  set :enable_ssl, false
@@ -0,0 +1,18 @@
1
+ workers Integer(ENV['PUMA_WORKERS'] || 3)
2
+ threads Integer(ENV['MIN_THREADS'] || 1), Integer(ENV['MAX_THREADS'] || 16)
3
+
4
+ preload_app!
5
+
6
+ rackup DefaultRackup
7
+ port ENV['PORT'] || 3000
8
+ environment ENV['RACK_ENV'] || 'development'
9
+
10
+ on_worker_boot do
11
+ # worker specific setup
12
+ ActiveSupport.on_load(:active_record) do
13
+ config = ActiveRecord::Base.configurations[Rails.env] ||
14
+ Rails.application.config.database_configuration[Rails.env]
15
+ config['pool'] = ENV['MAX_THREADS'] || 16
16
+ ActiveRecord::Base.establish_connection(config)
17
+ end
18
+ end
@@ -1,7 +1,10 @@
1
1
  namespace :deploy do
2
2
  task :prepare_nginx do
3
3
  on roles(:app) do
4
+ begin
4
5
  execute :sudo, :rm, '/etc/nginx/sites-enabled/default'
6
+ rescue Exception
7
+ end
5
8
  execute :sudo, '/etc/init.d/nginx restart'
6
9
  end
7
10
  end
@@ -1,6 +1,6 @@
1
1
  namespace :deploy do
2
2
  desc 'Run rake task'
3
- task :run_rake_task do
3
+ task :rake do
4
4
  on roles(:app) do
5
5
  ask(:rake_task, 'Type a rake task (db:seed)')
6
6
 
@@ -1,28 +1,42 @@
1
1
  namespace :deploy do
2
2
  task :setup_config do
3
3
  on roles(:app) do
4
- # make the config dir
4
+ set(:config_files, [
5
+ "log_rotation",
6
+ "monit_sidekiq",
7
+ "sidekiq_init.sh"
8
+ ])
9
+ set(:executable_config_files, [
10
+ "sidekiq_init.sh",
11
+ ])
12
+ set(:symlinks, [
13
+ {
14
+ source: "log_rotation",
15
+ link: "/etc/logrotate.d/{{application}}"
16
+ },
17
+ {
18
+ source: "monit_sidekiq",
19
+ link: "/etc/monit/conf.d/sidekiq_{{application}}.conf"
20
+ },
21
+ {
22
+ source: "sidekiq_init.sh",
23
+ link: "/etc/init.d/sidekiq_{{application}}"
24
+ },
25
+ ])
5
26
  execute :mkdir, "-p #{shared_path}/config"
6
- full_app_name = fetch(:full_app_name)
7
-
8
- # config files to be uploaded to shared/config, see the
9
- # definition of smart_template for details of operation.
10
- # Essentially looks for #{filename}.erb in deploy/#{full_app_name}/
11
- # and if it isn't there, falls back to deploy/#{shared}. Generally
12
- # everything should be in deploy/shared with params which differ
13
- # set in the stage files
27
+ execute :mkdir, "-p #{current_path}"
28
+ application = fetch(:application)
29
+
14
30
  config_files = fetch(:config_files)
15
31
  config_files.each do |file|
16
32
  smart_template file
17
33
  end
18
34
 
19
- # which of the above files should be marked as executable
20
35
  executable_files = fetch(:executable_config_files)
21
36
  executable_files.each do |file|
22
37
  execute :chmod, "+x #{shared_path}/config/#{file}"
23
38
  end
24
39
 
25
- # symlink stuff which should be... symlinked
26
40
  symlinks = fetch(:symlinks)
27
41
 
28
42
  symlinks.each do |symlink|
@@ -46,7 +60,7 @@ def smart_template(from, to=nil)
46
60
  end
47
61
 
48
62
  def template_file(name)
49
- if File.exist?((file = "config/deploy/#{fetch(:full_app_name)}/#{name}.erb"))
63
+ if File.exist?((file = "config/deploy/#{fetch(:application)}/#{name}.erb"))
50
64
  return file
51
65
  elsif File.exist?((file = "config/deploy/shared/#{name}.erb"))
52
66
  return file
@@ -21,7 +21,7 @@ namespace :deploy do
21
21
  timeout: 5000
22
22
  encoding: utf8
23
23
  reconnect: false
24
- database: #{fetch(:application)}_#{fetch(:rails_env)}
24
+ database: #{fetch(:application)}
25
25
  pool: 5
26
26
  username: #{fetch(:deploy_user)}
27
27
  password: #{fetch(:db_password)}
@@ -44,7 +44,7 @@ namespace :deploy do
44
44
  rescue Exception
45
45
  end
46
46
  begin
47
- execute %Q{echo "CREATE DATABASE #{fetch(:application)}_#{fetch(:rails_env)} WITH OWNER #{fetch(:deploy_user)} ENCODING 'UTF8';" | sudo -u postgres psql}
47
+ execute %Q{echo "CREATE DATABASE #{fetch(:application)} WITH OWNER #{fetch(:deploy_user)} ENCODING 'UTF8';" | sudo -u postgres psql}
48
48
  rescue Exception
49
49
  end
50
50
  end
@@ -1,3 +1,3 @@
1
1
  module Teleporter
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teleporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ponomarev Nikolay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-25 00:00:00.000000000 Z
11
+ date: 2014-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -104,7 +104,6 @@ files:
104
104
  - lib/generators/teleport/templates/capistrano/deploy/deploy.rb.tt
105
105
  - lib/generators/teleport/templates/capistrano/deploy/production.rb.tt
106
106
  - lib/generators/teleport/templates/capistrano/deploy/staging.rb.tt
107
- - lib/generators/teleport/templates/capistrano/shared/application.yml.erb
108
107
  - lib/generators/teleport/templates/capistrano/shared/database.example.yml.erb
109
108
  - lib/generators/teleport/templates/capistrano/shared/log_rotation.erb
110
109
  - lib/generators/teleport/templates/capistrano/shared/monit.erb
@@ -112,8 +111,8 @@ files:
112
111
  - lib/generators/teleport/templates/capistrano/shared/nginx.conf.erb
113
112
  - lib/generators/teleport/templates/capistrano/shared/puma.conf.erb
114
113
  - lib/generators/teleport/templates/capistrano/shared/puma.erb
114
+ - lib/generators/teleport/templates/capistrano/shared/puma.rb.erb
115
115
  - lib/generators/teleport/templates/capistrano/shared/run-puma.erb
116
- - lib/generators/teleport/templates/capistrano/shared/secrets.yml.erb
117
116
  - lib/generators/teleport/templates/capistrano/shared/sidekiq.yml.erb
118
117
  - lib/generators/teleport/templates/capistrano/shared/sidekiq_init.sh.erb
119
118
  - lib/generators/teleport/templates/capistrano/shared/unicorn.rb.erb
@@ -122,7 +121,7 @@ files:
122
121
  - lib/generators/teleport/templates/capistrano/tasks/compile_assets_locally.rake
123
122
  - lib/generators/teleport/templates/capistrano/tasks/logs.rake
124
123
  - lib/generators/teleport/templates/capistrano/tasks/prepare_nginx.rake
125
- - lib/generators/teleport/templates/capistrano/tasks/run_rake_task.rake
124
+ - lib/generators/teleport/templates/capistrano/tasks/rake.rake
126
125
  - lib/generators/teleport/templates/capistrano/tasks/setup_config.rake
127
126
  - lib/generators/teleport/templates/capistrano/tasks/setup_db.rake
128
127
  - lib/generators/teleport/templates/database/database.yml
@@ -1,2 +0,0 @@
1
- var : value
2
- another_var : another_value
@@ -1,2 +0,0 @@
1
- production:
2
- secret_key_base: <%= SecureRandom.hex %>