et_full_system 7.0.2 → 7.0.3

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: c28e02d28fadafbdfe820ea506eadfd0ddb8268d7ae7b2b9215dfc7face19d6a
4
- data.tar.gz: 67e919b9b84c70345b158afae12cee377152efea6aab0df343add4cd08a2223d
3
+ metadata.gz: 547c2cae46678baf0823bd64996d3210cffccc6004f7b51d3c7a47c8f2ad9714
4
+ data.tar.gz: 06eb0eb61df6573e0356277b344bfd06fb620dd7805ea3223ab6bb6dbef920c0
5
5
  SHA512:
6
- metadata.gz: cc8b3bda5550c5999883898b46bad1a7c85acb8a8de47203173c4eb29947f51c2e20351cba804cd84706eca83ab49221fd7c03c20338124f610d732d8c05af2c
7
- data.tar.gz: 4a60462396489b9252454914cf5a89f8a24e2ec35fec139d3db004b3c29a7b239c59f918b207f8d07178b35604bd57a030866da50f65a8d37886bfaf666700eb
6
+ metadata.gz: 55d4f7379e5a2f533e09e54a4b53cace8be18f11ec477428ab3780633ad4ca310005ed95ee11569cea3a17d1ac94b343d77d4ea3cfd5dfffecd73d63617eac3e
7
+ data.tar.gz: 16ae911879d8917b07afd1c04cfb3c325a2d696f6c46acce41c4b2ad873135b61ce5562b4972e0488f9f90f19e7ed3a083b03722c0d4ed93299222bdcd137069
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- et_full_system (7.0.2)
4
+ et_full_system (7.0.3)
5
5
  azure-storage (~> 0.15.0.preview)
6
6
  dotenv (~> 2.7, >= 2.7.2)
7
7
  et_fake_ccd (~> 1.0)
data/foreman/Procfile CHANGED
@@ -1,4 +1,5 @@
1
- traefik: bash --login -c "traefik --configfile=${FOREMAN_PATH}/traefik.toml"
1
+ traefik: bash --login -c "traefik --providers.rest=true --providers.rest.insecure=true --api.insecure=true --api.insecure=true --entryPoints.http.address=:3100 --entryPoints.traefik.address=:3200"
2
+ fake_services: bash --login -c "cd ${FS_ROOT_PATH}/support/fake_services && ./bin/foreman start --port 9000"
2
3
  et1_web: export FREEPORT=$(freeport) && godotenv -f ${FOREMAN_PATH}/.env godotenv -f ${FOREMAN_PATH}/et1.env bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url et1 http://localhost:$FREEPORT && cd systems/et1 && PORT=$FREEPORT ./run.sh"
3
4
  et1_sidekiq: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && cd systems/et1 && godotenv -f ${FOREMAN_PATH}/.env godotenv -f ${FOREMAN_PATH}/et1.env ./run_sidekiq.sh"
4
5
  et3_web: export FREEPORT=$(freeport) && godotenv -f ${FOREMAN_PATH}/.env godotenv -f ${FOREMAN_PATH}/et3.env bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url et3 http://localhost:$FREEPORT && cd systems/et3 && PORT=$FREEPORT ./run.sh"
@@ -8,7 +9,4 @@ api_sidekiq: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_fo
8
9
  admin_web: export FREEPORT=$(freeport) && godotenv -f ${FOREMAN_PATH}/.env godotenv -f ${FOREMAN_PATH}/et_admin.env bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url admin http://localhost:$FREEPORT && cd systems/admin && PORT=$FREEPORT ./run.sh"
9
10
  atos_api_web: export FREEPORT=$(freeport) && godotenv -f ${FOREMAN_PATH}/.env godotenv -f ${FOREMAN_PATH}/et_atos.env bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url atos_api http://localhost:$FREEPORT && cd systems/atos && PORT=$FREEPORT ./run.sh"
10
11
  azure_blob_web: bash --login -c "azurite -l ${AZURITE_STORAGE_PATH} -d ${AZURITE_STORAGE_PATH}/debug.log"
