Skip to content

Commit

Permalink
Merge pull request #59 from CDLUC3/tom9path
Browse files Browse the repository at this point in the history
configure endpoints by pattern
  • Loading branch information
terrywbrady authored Feb 26, 2024
2 parents 9992221 + 1140118 commit dd49b4b
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 62 deletions.
34 changes: 15 additions & 19 deletions src-colladmin/actions/tag_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,22 @@ def urls
res = {}
return res unless @state == 'running'

@config.fetch('endpoints', {}).fetch(@subservice, {}).each do |k, v|
if k == 'state' && @subservice == 'ui'
m = @name.match(/(ui0[0-9])x2-stg/)
if m
res[k.to_s] = "https://#{m[1]}-aws-stg.cdlib.org/state.json"
@config.fetch('server-configs', {}).each_value do |sconf|
match = sconf.fetch('match', '.*')
next unless @name =~ Regexp.new(match)

sconf.fetch('endpoints', {}).fetch(@subservice, {}).each do |k, v|
if v =~ /^http/
res[k] = v
elsif v =~ %r{^/}
# UI uses this
res[k] = "https://#{@name}.cdlib.org#{v}"
else
m = @name.match(/(ui0[0-9])x2/)
res[k.to_s] = "https://#{m[1]}-aws.cdlib.org/state.json" if m
# assume value starts with port number, no http expected
res[k] = "http://#{@name}.cdlib.org:#{v}"
end
elsif k == 'audit_rep' && @subservice == 'ui'
m = @name.match(/(ui0[0-9])x2-stg/)
if m
res[k.to_s] = "https://#{m[1]}-aws-stg.cdlib.org/state-audit-replic.json"
else
m = @name.match(/(ui0[0-9])x2/)
res[k.to_s] = "https://#{m[1]}-aws.cdlib.org/state-audit-replic.json" if m
end
elsif v =~ /^http/
res[k] = v
else
res[k] = "http://#{@name}.cdlib.org:#{v}"
end
break
end
res
end
Expand All @@ -93,6 +87,8 @@ def format_urls
end

def notes(action)
return '' if urls.empty?

