railman 0.3.7 → 0.4.0

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: 106e41b287dfd0f86fe6e04e5a8b846d3d5420da
4
- data.tar.gz: a32cbdafa423a755fc8e2491417825e8eb079b74
3
+ metadata.gz: 735fe5ff7e1e96f88a3de32146bab168201bb86b
4
+ data.tar.gz: b073a2b956406ff61422a46c2490ba11a8aeaee3
5
5
  SHA512:
6
- metadata.gz: bfe1ad643e19c26a45fb9a2769b0455927a661ba5db35a1c84cecb10ebd40702fce740a155452e63fc176a644ed9bf0e61f0373d6b2ece53c15d0181fbe9abe7
7
- data.tar.gz: f7e948248762e3bc8035e5c35a765c64fbcb4314b77a1bc009d5828ddd9ab8477096748d90ca959d6d93daae2590883f7a4a1f95f52aba7f1bd1ebf31a1f123f
6
+ metadata.gz: 1c8d4f4ee0a216efc6a0d2ea771f0a0cde9ed56124491aa35d68d9beab70d80d01e44e96417dcf915e11c6b32a5312434a855b5184d500e741a54ca3a81cb747
7
+ data.tar.gz: 2affb17d4dd56ef893a57bca07b05ba3937c12fe88a3afa2a02d95598f66edcb8f25a761bb59b866a8bcd7528b7df391d04f07444f242867e5cb9c09809a7467
@@ -1,3 +1,3 @@
1
1
  module Railman
2
- VERSION = '0.3.7'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -29,7 +29,7 @@ gem 'sinatra', '1.4.6', :require => false # for sidekiq-web
29
29
  gem 'unicorn', '4.8.3' # use unicorn as production server
30
30
  gem 'unicorn-rails', '1.1.0' # use unicorn as local server
31
31
 
32
- gem 'capistrano', '3.4.1' # capistrano deployment
32
+ gem 'railman-deployment', '~> 0.2' # capistrano deployment
33
33
 
34
34
  gem 'exception_notification', '4.1.2' # exception notification per email
35
35
 
@@ -1,130 +1,6 @@
1
- # Capistrano deployment tasks
2
- lock '3.4.1'
3
-
4
- require 'securerandom'
1
+ # Capistrano deployment configuration
5
2
 
6
3
  set :application, '<%= @config.app_name %>'
7
4
  set :repo_url, '<%= @repository.origin %>'
8
- set :deploy_to, "/home/deploy/apps/#{fetch(:application)}"
9
- set :rbenv_home, '/home/deploy/.rbenv'
10
- set :environment, {path: "#{fetch(:rbenv_home)}/shims:#{fetch(:rbenv_home)}/bin:$PATH", rails_env: 'production'}
5
+ # append :sync_dirs, 'public/system', 'public/files'
11
6
  set :log_level, :info
