Skip to content

Commit

Permalink
update dmsghttp-config.json & services-config.json & add update scrip…
Browse files Browse the repository at this point in the history
…ts + Makefile directive
  • Loading branch information
0pcom committed Sep 29, 2024
1 parent 8ebc8a4 commit ee75902
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 141 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ date:
commit:
@echo $(COMMIT)

services: ## update services-config.json
scripts/services.sh

dig-services: ## show IP addresses for the services
scripts/dig-services.sh

dmsghttp: ## update dmsghttp-config.json
scripts/dmsghttp.sh

count-dmsg-disc-entries:
curl -sL $(jq -r '.prod.dmsg_discovery' services-config.json)/dmsg-discovery/entries | jq '. | length'

check: lint check-cg test ## Run linters and tests

check-cg: ## Cursory check of the main help menu, offline dmsghttp config gen and offline config gen
Expand Down Expand Up @@ -365,8 +377,8 @@ windows-installer-release:
gh release upload --repo skycoin/skywire ${GITHUB_TAG} ./skywire-installer-${GITHUB_TAG}-windows-386.msi

# useful commands
dmsghttp-update: ## update dmsghttp config
go run cmd/skywire/skywire.go cli config update dmsghttp -p dmsghttp-config.json
#dmsghttp-update: ## update dmsghttp config
# go run cmd/skywire/skywire.go cli config update dmsghttp -p dmsghttp-config.json