note = @config.fetch('notes', {}).fetch(@subservice, '').split("\n").join(',')
if @subservice == 'access'
srvr = action.get_ssm('store/zoo/AccessLarge')
Expand Down
143 changes: 100 additions & 43 deletions src-colladmin/config/database.ssm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,49 +62,106 @@ default:
ldap: |
ALB exists. LDAP admin requires credentials to access. Navigate to "Merritt User Accounts" to query LDAP.
# Provide state endpoints for specific subservices - not applicable for docker
endpoints:
ingest:
state: "{!SSM: ingest/port}/state?t=json"
build-info: "{!SSM: ingest/port}/static/build.content.txt"
ALB: "{!SSM: colladmin/ingest-service}state?t=json"
store:
jsonstatus: "{!SSM: store/port}/jsonstatus"
state: "{!SSM: store/port}/state?t=json"
ping: "{!SSM: store/port}/ping?t=json"
hostname: "{!SSM: store/port}/hostname"
build-info: "{!SSM: store/port}/static/build.content.txt"
ALB: "{!SSM: colladmin/storage-service}/state?t=json"
access:
jsonstatus: "{!SSM: store/port}/jsonstatus"
state: "{!SSM: store/port}/state?t=json"
ping: "{!SSM: store/port}/ping?t=json"
hostname: "{!SSM: store/port}/hostname"
build-info: "{!SSM: store/port}/static/build.content.txt"
ALB: "{!SSM: colladmin/access-service}/state?t=json"
inventory:
state: "{!SSM: inventory/port}/mrtinv/state?t=json"
build-info: "{!SSM: inventory/port}/mrtinv/static/build.content.txt"
start: "{!SSM: inventory/port}/mrtinv/service/start?t=json"
stop: "{!SSM: inventory/port}/mrtinv/service/stop?t=json"
ALB: "{!SSM: colladmin/inventory-service}/state?t=json"
audit:
jsonstatus: "{!SSM: audit/port}/mrtaudit/jsonstatus"
state: "{!SSM: audit/port}/mrtaudit/state?t=json"
build-info: "{!SSM: audit/port}/mrtaudit/static/build.content.txt"
start: "{!SSM: audit/port}/mrtaudit/service/start?t=json"
stop: "{!SSM: audit/port}/mrtaudit/service/stop?t=json"
replic:
jsonstatus: "{!SSM: replic/port}/mrtreplic/jsonstatus"
state: "{!SSM: replic/port}/mrtreplic/state?t=json"
build-info: "{!SSM: replic/port}/mrtreplic/static/build.content.txt"
start: "{!SSM: replic/port}/mrtreplic/service/start?t=json"
stop: "{!SSM: replic/port}/mrtreplic/service/stop?t=json"
ui:
state: "/state.json"
audit_rep: "/state-audit-replic.json"
+ALB: "{!ENV: MERRITT_PATH}/state.json"
ldap:
-ALB: "https://{!SSM: ldap/host}"
server-configs:
al2-stg:
match: '.*x2-stg$'
endpoints:
ui:
state: "/state.json"
audit_rep: "/state-audit-replic.json"
+ALB: "{!ENV: MERRITT_PATH}/state.json"
ldap:
-ALB: "https://{!SSM: ldap/host}"
al2023:
match: '.*stg[0-9][0-9]$'
endpoints:
ingest:
state: "{!SSM: ingest/port}/state?t=json"
build-info: "{!SSM: ingest/port}/static/build.content.txt"
ALB: "{!SSM: colladmin/ingest-service}state?t=json"
store:
jsonstatus: "{!SSM: store/port}/jsonstatus"
state: "{!SSM: store/port}/state?t=json"
ping: "{!SSM: store/port}/ping?t=json"
hostname: "{!SSM: store/port}/hostname"
build-info: "{!SSM: store/port}/static/build.content.txt"
ALB: "{!SSM: colladmin/storage-service}/state?t=json"
access:
jsonstatus: "{!SSM: store/port}/jsonstatus"
state: "{!SSM: store/port}/state?t=json"
ping: "{!SSM: store/port}/ping?t=json"
hostname: "{!SSM: store/port}/hostname"
build-info: "{!SSM: store/port}/static/build.content.txt"
ALB: "{!SSM: colladmin/access-service}/state?t=json"
inventory:
state: "{!SSM: inventory/port}/state?t=json"
build-info: "{!SSM: inventory/port}/static/build.content.txt"
start: "{!SSM: inventory/port}/service/start?t=json"
stop: "{!SSM: inventory/port}/service/stop?t=json"
ALB: "{!SSM: colladmin/inventory-service}/state?t=json"
audit:
jsonstatus: "{!SSM: audit/port}/jsonstatus"
state: "{!SSM: audit/port}/state?t=json"
build-info: "{!SSM: audit/port}/static/build.content.txt"
start: "{!SSM: audit/port}/service/start?t=json"
stop: "{!SSM: audit/port}/service/stop?t=json"
replic:
jsonstatus: "{!SSM: replic/port}/jsonstatus"
state: "{!SSM: replic/port}/state?t=json"
build-info: "{!SSM: replic/port}/static/build.content.txt"
start: "{!SSM: replic/port}/service/start?t=json"
stop: "{!SSM: replic/port}/service/stop?t=json"
ui:
state: "/state.json"
audit_rep: "/state-audit-replic.json"
+ALB: "{!ENV: MERRITT_PATH}/state.json"
ldap:
-ALB: "https://{!SSM: ldap/host}"
default:
match: '.*'
endpoints:
ingest:
state: "{!SSM: ingest/port}/state?t=json"
build-info: "{!SSM: ingest/port}/static/build.content.txt"
ALB: "{!SSM: colladmin/ingest-service}state?t=json"
store:
jsonstatus: "{!SSM: store/port}/jsonstatus"
state: "{!SSM: store/port}/state?t=json"
ping: "{!SSM: store/port}/ping?t=json"
hostname: "{!SSM: store/port}/hostname"
build-info: "{!SSM: store/port}/static/build.content.txt"
ALB: "{!SSM: colladmin/storage-service}/state?t=json"
access:
jsonstatus: "{!SSM: store/port}/jsonstatus"
state: "{!SSM: store/port}/state?t=json"
ping: "{!SSM: store/port}/ping?t=json"
hostname: "{!SSM: store/port}/hostname"
build-info: "{!SSM: store/port}/static/build.content.txt"
ALB: "{!SSM: colladmin/access-service}/state?t=json"
inventory:
state: "{!SSM: inventory/port}/mrtinv/state?t=json"
build-info: "{!SSM: inventory/port}/mrtinv/static/build.content.txt"
start: "{!SSM: inventory/port}/mrtinv/service/start?t=json"
stop: "{!SSM: inventory/port}/mrtinv/service/stop?t=json"
ALB: "{!SSM: colladmin/inventory-service}/state?t=json"
audit:
jsonstatus: "{!SSM: audit/port}/mrtaudit/jsonstatus"
state: "{!SSM: audit/port}/mrtaudit/state?t=json"
build-info: "{!SSM: audit/port}/mrtaudit/static/build.content.txt"
start: "{!SSM: audit/port}/mrtaudit/service/start?t=json"
stop: "{!SSM: audit/port}/mrtaudit/service/stop?t=json"
replic:
jsonstatus: "{!SSM: replic/port}/mrtreplic/jsonstatus"
state: "{!SSM: replic/port}/mrtreplic/state?t=json"
build-info: "{!SSM: replic/port}/mrtreplic/static/build.content.txt"
start: "{!SSM: replic/port}/mrtreplic/service/start?t=json"
stop: "{!SSM: replic/port}/mrtreplic/service/stop?t=json"
ui:
state: "/state.json"
audit_rep: "/state-audit-replic.json"
+ALB: "{!ENV: MERRITT_PATH}/state.json"
ldap:
-ALB: "https://{!SSM: ldap/host}"
replic-service: "{!SSM: colladmin/replic-service}"
storage-service: "{!SSM: colladmin/storage-service}"
access-service: "{!SSM: colladmin/access-service}"
Expand Down

0 comments on commit dd49b4b

Please sign in to comment.