12
-
13
- SSHKit.config.command_map[:rake] = "#{fetch(:deploy_to)}/bin/rake"
14
- %w(ln service start restart stop status).each do |cmd|
15
- SSHKit.config.command_map[cmd.to_sym] = "sudo #{cmd}"
16
- end
17
- SSHKit.config.command_map[:eye] = "#{fetch(:rbenv_home)}/shims/eye"
18
- SSHKit.config.command_map[:su_rm] = "sudo rm"
19
-
20
- desc "Setup rails application for the first time on a server"
21
- task :setup do
22
- on roles(:all) do
23
- with fetch(:environment) do
24
- if test "[ -d #{fetch(:deploy_to)} ]"
25
- within fetch(:deploy_to) do
26
- execute :git, :fetch, 'origin'
27
- execute :git, :reset, '--hard origin/master'
28
- end
29
- else
30
- execute :git, :clone, fetch(:repo_url), fetch(:deploy_to)
31
- end
32
- server_conf_dir = "#{fetch(:deploy_to)}/config/server"
33
- execute :ln, "-s -f #{server_conf_dir}/nginx.conf /etc/nginx/conf.d/#{fetch(:application)}.conf"
34
- execute :ln, "-s -f #{server_conf_dir}/letsencrypt.conf /etc/nginx/letsencrypt/#{fetch(:application)}.conf"
35
- execute :ln, "-s -f #{server_conf_dir}/logrotate.conf /etc/logrotate.d/#{fetch(:application)}"
36
- within fetch(:deploy_to) do
37
- execute :bundle, :install, "--without development test"
38
- execute :mkdir, "-p #{fetch(:deploy_to)}/tmp/pids"
39
- if test "[ -f #{fetch(:deploy_to)}/.env ]"
40
- execute :rake, 'db:create'
41
- if test "[ -f #{fetch(:deploy_to)}/db/#{fetch(:application)}.sql ]"
42
- execute :psql, "-d #{fetch(:application)}_production", "-f db/#{fetch(:application)}.sql"
43
- end
44
- execute :rake, 'db:migrate'
45
- execute :rake, 'assets:precompile'
46
- execute :eye, :load, 'Eyefile'
47
- execute :eye, :start, fetch(:application)
48
- execute :service, "nginx restart"
49
- else
50
- execute :cp, '.env.example.production', '.env'
51
- execute "sed -i -e 's/TODO: generate with: rake secret/#{SecureRandom.hex(64)}/g' #{fetch(:deploy_to)}/.env"
52
- warn "TODO: Edit .env and modify your database and smtp settings."
53
- warn "TODO: Create ssl certificates by running the following command as root: /etc/letsencrypt/generate_letsencrypt.sh"
54
- warn "TODO: Run 'cap ENV setup' again!"
55
- end
56
- end
57
- end
58
- end
59
- end
60
-
61
- desc "Remove the application completely from the server"
62
- task :remove do
63
- on roles(:all) do
64
- with fetch(:environment) do
65
- within fetch(:deploy_to) do
66
- execute :eye, :load, 'Eyefile'
67
- execute :eye, :stop, fetch(:application)
68
- execute :rake, 'db:drop'
69
- execute :su_rm, "-rf #{fetch(:deploy_to)}"
70
- end if test "[ -d #{fetch(:deploy_to)} ]"
71
- execute :su_rm, "-f /etc/nginx/conf.d/#{fetch(:application)}.conf"
72
- execute :su_rm, "-f /etc/nginx/letsencrypt/#{fetch(:application)}.conf"
73
- execute :su_rm, "-f /etc/logrotate.d/#{fetch(:application)}"
74
- execute :service, "nginx restart"
75
- end
76
- end
77
- end
78
-
79
- desc "Deploy rails application"
80
- task :deploy do
81
- on roles(:all) do
82
- with fetch(:environment) do
83
- within fetch(:deploy_to) do
84
- execute :git, :fetch, 'origin'
85
- execute :git, :reset, '--hard origin/master'
86
- execute :bundle, :install
87
- execute :rake, 'db:migrate'
88
- execute :rake, 'assets:precompile'
89
- execute :eye, :load, 'Eyefile'
90
- execute :eye, :restart, fetch(:application)
91
- execute :service, "nginx restart"
92
- end
93
- end
94
- end
95
- end
96
-
97
- desc "Copy database from the server to the local machine"
98
- task :sync_local do
99
- on roles(:all) do
100
- within fetch(:deploy_to) do
101
- execute :pg_dump, "-U deploy --clean #{fetch(:application)}_production > db/#{fetch(:application)}.sql"
102
- download! "#{fetch(:deploy_to)}/db/#{fetch(:application)}.sql", 'db'
103
- end
104
- end
105
- run_locally do
106
- execute "psql -d #{fetch(:application)}_development -f db/#{fetch(:application)}.sql"
107
- end
108
- end
109
-
110
- desc "Recreate server database from db/#{fetch(:application)}.sql"
111
- task :reset_server do
112
- on roles(:all) do
113
- with fetch(:environment) do
114
- within fetch(:deploy_to) do
115
- execute :eye, :load, 'Eyefile'
116
- execute :eye, :stop, fetch(:application)
117
- execute :git, :fetch, 'origin'
118
- execute :git, :reset, '--hard origin/master'
119
- execute :rake, 'db:drop'
120
- execute :rake, 'db:create'
121
- if test "[ -f #{fetch(:deploy_to)}/db/#{fetch(:application)}.sql ]"
122
- execute :psql, "-d #{fetch(:application)}_production", "-f db/#{fetch(:application)}.sql"
123
- end
124
- execute :rake, 'db:migrate'
125
- execute :eye, :start, fetch(:application)
126
- execute :service, "nginx restart"
127
- end
128
- end
129
- end
130
- end
@@ -2,3 +2,4 @@
2
2
  set :server, '<%= @config.server %>'
3
3
  set :user, 'deploy'
4
4
  server fetch(:server), user: fetch(:user), roles: %w{web app db}
5
+ # set :deploy_branch, 'anotherbranch'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Jancev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-26 00:00:00.000000000 Z
11
+ date: 2016-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler