railman-deployment 2.1.0 → 2.2.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
  SHA256:
3
- metadata.gz: 910a2b1b2539484221207ad7fc1197afc14c04db70425a542a11ea7ca161f307
4
- data.tar.gz: 7c46eb2c5c19587884189e795b769363eac0545d4a73cd8958a0cd9cbbef19dd
3
+ metadata.gz: c6b440d5bba0b2ad72dbaaa5938123adcf5e7b42108eaa4c6db9f4305adbc1cc
4
+ data.tar.gz: 34a5db3f384d4a6a8e5888ee3d3453662d7a156ad3e50ae04b1bdcf54327922b
5
5
  SHA512:
6
- metadata.gz: f0e1db881c56b002632609e399cc37d258bd641f36a5c0598aa2ccfd17ea9326624ab3807efaa66f3211b4639895812f5ff29abb28b310af5e309820bd1172fa
7
- data.tar.gz: f795aee9aa04af04972d50d41086b06ed10c406316114d2c5e1df8332fdf2cca85b072ec1a291e4a868e9ef746517906f0b9b73123e3f99b4334f0cc31339838
6
+ metadata.gz: dd4608c303b54690085a3248adbc306cc213c90684d9cc6935c592df9ac516b0c230a847d349fb7e79df4b95816da0715a61e49492119351d6bdf6bb000acdef
7
+ data.tar.gz: 7fe0f094f74200c125b9e5d135dd60d76978c6e60530cda14589f472f28bd73d80ae4422d351ac76116b98bf6923e06fe73abcfe6d8e716c01fe718cb2079d43
@@ -1,4 +1,4 @@
1
- desc 'Setup rails application for the first time on a server'
1
+ desc 'Setup rails or rack application for the first time on a server'
2
2
  task :setup do
3
3
  on roles(:all) do
4
4
  with fetch(:environment) do
@@ -10,18 +10,18 @@ task :setup do
10
10
  end
11
11
  server_conf_dir = "#{fetch(:deploy_to)}/config/server"
12
12
  execute :su_cp, "#{server_conf_dir}/puma.service /lib/systemd/system/#{fetch(:application)}.service"
13
- execute :su_cp, "#{server_conf_dir}/sidekiq.service /lib/systemd/system/#{fetch(:application)}_sidekiq.service"
13
+ execute :su_cp, "#{server_conf_dir}/sidekiq.service /lib/systemd/system/#{fetch(:application)}_sidekiq.service" if fetch(:rails_app, true)
14
14
  execute :su_cp, "#{server_conf_dir}/logrotate.conf /etc/logrotate.d/#{fetch(:application)}"
15
15
  within fetch(:deploy_to) do
16
- upload! './config/master.key', "#{fetch(:deploy_to)}/config/master.key"
16
+ upload! './config/master.key', "#{fetch(:deploy_to)}/config/master.key" if fetch(:rails_app, true)
17
17
  execute :bundle, :install, '--without development test'
18
- invoke :create_database_from_sql_file
19
- execute :rake, 'assets:precompile'
18
+ invoke :create_database_from_sql_file if fetch(:rails_app, true)
19
+ execute :rake, 'assets:precompile' if fetch(:rails_app, true)
20
20
  execute :systemctl, 'daemon-reload'
21
21
  execute :systemctl, :start, fetch(:application)
22
- execute :systemctl, :start, "#{fetch(:application)}_sidekiq"
22
+ execute :systemctl, :start, "#{fetch(:application)}_sidekiq" if fetch(:rails_app, true)
23
23
  execute :systemctl, :enable, fetch(:application)
24
- execute :systemctl, :enable, "#{fetch(:application)}_sidekiq"
24
+ execute :systemctl, :enable, "#{fetch(:application)}_sidekiq" if fetch(:rails_app, true)
25
25
  # copy temporary simple nginx.conf only for getting letsencrypt certificate
26
26
  nginx_conf = File.read(File.join(File.dirname(__FILE__), 'nginx.conf'))
27
27
  nginx_conf.gsub!('DOMAINS', fetch(:domains).join(' '))
@@ -45,14 +45,14 @@ task :remove do
45
45
  with fetch(:environment) do
46
46
  # stop, disable and remove systemd service files
47
47
  execute :systemctl, :stop, fetch(:application)
48
- execute :systemctl, :stop, "#{fetch(:application)}_sidekiq"
48
+ execute :systemctl, :stop, "#{fetch(:application)}_sidekiq" if fetch(:rails_app, true)
49
49
  execute :systemctl, :disable, fetch(:application)
50
- execute :systemctl, :disable, "#{fetch(:application)}_sidekiq"
50
+ execute :systemctl, :disable, "#{fetch(:application)}_sidekiq" if fetch(:rails_app, true)
51
51
  execute :su_rm, "-f /lib/systemd/system/#{fetch(:application)}.service"
52
- execute :su_rm, "-f /lib/systemd/system/#{fetch(:application)}_sidekiq.service"
52
+ execute :su_rm, "-f /lib/systemd/system/#{fetch(:application)}_sidekiq.service" if fetch(:rails_app, true)
53
53
  # dropt the database and remove the application directory from /home/deploy/apps
54
54
  within fetch(:deploy_to) do
55
- execute :rake, 'db:drop'
55
+ execute :rake, 'db:drop' if fetch(:rails_app, true)
56
56
  execute :su_rm, "-rf #{fetch(:deploy_to)}"
57
57
  end if test "[ -d #{fetch(:deploy_to)} ]"
58
58
  # remove application nginx configuration
@@ -71,10 +71,10 @@ task :deploy do
71
71
  within fetch(:deploy_to) do
72
72
  invoke :fetch_and_reset_git_repository
73
73
  execute :bundle, :install
74
- execute :rake, 'db:migrate'
75
- execute :rake, 'assets:precompile'
74
+ execute :rake, 'db:migrate' if fetch(:rails_app, true)
75
+ execute :rake, 'assets:precompile' if fetch(:rails_app, true)
76
76
  execute :systemctl, :restart, fetch(:application)
77
- execute :systemctl, :restart, "#{fetch(:application)}_sidekiq"
77
+ execute :systemctl, :restart, "#{fetch(:application)}_sidekiq" if fetch(:rails_app, true)
78
78
  execute :systemctl, :restart, :nginx
79
79
  end
80
80
  end
@@ -87,11 +87,11 @@ task :update do
87
87
  within fetch(:deploy_to) do
88
88
  execute :pg_dump, "-U rails -h localhost --clean --no-owner #{fetch(:application)}_production > db/#{fetch(:application)}.sql"
89
89
  download! "#{fetch(:deploy_to)}/db/#{fetch(:application)}.sql", 'db'
90
- end
90
+ end if fetch(:rails_app, true)
91
91
  end
92
92
  run_locally do
93
93
  execute "psql -d #{fetch(:application)}_development -f db/#{fetch(:application)}.sql"
94
- end
94
+ end if fetch(:rails_app, true)
95
95
  invoke :sync_local_dirs_from_server
96
96
  end
97
97
 
@@ -1,3 +1,3 @@
1
1
  module RailmanDeployment
2
- VERSION = '2.1.0'
2
+ VERSION = '2.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railman-deployment
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Jancev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-13 00:00:00.000000000 Z
11
+ date: 2018-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler