ish_models 3.1.0.27 → 3.1.0.28

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
  SHA256:
3
- metadata.gz: '0877cf4f0630ecaabf593722fc112a8c03415eb38cec5eb1479fc44d7da7174b'
4
- data.tar.gz: 87d3659e67c451b2f5ab56ac4bffe92a5b666bea8de2a8a8e9f097a6c457df15
3
+ metadata.gz: f77703119867d13489f0e84255ecc02e7a152474455a3c2a884667a8ced99d44
4
+ data.tar.gz: 00f941a380436c361ba76d5786de744a50d314a6076d5a7ae261de9e86238625
5
5
  SHA512:
6
- metadata.gz: 3abb03c36b58a51b75d3a0cea9fdff8d8c9fe20d7fa1458019debcb863111cf2d39ea7c67cbad4aa5d8c1bdeddb813956c21c75586727173225979291d4d73fa
7
- data.tar.gz: 3f5db15afa9d22e226d0e5b3937b1a2a0fa0f7d5b5d8d90b1c1f074a94c1791f134b992a40521f4aa8b3b36013bff952354cb86139b97313c1ba9f4e6ff1ad4c
6
+ metadata.gz: 78c31ff8da2c868b49d55ffc7e37765795548bc09a5ab53dab01a4ed0507191a8f0fd34df10703f8d12557f33b8487f77f234acdcf2438125af4dbfd6846fea5
7
+ data.tar.gz: e1e9f2117ff9ffef73c6bc304512ace708248bf87bdd9c4191759a0b78e9711ff54a54bfc90619137c4ece2b0a37cd90095e3ca444c0d1427a05d023896b2f51
@@ -0,0 +1,24 @@
1
+
2
+ require 'net/scp'
3
+ require 'open3'
4
+
5
+ class CertbotJob
6
+ include Sidekiq::Job
7
+ sidekiq_options queue: 'wasya_co_rb'
8
+
9
+ def perform id
10
+ puts! id, 'CertbotJob#perform...'
11
+
12
+ app = WcoHosting::Appliance.find id
13
+ cmd = "ssh #{app.serverhost.ssh_host} 'certbot run -d #{app.host} --nginx -n ' "
14
+ stdout, stderr, status = Open3.capture3(cmd)
15
+ status = status.to_s.split.last.to_i
16
+
17
+ if 0 != status && 0 != app.n_retries
18
+ app.update_attributes({ n_retries: app.n_retries - 1 })
19
+ CertbotJob.perform_in( 15.minutes, app.id.to_s )
20
+ end
21
+
22
+ end
23
+
24
+ end
@@ -19,9 +19,8 @@ class WcoHosting::Appliance
19
19
  def host
20
20
  "#{subdomain}.#{domain}"
21
21
  end
22
- def route53_zone
23
- WcoHosting::Domain.find_by( name: domain ).route53_zone
24
- end
22
+
23
+ field :n_retries, type: :integer, default: 3
25
24
 
26
25
  belongs_to :appliance_tmpl, class_name: 'WcoHosting::ApplianceTmpl'
27
26
  def tmpl
@@ -32,8 +32,6 @@ class WcoHosting::Serverhost
32
32
  # puts! app, 'Serverhost#create_appliance'
33
33
 
34
34
  create_subdomain( app )
35
- sleep 5
36
-
37
35
  create_volume( app )
38
36
  add_docker_service( app )
39
37
  add_nginx_site( app )
@@ -93,10 +91,6 @@ class WcoHosting::Serverhost
93
91
  cmd = "ssh #{ssh_host} 'nginx -s reload ' "
94
92
  puts! cmd, 'cmd'
95
93
  `#{cmd}`
96
-
97
- cmd = "ssh #{ssh_host} 'certbot run -d #{app.host} --nginx -n ' "
98
- puts! cmd, 'cmd'
99
- `#{cmd}`
100
94
  end
101
95
 
102
96
  def add_docker_service app
@@ -189,6 +183,7 @@ class WcoHosting::Serverhost
189
183
 
190
184
  puts! cmd, '#do_exec'
191
185
  stdout, stderr, status = Open3.capture3(cmd)
186
+ status = status.to_s.split.last.to_i
192
187
  puts "+++ +++ stdout"
193
188
  puts stdout
194
189
  # @messages.push( stdout )
@@ -196,7 +191,7 @@ class WcoHosting::Serverhost
196
191
  puts stderr
197
192
  # @errors.push( stderr )
198
193
  puts! status, 'status'
199
- # @statuses.push( status.to_s.split.last.to_i )
194
+ # @statuses.push( status )
200
195
  end
201
196
 
202
197
  def done_exec
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.27
4
+ version: 3.1.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - mac_a2141
@@ -149,7 +149,7 @@ files:
149
149
  - app/assets/stylesheets/ish_models/application.css
150
150
  - app/controllers/ish_models/application_controller.rb
151
151
  - app/helpers/ish_models/application_helper.rb
152
- - app/jobs/ish_models/application_job.rb
152
+ - app/jobs/wco_hosting/certbot_job.rb
153
153
  - app/mailers/ish_models/application_mailer.rb
154
154
  - app/models/wco/lead.rb
155
155
  - app/models/wco/leadset.rb
@@ -1,4 +0,0 @@
1
- module IshModels
2
- class ApplicationJob < ActiveJob::Base
3
- end
4
- end