11
- fake_acas_web: export FREEPORT=$(freeport) && bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url fake_acas http://localhost:$FREEPORT && rvm use && et_fake_acas_server -port $FREEPORT -threads=1 -workers=2"
12
- fake_ccd_web: export FREEPORT=$(freeport) && bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url fake_ccd http://localhost:$FREEPORT && rvm use && et_fake_ccd start --port=$FREEPORT --create_case_schema=./systems/et_ccd_export/spec/json_schemas/case_create.json"
13
- fake_notify_web: export FREEPORT=$(freeport) && godotenv -f ${FOREMAN_PATH}/.env godotenv -f ${FOREMAN_PATH}/fake_notify.env bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url fake_notify http://localhost:$FREEPORT && rvm use && gov_fake_notify start --port=$FREEPORT --config=${FOREMAN_PATH}/gov_fake_notify.yaml"
14
12
  et_ccd_export_sidekiq: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && cd systems/et_ccd_export && godotenv -f ${FOREMAN_PATH}/.env godotenv -f ${FOREMAN_PATH}/et_ccd_export.env ./run_sidekiq.sh"
data/foreman/traefik.json CHANGED
@@ -1,208 +1,148 @@
1
1
  {
2
- "backends": {
3
- "et1": {
4
- "servers": {
5
- "web": {
6
- "url": "http://localhost:5101",
7
- "weight": 1
8
- }
9
- }
10
- },
11
- "et3": {
12
- "servers": {
13
- "web": {
14
- "url": "http://localhost:5601",
15
- "weight": 1
16
- }
17
- }
18
- },
19
- "admin": {
20
- "servers": {
21
- "web": {
22
- "url": "http://localhost:7801",
23
- "weight": 1
24
- }
25
- }
26
- },
27
- "api": {
28
- "servers": {
29
- "web": {
30
- "url": "http://localhost:6501",
31
- "weight": 1
32
- }
33
- }
34
- },
35
- "atos_api": {
36
- "servers": {
37
- "web": {
38
- "url": "http://localhost:8601",
39
- "weight": 1
40
- }
41
- }
42
- },
43
- "mail": {
44
- "servers": {
45
- "web": {
46
- "url": "http://localhost:8025",
47
- "weight": 1
48
- }
49
- }
50
- },
51
- "azure_blob": {
52
- "servers": {
53
- "web": {
54
- "url": "http://localhost:10000",
55
- "weight": 1
56
- }
57
- }
58
- },
59
- "fake_acas": {
60
- "servers": {
61
- "web": {
62
- "url": "http://localhost:11601",
63
- "weight": 1
64
- }
65
- }
66
- },
67
- "fake_ccd": {
68
- "servers": {
69
- "web": {
70
- "url": "http://localhost:11602",
71
- "weight": 1
72
- }
73
- }
74
- },
75
- "fake_notify": {
76
- "servers": {
77
- "web": {
78
- "url": "http://localhost:11603",
79
- "weight": 1
80
- }
81
- }
82
- }
83
-
84
-
85
- },
86
- "frontends": {
87
- "et1": {
88
- "entryPoints": [
89
- "http"
90
- ],
91
- "backend": "et1",
92
- "passHostHeader": true,
93
- "routes": {
94
- "test_1": {
95
- "rule": "Host:et1.et.127.0.0.1.nip.io"
96
- }
97
- }
98
- },
99
- "et3": {
100
- "entryPoints": [
101
- "http"
102
- ],
103
- "backend": "et3",
104
- "passHostHeader": true,
105
- "routes": {
106
- "test_1": {
107
- "rule": "Host:et3.et.127.0.0.1.nip.io"
108
- }
109
- }
110
- },
111
- "admin": {
112
- "entryPoints": [
113
- "http"
114
- ],
115
- "backend": "admin",
116
- "passHostHeader": true,
117
- "routes": {
118
- "test_1": {
119
- "rule": "Host:admin.et.127.0.0.1.nip.io"
120
- }
121
- }
122
- },
123
- "api": {
124
- "entryPoints": [
125
- "http"
126
- ],
127
- "backend": "api",
128
- "passHostHeader": true,
129
- "routes": {
130
- "test_1": {
131
- "rule": "Host:api.et.127.0.0.1.nip.io"
132
- }
133
- }
134
- },
135
- "atos_api": {
136
- "entryPoints": [
137
- "http"
138
- ],
139
- "backend": "atos_api",
140
- "passHostHeader": true,
141
- "routes": {
142
- "test_1": {
143
- "rule": "Host:atos.et.127.0.0.1.nip.io"
144
- }
145
- }
146
- },
147
- "mail": {
148
- "entryPoints": [
149
- "http"
150
- ],
151
- "backend": "mail",
152
- "passHostHeader": true,
153
- "routes": {
154
- "test_1": {
155
- "rule": "Host:mail.et.127.0.0.1.nip.io"
156
- }
157
- }
158
- },
159
- "azure_blob": {
160
- "entryPoints": [
161
- "http"
162
- ],
163
- "backend": "azure_blob",
164
- "passHostHeader": true,
165
- "routes": {
166
- "test_1": {
167
- "rule": "Host:azure_blob_storage.et.127.0.0.1.nip.io"
168
- }
169
- }
170
- },
171
- "fake_acas": {
172
- "entryPoints": [
173
- "http"
174
- ],
175
- "backend": "fake_acas",
176
- "passHostHeader": true,
177
- "routes": {
178
- "test_1": {
179
- "rule": "Host:acas.et.127.0.0.1.nip.io"
180
- }
181
- }
182
- },
183
- "fake_ccd": {
184
- "entryPoints": [
185
- "http"
186
- ],
187
- "backend": "fake_ccd",
188
- "passHostHeader": true,
189
- "routes": {
190
- "test_1": {
191
- "rule": "Host:ccd.et.127.0.0.1.nip.io"
192
- }
193
- }
194
- },
195
- "fake_notify": {
196
- "entryPoints": [
197
- "http"
198
- ],
199
- "backend": "fake_notify",
200
- "passHostHeader": true,
201
- "routes": {
202
- "test_1": {
203
- "rule": "Host:notify.et.127.0.0.1.nip.io"
204
- }
2
+ "http": {
3
+ "services": {
4
+ "et1": {
5
+ "loadBalancer": {
6
+ "servers": [{
7
+ "url": "http://localhost:5101"
8
+ }]
9
+ }
10
+ },
11
+ "et3": {
12
+ "loadBalancer": {
13
+ "servers": [{
14
+ "url": "http://localhost:5601"
15
+ }]
16
+ }
17
+ },
18
+ "admin": {
19
+ "loadBalancer": {
20
+ "servers": [{
21
+ "url": "http://localhost:7801"
22
+ }]
23
+ }
24
+ },
25
+ "api": {
26
+ "loadBalancer": {
27
+ "servers": [{
28
+ "url": "http://localhost:6501"
29
+ }]
30
+ }
31
+ },
32
+ "atos_api": {
33
+ "loadBalancer": {
34
+ "servers": [{
35
+ "url": "http://localhost:8601"
36
+ }]
37
+ }
38
+ },
39
+ "mail": {
40
+ "loadBalancer": {
41
+ "servers": [{
42
+ "url": "http://localhost:8025"
43
+ }]
44
+ }
45
+ },
46
+ "azure_blob": {
47
+ "loadBalancer": {
48
+ "servers": [{
49
+ "url": "http://localhost:10000"
50
+ }]
51
+ }
52
+ },
53
+ "fake_acas": {
54
+ "loadBalancer": {
55
+ "servers": [{
56
+ "url": "http://localhost:9000"
57
+ }]
58
+ }
59
+ },
60
+ "fake_ccd": {
61
+ "loadBalancer": {
62
+ "servers": [{
63
+ "url": "http://localhost:9100"
64
+ }]
65
+ }
66
+ },
67
+ "fake_notify": {
68
+ "loadBalancer": {
69
+ "servers": [{
70
+ "url": "http://localhost:9200"
71
+ }]
72
+ }
73
+ }
74
+ },
75
+ "routers": {
76
+ "et1": {
77
+ "entryPoints": [
78
+ "http"
79
+ ],
80
+ "service": "et1",
81
+ "rule": "Host(`et1.et.127.0.0.1.nip.io`)"
82
+ },
83
+ "et3": {
84
+ "entryPoints": [
85
+ "http"
86
+ ],
87
+ "service": "et3",
88
+ "rule": "Host(`et3.et.127.0.0.1.nip.io`)"
89
+ },
90
+ "admin": {
91
+ "entryPoints": [
92
+ "http"
93
+ ],
94
+ "service": "admin",
95
+ "rule": "Host(`admin.et.127.0.0.1.nip.io`)"
96
+ },
97
+ "api": {
98
+ "entryPoints": [
99
+ "http"
100
+ ],
101
+ "service": "api",
102
+ "rule": "Host(`api.et.127.0.0.1.nip.io`)"
103
+ },
104
+ "atos_api": {
105
+ "entryPoints": [
106
+ "http"
107
+ ],
108
+ "service": "atos_api",
109
+ "rule": "Host(`atos.et.127.0.0.1.nip.io`)"
110
+ },
111
+ "mail": {
112
+ "entryPoints": [
113
+ "http"
114
+ ],
115
+ "service": "mail",
116
+ "rule": "Host(`mail.et.127.0.0.1.nip.io`)"
117
+ },
118
+ "azure_blob": {
119
+ "entryPoints": [
120
+ "http"
121
+ ],
122
+ "service": "azure_blob",
123
+ "rule": "Host(`azure_blob_storage.et.127.0.0.1.nip.io`)"
124
+ },
125
+ "fake_acas": {
126
+ "entryPoints": [
127
+ "http"
128
+ ],
129
+ "service": "fake_acas",
130
+ "rule": "Host(`acas.et.127.0.0.1.nip.io`)"
131
+ },
132
+ "fake_ccd": {
133
+ "entryPoints": [
134
+ "http"
135
+ ],
136
+ "service": "fake_ccd",
137
+ "rule": "Host(`ccd.et.127.0.0.1.nip.io`)"
138
+ },
139
+ "fake_notify": {
140
+ "entryPoints": [
141
+ "http"
142
+ ],
143
+ "service": "fake_notify",
144
+ "rule": "Host(`notify.et.127.0.0.1.nip.io`)"
205
145
  }
206
146
  }
207
- }
147
+ }
208
148
  }
@@ -16,6 +16,7 @@ module EtFullSystem
16
16
 
17
17
  class RestProviderNotConfigured < RuntimeError; end
18
18
  class ServiceUrlIncorrect < RuntimeError; end
19
+ class ServicesNotConfigured < RuntimeError; end
19
20
  desc "boot", "Sets up the server - traefik frontends and backends, along with initial data in local azure storage"
20
21
  method_option :base_url, type: :string, default: DEFAULT_BASE_URL
21
22
  def boot
@@ -54,8 +55,9 @@ module EtFullSystem
54
55
  setup_retry_countdown = 10
55
56
 
56
57
  begin
57
- resp = HTTParty.get "#{options[:base_url]}/api/providers/rest", headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
58
- raise RestProviderNotConfigured if resp.code == 404
58
+ resp = HTTParty.get "#{options[:base_url]}/api/rawdata", headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
59
+ raise RestProviderNotConfigured if resp.code == 404 || resp.parsed_response.dig('routers', 'rest@internal').nil?
60
+ raise ServicesNotConfigured if resp.parsed_response.dig('routers', 'et1@rest').nil?
59
61
  rescue Errno::EADDRNOTAVAIL, Errno::ECONNREFUSED
60
62
  connect_retry_countdown -= 1
61
63
  if connect_retry_countdown.zero?
@@ -74,6 +76,15 @@ module EtFullSystem
74
76
  sleep 5
75
77
  retry
76
78
  end
79
+ rescue ServicesNotConfigured
80
+ setup_retry_countdown -= 1
81
+ if setup_retry_countdown.zero?
82
+ raise "Could not find the ET1 router in traefik after 10 retries"
83
+ else
84
+ STDERR.puts "Re checking for the ET1 router in traefik in 5 seconds"
85
+ sleep 5
86
+ retry
87
+ end
77
88
  end
78
89
  STDERR.puts "Support services now ready"
79
90
  end
@@ -415,8 +426,8 @@ module EtFullSystem
415
426
  connect_retry_countdown = 10
416
427
  setup_retry_countdown = 10
417
428
  begin
418
- resp = HTTParty.get "#{options[:base_url]}/api/providers/rest", headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }
419
- raise RestProviderNotConfigured if resp.code == 404
429
+ resp = HTTParty.get "#{options[:base_url]}/api/rawdata", headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }
430
+ raise RestProviderNotConfigured if resp.code == 404 || resp.parsed_response.dig('routers', 'rest@internal').nil?
420
431
  rescue Errno::EADDRNOTAVAIL, Errno::ECONNREFUSED