help: ## `make help` menu
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Expand Down
110 changes: 49 additions & 61 deletions dmsghttp-config.json
Original file line number Diff line number Diff line change
@@ -1,76 +1,64 @@
{
"test": {
"dmsg_servers": [
"test": {
"dmsg_servers": [
{
"static": "024716428e6315d954356e9ad72bea32bb2b41aab5a54a9b5cb4313964016e64d8",
"server": {
"address": "139.144.183.24:30080"
}
},
{
"static": "0228af3fd99c8d86a882495c8e0202bdd4da78c69e013065d8634286dd4a0ac098",
"server": {
"address": "139.162.55.79:30084"
}
},
{
"static": "03d5b55d1133b26485c664cf8b95cff6746d1e321c34e48c9fed293eff0d6d49e5",
"server": {
"address": "170.187.228.44:30083"
}
"static": "024716428e6315d954356e9ad72bea32bb2b41aab5a54a9b5cb4313964016e64d8",
"server": {
"address": "139.144.183.24:30080"
}
}
],
"dmsg_discovery": "dmsg://022e607e0914d6e7ccda7587f95790c09e126bbd506cc476a1eda852325aadd1aa:80",
"transport_discovery": "dmsg://02703cf828ea11d25b2c8eb0796132ecc7e53b22325b20ce3674ce5cd8693e4fb6:80",
"address_resolver": "dmsg://030eb7d8cf6eac40c19bbc433de6d6b9bb7a47f2e1d7095c6a01aa676471670ad2:80",
"route_finder": "dmsg://02ece5b69eaee13ef967b7eb67ca93f1dfddad3a51c9cb1808c4bd0d8d8aa32053:80",
"uptime_tracker": "dmsg://022c788cca11f208cdfd83ed0c2a8c7b661221736c461adc7c6738a2c1b041c7f8:80",
"service_discovery": "dmsg://038f751df4af75fb3d51f6693602bfe8289145e633ffdd1e67d686bea595f84d55:80"
},
"prod": {
"dmsg_servers": [
],
"dmsg_discovery": "dmsg://024a7b9b7db1626d46777e5c665333afa57f48934b57652305fc7a2b19dc4c65d4:80",
"transport_discovery": "dmsg://02703cf828ea11d25b2c8eb0796132ecc7e53b22325b20ce3674ce5cd8693e4fb6:80",
"address_resolver": "dmsg://030eb7d8cf6eac40c19bbc433de6d6b9bb7a47f2e1d7095c6a01aa676471670ad2:80",
"route_finder": "dmsg://02ece5b69eaee13ef967b7eb67ca93f1dfddad3a51c9cb1808c4bd0d8d8aa32053:80",
"uptime_tracker": "dmsg://022c788cca11f208cdfd83ed0c2a8c7b661221736c461adc7c6738a2c1b041c7f8:80",
"service_discovery": "dmsg://038f751df4af75fb3d51f6693602bfe8289145e633ffdd1e67d686bea595f84d55:80"
},
"prod": {
"dmsg_servers": [
{
"static": "0371ab4bcff7b121f4b91f6856d6740c6f9dc1fe716977850aeb5d84378b300a13",
"server": {
"address": "139.162.160.227:30087"
}
"static": "0371ab4bcff7b121f4b91f6856d6740c6f9dc1fe716977850aeb5d84378b300a13",
"server": {
"address": "139.162.160.227:30087"
}
},
{
"static": "030c83534af1041aee60c2f124b682a9d60c6421876db7c67fc83a73c5effdbd96",
"server": {
"address": "188.121.99.59:8081"
}
"static": "030c83534af1041aee60c2f124b682a9d60c6421876db7c67fc83a73c5effdbd96",
"server": {
"address": "188.121.99.59:8081"
}
},
{
"static": "0326978f5a53aff537dbb47fed58b1f123af3b00132d365f1309a14db4168dcff7",
"server": {
"address": "70.121.13.123:9083"
}
"static": "0326978f5a53aff537dbb47fed58b1f123af3b00132d365f1309a14db4168dcff7",
"server": {
"address": "70.121.13.123:9083"
}
},
{
"static": "0281a102c82820e811368c8d028cf11b1a985043b726b1bcdb8fce89b27384b2cb",
"server": {
"address": "139.162.160.227:30086"
}
"static": "0281a102c82820e811368c8d028cf11b1a985043b726b1bcdb8fce89b27384b2cb",
"server": {
"address": "139.162.160.227:30086"
}
},
{
"static": "03717576ada5b1744e395c66c2bb11cea73b0e23d0dcd54422139b1a7f12e962c4",
"server": {
"address": "139.162.173.101:30083"
}
"static": "03717576ada5b1744e395c66c2bb11cea73b0e23d0dcd54422139b1a7f12e962c4",
"server": {
"address": "139.162.173.101:30083"
}
},
{
"static": "02a2d4c346dabd165fd555dfdba4a7f4d18786fe7e055e562397cd5102bdd7f8dd",
"server": {
"address": "139.162.173.101:30082"
}
"static": "02a2d4c346dabd165fd555dfdba4a7f4d18786fe7e055e562397cd5102bdd7f8dd",
"server": {
"address": "139.162.173.101:30082"
}
}
],
"dmsg_discovery": "dmsg://022e607e0914d6e7ccda7587f95790c09e126bbd506cc476a1eda852325aadd1aa:80",
"transport_discovery": "dmsg://02b307aee5c8ce1666c63891f8af25ad2f0a47a243914c963942b3ba35b9d095ae:80",
"address_resolver": "dmsg://03234b2ee4128d1f78c180d06911102906c80795dfe41bd6253f2619c8b6252a02:80",
"route_finder": "dmsg://039d89c5eedfda4a28b0c58b0b643eff949f08e4f68c8357278081d26f5a592d74:80",
"uptime_tracker": "dmsg://022c424caa6239ba7d1d9d8f7dab56cd5ec6ae2ea9ad97bb94ad4b48f62a540d3f:80",
"service_discovery": "dmsg://0204890f9def4f9a5448c2e824c6a4afc85fd1f877322320898fafdf407cc6fef7:80"
}
}
],
"dmsg_discovery": "dmsg://022e607e0914d6e7ccda7587f95790c09e126bbd506cc476a1eda852325aadd1aa:80",
"transport_discovery": "dmsg://02b307aee5c8ce1666c63891f8af25ad2f0a47a243914c963942b3ba35b9d095ae:80",
"address_resolver": "dmsg://03234b2ee4128d1f78c180d06911102906c80795dfe41bd6253f2619c8b6252a02:80",
"route_finder": "dmsg://039d89c5eedfda4a28b0c58b0b643eff949f08e4f68c8357278081d26f5a592d74:80",
"uptime_tracker": "dmsg://022c424caa6239ba7d1d9d8f7dab56cd5ec6ae2ea9ad97bb94ad4b48f62a540d3f:80",
"service_discovery": "dmsg://0204890f9def4f9a5448c2e824c6a4afc85fd1f877322320898fafdf407cc6fef7:80"
}
}
31 changes: 31 additions & 0 deletions scripts/dig-services.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# show IP addresses for the services
jq \
--arg prod_conf "$(dig +short $(echo $(jq -r '.prod.conf' services-config.json) | sed 's|http[s]*://||'))" \
--arg prod_dmsg_discovery "$(dig +short $(echo $(jq -r '.prod.dmsg_discovery' services-config.json) | sed 's|http[s]*://||'))" \
--arg prod_transport_discovery "$(dig +short $(echo $(jq -r '.prod.transport_discovery' services-config.json) | sed 's|http[s]*://||'))" \
--arg prod_address_resolver "$(dig +short $(echo $(jq -r '.prod.address_resolver' services-config.json) | sed 's|http[s]*://||'))" \
--arg prod_route_finder "$(dig +short $(echo $(jq -r '.prod.route_finder' services-config.json) | sed 's|http[s]*://||'))" \
--arg prod_uptime_tracker "$(dig +short $(echo $(jq -r '.prod.uptime_tracker' services-config.json) | sed 's|http[s]*://||'))" \
--arg prod_service_discovery "$(dig +short $(echo $(jq -r '.prod.service_discovery' services-config.json) | sed 's|http[s]*://||'))" \
--arg test_conf "$(dig +short $(echo $(jq -r '.test.conf' services-config.json) | sed 's|http[s]*://||'))" \
--arg test_dmsg_discovery "$(dig +short $(echo $(jq -r '.test.dmsg_discovery' services-config.json) | sed 's|http[s]*://||'))" \
--arg test_transport_discovery "$(dig +short $(echo $(jq -r '.test.transport_discovery' services-config.json) | sed 's|http[s]*://||'))" \
--arg test_address_resolver "$(dig +short $(echo $(jq -r '.test.address_resolver' services-config.json) | sed 's|http[s]*://||'))" \
--arg test_route_finder "$(dig +short $(echo $(jq -r '.test.route_finder' services-config.json) | sed 's|http[s]*://||'))" \
--arg test_uptime_tracker "$(dig +short $(echo $(jq -r '.test.uptime_tracker' services-config.json) | sed 's|http[s]*://||'))" \
--arg test_service_discovery "$(dig +short $(echo $(jq -r '.test.service_discovery' services-config.json) | sed 's|http[s]*://||'))" \
'.prod.conf = $prod_conf |
.prod.dmsg_discovery = $prod_dmsg_discovery |
.prod.transport_discovery = $prod_transport_discovery |
.prod.address_resolver = $prod_address_resolver |
.prod.route_finder = $prod_route_finder |
.prod.uptime_tracker = $prod_uptime_tracker |
.prod.service_discovery = $prod_service_discovery |
.test.conf = $test_conf |
.test.dmsg_discovery = $test_dmsg_discovery |
.test.transport_discovery = $test_transport_discovery |
.test.address_resolver = $test_address_resolver |
.test.route_finder = $test_route_finder |
.test.uptime_tracker = $test_uptime_tracker |
.test.service_discovery = $test_service_discovery' services-config.json
31 changes: 31 additions & 0 deletions scripts/dmsghttp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# update dmsghttp-config.json
jq \
--argjson prod_servers "$(curl -sL $(jq -r '.prod.dmsg_discovery' services-config.json)/dmsg-discovery/all_servers | jq -r 'map({(.static): .server.address}) | add')" \
--argjson test_servers "$(curl -sL $(jq -r '.test.dmsg_discovery' services-config.json)/dmsg-discovery/all_servers | jq -r 'map({(.static): .server.address}) | add')" \
--arg prod_dmsg_discovery "$(curl -sL $(jq -r '.prod.dmsg_discovery' services-config.json)/health | jq -r '.dmsg_address')" \
--arg prod_transport_discovery "$(curl -sL $(jq -r '.prod.transport_discovery' services-config.json)/health | jq -r '.dmsg_address')" \
--arg prod_address_resolver "$(curl -sL $(jq -r '.prod.address_resolver' services-config.json)/health | jq -r '.dmsg_address')" \
--arg prod_route_finder "$(curl -sL $(jq -r '.prod.route_finder' services-config.json)/health | jq -r '.dmsg_address')" \
--arg prod_uptime_tracker "$(curl -sL $(jq -r '.prod.uptime_tracker' services-config.json)/health | jq -r '.dmsg_address')" \
--arg prod_service_discovery "$(curl -sL $(jq -r '.prod.service_discovery' services-config.json)/health | jq -r '.dmsg_address')" \
--arg test_dmsg_discovery "$(curl -sL $(jq -r '.test.dmsg_discovery' services-config.json)/health | jq -r '.dmsg_address')" \
--arg test_transport_discovery "$(curl -sL $(jq -r '.test.transport_discovery' services-config.json)/health | jq -r '.dmsg_address')" \
--arg test_address_resolver "$(curl -sL $(jq -r '.test.address_resolver' services-config.json)/health | jq -r '.dmsg_address')" \
--arg test_route_finder "$(curl -sL $(jq -r '.test.route_finder' services-config.json)/health | jq -r '.dmsg_address')" \
--arg test_uptime_tracker "$(curl -sL $(jq -r '.test.uptime_tracker' services-config.json)/health | jq -r '.dmsg_address')" \
--arg test_service_discovery "$(curl -sL $(jq -r '.test.service_discovery' services-config.json)/health | jq -r '.dmsg_address')" \
'.prod.dmsg_servers |= map(if $prod_servers[.static] then .server.address = $prod_servers[.static] else . end) |
.test.dmsg_servers |= map(if $test_servers[.static] then .server.address = $test_servers[.static] else . end) |
.prod.dmsg_discovery = "dmsg://\($prod_dmsg_discovery)" |
.prod.transport_discovery = "dmsg://\($prod_transport_discovery)" |
.prod.address_resolver = "dmsg://\($prod_address_resolver)" |
.prod.route_finder = "dmsg://\($prod_route_finder)" |
.prod.uptime_tracker = "dmsg://\($prod_uptime_tracker)" |
.prod.service_discovery = "dmsg://\($prod_service_discovery)" |
.test.dmsg_discovery = "dmsg://\($test_dmsg_discovery)" |
.test.transport_discovery = "dmsg://\($test_transport_discovery)" |
.test.address_resolver = "dmsg://\($test_address_resolver)" |
.test.route_finder = "dmsg://\($test_route_finder)" |
.test.uptime_tracker = "dmsg://\($test_uptime_tracker)" |
.test.service_discovery = "dmsg://\($test_service_discovery)"' dmsghttp-config.json
Empty file modified scripts/run-manager-ui.sh
100644 → 100755
Empty file.
5 changes: 5 additions & 0 deletions scripts/services.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# update services-config.json
jq --argjson test "$(curl -sL $(jq -r .test.conf services-config.json))" \
--argjson prod "$(curl -sL $(jq -r .prod.conf services-config.json))" \
'.test += $test | .prod += $prod' services-config.json
Loading

0 comments on commit ee75902

Please sign in to comment.