ish_models 3.1.0.26 → 3.1.0.28

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: 97f97bdcb51eb6182a726769934e5153bb3a0822ee4cf1aefcd556531cacbbb2
4
- data.tar.gz: dfa075773c4ae11888b6000d7e1d9679a49bfe3fc230c133359b5138f01d8f7b
3
+ metadata.gz: f77703119867d13489f0e84255ecc02e7a152474455a3c2a884667a8ced99d44
4
+ data.tar.gz: 00f941a380436c361ba76d5786de744a50d314a6076d5a7ae261de9e86238625
5
5
  SHA512:
6
- metadata.gz: 7fbb361e4c1fdbd4dae04a1bea306a98cc3ecf4fa3d79eadb2afaf67878400d50648d076aef765ee385541fa7b31f0cd92a8d3cc9705362684fc0acc6396e0f3
7
- data.tar.gz: feac5b484692d282f0ee2b0cc57967989a34c978396be2ac461293baaa0078332b88b1a3cfa357e333daef38e3f2d69a0cd927db30590f340cc641614b4bdcd8
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 )
@@ -50,12 +48,6 @@ class WcoHosting::Serverhost
50
48
  data: app.serverhost.public_ip,
51
49
  )
52
50
  client.domain_records.create(record, for_domain: app.domain )
53
- record = DropletKit::DomainRecord.new(
54
- type: 'AAAA',
55
- name: app.subdomain,
56
- data: app.serverhost.public_ip,
57
- )
58
- client.domain_records.create(record, for_domain: app.domain )
59
51
  end
60
52
 
61
53
  ## obsolete _vp_ 2023-12-23
@@ -99,10 +91,6 @@ class WcoHosting::Serverhost
99
91
  cmd = "ssh #{ssh_host} 'nginx -s reload ' "
100
92
  puts! cmd, 'cmd'
101
93
  `#{cmd}`
102
-
103
- cmd = "ssh #{ssh_host} 'certbot run -d #{app.host} --nginx -n ' "
104
- puts! cmd, 'cmd'
105
- `#{cmd}`
106
94
  end
107
95
 
108
96
  def add_docker_service app
@@ -195,6 +183,7 @@ class WcoHosting::Serverhost
195
183
 
196
184
  puts! cmd, '#do_exec'
197
185
  stdout, stderr, status = Open3.capture3(cmd)
186
+ status = status.to_s.split.last.to_i
198
187
  puts "+++ +++ stdout"
199
188
  puts stdout
200
189
  # @messages.push( stdout )
@@ -202,7 +191,7 @@ class WcoHosting::Serverhost
202
191
  puts stderr
203
192
  # @errors.push( stderr )
204
193
  puts! status, 'status'
205
- # @statuses.push( status.to_s.split.last.to_i )
194
+ # @statuses.push( status )
206
195
  end
207
196
 
208
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.26
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