421
432
  connect_retry_countdown -= 1
422
433
  if !options[:wait]
@@ -442,15 +453,16 @@ module EtFullSystem
442
453
  end
443
454
 
444
455
  json = resp.parsed_response.dup
445
- backend = json['backends'][service]
446
- raise "Unknown service called #{service} - valid options are #{json['backends'].keys.join(', ')}" if backend.nil?
456
+ backend = json.dig('services', "#{service}@rest")
457
+ raise "Unknown service called #{service} - valid options are #{json['services'].keys.join(', ')}" if backend.nil?
447
458
 
448
- container = backend.dig('servers', 'web')
449
- raise "The service '#{service}' has no server called 'web' - it must have for this command to work" if container.nil?
459
+ container = backend.dig('loadBalancer', 'servers')&.first
460
+ raise "The service '#{service}' has no load balancer with a list of servers - it must have for this command to work" if container.nil?
450
461
 
451
462
  if container['url'] != url
452
463
  container['url'] = url
453
- put_resp = HTTParty.put "#{options[:base_url]}/api/providers/rest", body: json.to_json, headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }
464
+ new_json = { http: json }.to_json.gsub(/@rest/, '')
465
+ put_resp = HTTParty.put "#{options[:base_url]}/api/providers/rest", body: new_json, headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }
454
466
  raise "Error from traefik says: #{put_resp.body}" unless (200..299).include? put_resp.code
455
467
 
456
468
  validate_rest_backend_url(service, url)
@@ -463,14 +475,14 @@ module EtFullSystem
463
475
  def validate_rest_backend_url(service, url)
464
476
  retry_countdown = 10
465
477
  begin
466
- resp = HTTParty.get "#{options[:base_url]}/api/providers/rest", headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }
467
- raise ServiceUrlIncorrect unless (200..299).include?(resp.code) && resp.parsed_response.dig('backends', service, 'servers', 'web', 'url') == url
478
+ resp = HTTParty.get "#{options[:base_url]}/api/rawdata", headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }
479
+ raise ServiceUrlIncorrect unless (200..299).include?(resp.code) && resp.parsed_response.dig('services', "#{service}@rest", 'loadBalancer', 'servers')&.first&.fetch('url', nil) == url
468
480
  return
469
481
  rescue ServiceUrlIncorrect
470
482
  retry_countdown -= 1
471
483
  raise if retry_countdown.zero?
472
484
 
473
- STDERR.puts "Retrying request to validate the url of '#{service}' is '#{url}' in 1 second"
485
+ STDERR.puts "Retrying request to validate the url of '#{service}' is '#{url}' in 1 second (it was #{resp.parsed_response.dig('services', "#{service}@rest", 'loadBalancer', 'servers')&.first&.fetch('url', nil)})"
474
486
  sleep 1
475
487
  retry
476
488
  end
@@ -1,3 +1,3 @@
1
1
  module EtFullSystem
2
- VERSION = "7.0.2"
2
+ VERSION = "7.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: et_full_system
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.2
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Taylor
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-06 00:00:00.000000000 Z
11
+ date: 2023-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -173,7 +173,7 @@ homepage: https://github.com/ministryofjustice/et-full-system
173
173
  licenses:
174
174
  - MIT
175
175
  metadata: {}
176
- post_install_message:
176
+ post_install_message:
177
177
  rdoc_options: []
178
178
  require_paths:
179
179
  - lib
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  version: '0'
190
190
  requirements: []
191
191
  rubygems_version: 3.1.6
192
- signing_key:
192
+ signing_key:
193
193
  specification_version: 4
194
194
  summary: Runs the employment tribunals system - all services and background jobs
195
195
  test_files: []