Compare commits

...

3 Commits

Author SHA1 Message Date
dynco-nym fd92c48e8e Bump package version 2024-10-18 19:23:58 +02:00
dynco-nym 1aa2a9870d Build clients with timeouts 2024-10-18 19:22:21 +02:00
Fran Arbanas e489ca0477 Node status API dockerfile and env vars (#4986)
* feat: add dockerfile and env variables

* Added workflow for pushing node status api on harbor

* Misc changes to pathing and using yq instead of jq

* fix: change the way we read env vars for nyxd, nym api and explorer

* fix: docker build workflow

* Remove config in favor of clap args

* Added naming and tags

* change from value to result

---------

Co-authored-by: Lawrence Stalder <lawrence@nymtech.net>
Co-authored-by: dynco-nym <173912580+dynco-nym@users.noreply.github.com>
2024-10-18 17:14:44 +02:00
11 changed files with 234 additions and 196 deletions
@@ -0,0 +1,55 @@
name: Build and upload Node Status API container to harbor.nymte.ch
on:
workflow_dispatch:
env:
WORKING_DIRECTORY: "nym-node-status-api"
CONTAINER_NAME: "node-status-api"
jobs:
build-container:
runs-on: arc-ubuntu-22.04-dind
steps:
- name: Login to Harbor
uses: docker/login-action@v3
with:
registry: harbor.nymte.ch
username: ${{ secrets.HARBOR_ROBOT_USERNAME }}
password: ${{ secrets.HARBOR_ROBOT_SECRET }}
- name: Checkout repo
uses: actions/checkout@v4
- name: Configure git identity
run: |
git config --global user.email "lawrence@nymtech.net"
git config --global user.name "Lawrence Stalder"
- name: Get version from cargo.toml
uses: mikefarah/yq@v4.44.3
id: get_version
with:
cmd: yq -oy '.package.version' ${{ env.WORKING_DIRECTORY }}/Cargo.toml
- name: Check if tag exists
run: |
if git rev-parse ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }} >/dev/null 2>&1; then
echo "Tag ${{ steps.get_version.outputs.result }} already exists"
fi
- name: Remove existing tag if exists
run: |
if git rev-parse ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }} >/dev/null 2>&1; then
git push --delete origin ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}
git tag -d ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}
fi
- name: Create tag
run: |
git tag -a ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }} -m "Version ${{ steps.get_version.outputs.result }}"
git push origin ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}
- name: BuildAndPushImageOnHarbor
run: |
docker build -f ${{ env.WORKING_DIRECTORY }}/Dockerfile . -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:${{ steps.get_version.outputs.result }} -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:latest
docker push harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }} --all-tags
Generated
+72 -72
View File
@@ -4478,20 +4478,20 @@ dependencies = [
[[package]]
name = "nym-api-requests"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"bs58",
"cosmrs 0.17.0-pre",
"cosmwasm-std",
"ecdsa",
"getset",
"nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-credentials-interface 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-crypto 0.4.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-ecash-time 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-node-requests 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-serde-helpers 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-credentials-interface 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-crypto 0.4.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-ecash-time 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-node-requests 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-serde-helpers 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"schemars",
"serde",
"sha2 0.10.8",
@@ -4619,7 +4619,7 @@ dependencies = [
[[package]]
name = "nym-bin-common"
version = "0.6.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"const-str",
"log",
@@ -4943,11 +4943,11 @@ dependencies = [
[[package]]
name = "nym-coconut-bandwidth-contract-common"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"cosmwasm-schema",
"cosmwasm-std",
"nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
]
[[package]]
@@ -4966,15 +4966,15 @@ dependencies = [
[[package]]
name = "nym-coconut-dkg-common"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"cosmwasm-schema",
"cosmwasm-std",
"cw-utils",
"cw2",
"cw4",
"nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
]
[[package]]
@@ -5003,7 +5003,7 @@ dependencies = [
[[package]]
name = "nym-compact-ecash"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"bincode",
"bls12_381",
@@ -5013,8 +5013,8 @@ dependencies = [
"ff",
"group",
"itertools 0.12.1",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-pemstore 0.3.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-pemstore 0.3.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"rand",
"serde",
"sha2 0.9.9",
@@ -5038,12 +5038,12 @@ dependencies = [
[[package]]
name = "nym-config"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"dirs 5.0.1",
"handlebars",
"log",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"serde",
"toml 0.8.14",
"url",
@@ -5067,7 +5067,7 @@ dependencies = [
[[package]]
name = "nym-contracts-common"
version = "0.5.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"bs58",
"cosmwasm-schema",
@@ -5202,12 +5202,12 @@ dependencies = [
[[package]]
name = "nym-credentials-interface"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"bls12_381",
"nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-ecash-time 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-ecash-time 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"rand",
"serde",
"strum 0.26.3",
@@ -5246,12 +5246,12 @@ dependencies = [
[[package]]
name = "nym-crypto"
version = "0.4.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"bs58",
"ed25519-dalek",
"nym-pemstore 0.3.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-sphinx-types 0.2.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-pemstore 0.3.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-sphinx-types 0.2.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"serde",
"serde_bytes",
"subtle-encoding",
@@ -5324,14 +5324,14 @@ dependencies = [
[[package]]
name = "nym-ecash-contract-common"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"bs58",
"cosmwasm-schema",
"cosmwasm-std",
"cw-controllers",
"cw-utils",
"nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"thiserror",
]
@@ -5355,7 +5355,7 @@ dependencies = [
[[package]]
name = "nym-ecash-time"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"time",
]
@@ -5383,7 +5383,7 @@ dependencies = [
[[package]]
name = "nym-exit-policy"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"serde",
"serde_json",
@@ -5599,7 +5599,7 @@ dependencies = [
[[package]]
name = "nym-group-contract-common"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"cosmwasm-schema",
"cw-controllers",
@@ -5627,11 +5627,11 @@ dependencies = [
[[package]]
name = "nym-http-api-client"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"async-trait",
"http 1.1.0",
"nym-bin-common 0.6.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-bin-common 0.6.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"reqwest 0.12.4",
"serde",
"serde_json",
@@ -5810,7 +5810,7 @@ dependencies = [
[[package]]
name = "nym-mixnet-contract-common"
version = "0.6.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"bs58",
"cosmwasm-schema",
@@ -5818,7 +5818,7 @@ dependencies = [
"cw-controllers",
"humantime-serde",
"log",
"nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"schemars",
"serde",
"serde-json-wasm",
@@ -5920,7 +5920,7 @@ dependencies = [
[[package]]
name = "nym-multisig-contract-common"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"cosmwasm-schema",
"cosmwasm-std",
@@ -5948,7 +5948,7 @@ dependencies = [
[[package]]
name = "nym-network-defaults"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"dotenvy",
"log",
@@ -6143,18 +6143,18 @@ dependencies = [
[[package]]
name = "nym-node-requests"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"async-trait",
"base64 0.22.1",
"celes",
"humantime 2.1.0",
"humantime-serde",
"nym-bin-common 0.6.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-crypto 0.4.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-exit-policy 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-http-api-client 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-wireguard-types 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-bin-common 0.6.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-crypto 0.4.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-exit-policy 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-http-api-client 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-wireguard-types 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"schemars",
"serde",
"serde_json",
@@ -6165,7 +6165,7 @@ dependencies = [
[[package]]
name = "nym-node-status-api"
version = "0.1.0"
version = "0.1.1-client-timeouts"
dependencies = [
"anyhow",
"axum 0.7.7",
@@ -6177,10 +6177,10 @@ dependencies = [
"moka",
"nym-bin-common 0.6.0",
"nym-explorer-client",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-node-requests 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-node-requests 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-task",
"nym-validator-client 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-validator-client 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"reqwest 0.12.4",
"serde",
"serde_json",
@@ -6301,7 +6301,7 @@ dependencies = [
[[package]]
name = "nym-pemstore"
version = "0.3.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"pem",
]
@@ -6374,7 +6374,7 @@ dependencies = [
[[package]]
name = "nym-serde-helpers"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"base64 0.22.1",
"bs58",
@@ -6689,7 +6689,7 @@ dependencies = [
[[package]]
name = "nym-sphinx-types"
version = "0.2.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"sphinx-packet",
"thiserror",
@@ -6843,7 +6843,7 @@ dependencies = [
[[package]]
name = "nym-validator-client"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"async-trait",
"base64 0.22.1",
@@ -6861,20 +6861,19 @@ dependencies = [
"flate2",
"futures",
"itertools 0.13.0",
"log",
"nym-api-requests 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-coconut-bandwidth-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-coconut-dkg-common 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-config 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-ecash-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-group-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-http-api-client 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-vesting-contract-common 0.7.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-api-requests 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-coconut-bandwidth-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-coconut-dkg-common 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-config 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-ecash-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-group-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-http-api-client 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-vesting-contract-common 0.7.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"prost 0.12.6",
"reqwest 0.12.4",
"serde",
@@ -6884,6 +6883,7 @@ dependencies = [
"thiserror",
"time",
"tokio",
"tracing",
"url",
"wasmtimer",
"zeroize",
@@ -6943,12 +6943,12 @@ dependencies = [
[[package]]
name = "nym-vesting-contract-common"
version = "0.7.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"cosmwasm-schema",
"cosmwasm-std",
"nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"serde",
"thiserror",
]
@@ -7015,12 +7015,12 @@ dependencies = [
[[package]]
name = "nym-wireguard-types"
version = "0.1.0"
source = "git+https://github.com/nymtech/nym?rev=f86e08866#f86e0886631a98b0638fe09e6fcbe5458d47adc1"
source = "git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd#6f028b9d58d27b19880b43c5a15db9f1b1939fbd"
dependencies = [
"base64 0.22.1",
"log",
"nym-config 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=f86e08866)",
"nym-config 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?rev=6f028b9d58d27b19880b43c5a15db9f1b1939fbd)",
"serde",
"thiserror",
"x25519-dalek",
+3 -3
View File
@@ -21,8 +21,8 @@ COCONUT_DKG_CONTRACT_ADDRESS=n19604yflqggs9mk2z26mqygq43q2kr3n932egxx630svywd5mp
REWARDING_VALIDATOR_ADDRESS=n10yyd98e2tuwu0f7ypz9dy3hhjw7v772q6287gy
STATISTICS_SERVICE_DOMAIN_ADDRESS="https://mainnet-stats.nymte.ch:8090"
NYXD="https://rpc.nymtech.net"
NYM_API="https://validator.nymtech.net/api/"
NYXD=https://rpc.nymtech.net
NYM_API=https://validator.nymtech.net/api/
NYXD_WS="wss://rpc.nymtech.net/websocket"
EXPLORER_API="https://explorer.nymtech.net/api/"
EXPLORER_API=https://explorer.nymtech.net/api/
NYM_VPN_API="https://nymvpn.com/api"
+13 -8
View File
@@ -3,7 +3,7 @@
[package]
name = "nym-node-status-api"
version = "0.1.0"
version = "0.1.1-client-timeouts"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
@@ -16,20 +16,20 @@ rust-version.workspace = true
anyhow = { workspace = true }
axum = { workspace = true, features = ["tokio"] }
chrono = { workspace = true }
clap = { workspace = true, features = ["cargo", "derive"] }
clap = { workspace = true, features = ["cargo", "derive", "env", "string"] }
cosmwasm-std = { workspace = true }
envy = { workspace = true }
futures-util = { workspace = true }
moka = { workspace = true, features = ["future"] }
nym-bin-common = { path = "../common/bin-common" }
nym-explorer-client = { path = "../explorer-api/explorer-client" }
# TODO dz: ref before Nym API client changes. Update to latest develop once new Nym API is live
nym-network-defaults = { git = "https://github.com/nymtech/nym", rev = "f86e08866" }
nym-validator-client = { git = "https://github.com/nymtech/nym", rev = "f86e08866" }
# TODO dz: branch `pre-dir-v2-fork`: before Nym API client breaking changes. Update to latest develop once new Nym API is live
nym-network-defaults = { git = "https://github.com/nymtech/nym", rev = "6f028b9d58d27b19880b43c5a15db9f1b1939fbd" }
nym-validator-client = { git = "https://github.com/nymtech/nym", rev = "6f028b9d58d27b19880b43c5a15db9f1b1939fbd" }
# nym-network-defaults = { path = "../common/network-defaults" }
# nym-validator-client = { path = "../common/client-libs/validator-client" }
nym-task = { path = "../common/task" }
nym-node-requests = { git = "https://github.com/nymtech/nym", rev = "f86e08866" }
nym-node-requests = { git = "https://github.com/nymtech/nym", rev = "6f028b9d58d27b19880b43c5a15db9f1b1939fbd" }
# nym-node-requests = { path = "../nym-node/nym-node-requests", features = ["openapi"] }
reqwest = { workspace = true }
serde = { workspace = true, features = ["derive"] }
@@ -53,5 +53,10 @@ utoipauto = { workspace = true }
[build-dependencies]
anyhow = { workspace = true }
tokio = { workspace = true, features = ["macros" ] }
sqlx = { workspace = true, features = ["runtime-tokio-rustls", "sqlite", "macros", "migrate"] }
tokio = { workspace = true, features = ["macros"] }
sqlx = { workspace = true, features = [
"runtime-tokio-rustls",
"sqlite",
"macros",
"migrate",
] }
+15
View File
@@ -0,0 +1,15 @@
FROM rust:latest AS builder
COPY ./ /usr/src/nym
WORKDIR /usr/src/nym/nym-node-status-api
RUN cargo build --release
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y ca-certificates
WORKDIR /nym
COPY --from=builder /usr/src/nym/target/release/nym-node-status-api ./
ENTRYPOINT [ "/nym/nym-node-status-api" ]
+11 -3
View File
@@ -4,7 +4,15 @@ set -e
export RUST_LOG=${RUST_LOG:-debug}
export NYM_API_CLIENT_TIMEOUT=60;
export EXPLORER_CLIENT_TIMEOUT=60;
export NYM_API_CLIENT_TIMEOUT=60
export EXPLORER_CLIENT_TIMEOUT=60
#export NYXD=https://rpc.nymtech.net
#export NYM_API=https://validator.nymtech.net/api/
#export EXPLORER_API=https://explorer.nymtech.net/api/
#export NETWORK_NAME=mainnet
cargo run --package nym-node-status-api --release -- --config-env-file ../envs/mainnet.env
#cargo run --package nym-node-status-api --release -- --connection-url "sqlite://node-status-api.sqlite?mode=rwc"
cd ..
docker build -t node-status-api -f nym-node-status-api/Dockerfile .
docker run --env-file envs/mainnet.env -e NYM_NODE_STATUS_API_CONNECTION_URL="sqlite://node-status-api.sqlite?mode=rwc" node-status-api
+49 -5
View File
@@ -1,6 +1,7 @@
use clap::Parser;
use nym_bin_common::bin_info;
use std::sync::OnceLock;
use reqwest::Url;
use std::{sync::OnceLock, time::Duration};
// Helper for passing LONG_VERSION to clap
fn pretty_build_info_static() -> &'static str {
@@ -8,10 +9,53 @@ fn pretty_build_info_static() -> &'static str {
PRETTY_BUILD_INFORMATION.get_or_init(|| bin_info!().pretty_print())
}
#[derive(Parser, Debug)]
#[derive(Clone, Debug, Parser)]
#[clap(author = "Nymtech", version, long_version = pretty_build_info_static(), about)]
pub(crate) struct Cli {
/// Path pointing to an env file that configures the Nym API.
#[clap(short, long)]
pub(crate) config_env_file: Option<std::path::PathBuf>,
/// Network name for the network to which we're connecting.
#[clap(long, env = "NETWORK_NAME")]
pub(crate) network_name: String,
/// Explorer api url.
#[clap(short, long, env = "EXPLORER_API")]
pub(crate) explorer_api: String,
/// Nym api url.
#[clap(short, long, env = "NYM_API")]
pub(crate) nym_api: String,
/// TTL for the http cache.
#[clap(
long,
default_value_t = 30,
env = "NYM_NODE_STATUS_API_NYM_HTTP_CACHE_TTL"
)]
pub(crate) nym_http_cache_ttl: u64,
/// HTTP port on which to run node status api.
#[clap(long, default_value_t = 8000, env = "NYM_NODE_STATUS_API_HTTP_PORT")]
pub(crate) http_port: u16,
/// Nyxd address.
#[clap(long, env = "NYXD")]
pub(crate) nyxd_addr: Url,
/// Nym api client timeout.
#[clap(long, default_value = "15", env = "NYM_API_CLIENT_TIMEOUT")]
#[arg(value_parser = parse_duration)]
pub(crate) nym_api_client_timeout: Duration,
/// Explorer api client timeout.
#[clap(long, default_value = "15", env = "EXPLORER_CLIENT_TIMEOUT")]
#[arg(value_parser = parse_duration)]
pub(crate) explorer_client_timeout: Duration,
/// Connection url for the database.
#[clap(long, env = "NYM_NODE_STATUS_API_CONNECTION_URL")]
pub(crate) connection_url: String,
}
fn parse_duration(arg: &str) -> Result<std::time::Duration, std::num::ParseIntError> {
let seconds = arg.parse()?;
Ok(std::time::Duration::from_secs(seconds))
}
-72
View File
@@ -1,72 +0,0 @@
use anyhow::anyhow;
use reqwest::Url;
use serde::Deserialize;
use std::time::Duration;
#[derive(Debug, Clone, Deserialize)]
pub(crate) struct Config {
#[serde(default = "Config::default_http_cache_seconds")]
nym_http_cache_ttl: u64,
#[serde(default = "Config::default_http_port")]
http_port: u16,
#[serde(rename = "nyxd")]
nyxd_addr: Url,
#[serde(default = "Config::default_client_timeout")]
#[serde(deserialize_with = "parse_duration")]
explorer_client_timeout: Duration,
}
impl Config {
pub(crate) fn from_env() -> anyhow::Result<Self> {
envy::from_env::<Self>().map_err(|e| {
tracing::error!("Failed to load config from env: {e}");
anyhow::Error::from(e)
})
}
fn default_client_timeout() -> Duration {
Duration::from_secs(15)
}
fn default_http_port() -> u16 {
8000
}
fn default_http_cache_seconds() -> u64 {
30
}
pub(crate) fn nym_http_cache_ttl(&self) -> u64 {
self.nym_http_cache_ttl
}
pub(crate) fn http_port(&self) -> u16 {
self.http_port
}
pub(crate) fn nyxd_addr(&self) -> &Url {
&self.nyxd_addr
}
pub(crate) fn nym_explorer_client_timeout(&self) -> Duration {
self.explorer_client_timeout.to_owned()
}
}
fn parse_duration<'de, D>(deserializer: D) -> Result<Duration, D::Error>
where
D: serde::Deserializer<'de>,
{
let s: String = Deserialize::deserialize(deserializer)?;
let secs: u64 = s.parse().map_err(serde::de::Error::custom)?;
Ok(Duration::from_secs(secs))
}
pub(super) fn read_env_var(env_var: &str) -> anyhow::Result<String> {
std::env::var(env_var)
.map_err(|_| anyhow!("You need to set {}", env_var))
.map(|value| {
tracing::trace!("{}={}", env_var, value);
value
})
}
+1 -4
View File
@@ -1,13 +1,11 @@
use std::str::FromStr;
use crate::read_env_var;
use anyhow::{anyhow, Result};
use sqlx::{migrate::Migrator, sqlite::SqliteConnectOptions, ConnectOptions, SqlitePool};
pub(crate) mod models;
pub(crate) mod queries;
pub(crate) const DATABASE_URL_ENV_VAR: &str = "DATABASE_URL";
static MIGRATOR: Migrator = sqlx::migrate!("./migrations");
pub(crate) type DbPool = SqlitePool;
@@ -17,8 +15,7 @@ pub(crate) struct Storage {
}
impl Storage {
pub async fn init() -> Result<Self> {
let connection_url = read_env_var(DATABASE_URL_ENV_VAR)?;
pub async fn init(connection_url: String) -> Result<Self> {
let connect_options = {
let connect_options = SqliteConnectOptions::from_str(&connection_url)?;
let mut connect_options = connect_options.create_if_missing(true);
+8 -18
View File
@@ -1,11 +1,7 @@
use clap::Parser;
use nym_network_defaults::setup_env;
use nym_task::signal::wait_for_signal;
use crate::config::read_env_var;
mod cli;
mod config;
mod db;
mod http;
mod logging;
@@ -16,33 +12,27 @@ async fn main() -> anyhow::Result<()> {
logging::setup_tracing_logger();
let args = cli::Cli::parse();
// if dotenv file is present, load its values
// otherwise, default to mainnet
setup_env(args.config_env_file.as_ref());
tracing::debug!("{:?}", read_env_var("NETWORK_NAME"));
tracing::debug!("{:?}", read_env_var("EXPLORER_API"));
tracing::debug!("{:?}", read_env_var("NYM_API"));
let conf = config::Config::from_env()?;
tracing::debug!("Using config:\n{:#?}", conf);
let connection_url = args.connection_url.clone();
tracing::debug!("Using config:\n{:#?}", args);
let storage = db::Storage::init().await?;
let storage = db::Storage::init(connection_url).await?;
let db_pool = storage.pool_owned().await;
let conf_clone = conf.clone();
let args_clone = args.clone();
tokio::spawn(async move {
monitor::spawn_in_background(db_pool, conf_clone).await;
monitor::spawn_in_background(db_pool, args_clone).await;
});
tracing::info!("Started monitor task");
let shutdown_handles = http::server::start_http_api(
storage.pool_owned().await,
conf.http_port(),
conf.nym_http_cache_ttl(),
args.http_port,
args.nym_http_cache_ttl,
)
.await
.expect("Failed to start server");
tracing::info!("Started HTTP server on port {}", conf.http_port());
tracing::info!("Started HTTP server on port {}", args.http_port);
wait_for_signal().await;
+7 -11
View File
@@ -1,4 +1,4 @@
use crate::config::Config;
use crate::cli::Cli;
use crate::db::models::{
gateway, mixnode, GatewayRecord, MixnodeRecord, NetworkSummary, GATEWAYS_BLACKLISTED_COUNT,
GATEWAYS_BONDED_COUNT, GATEWAYS_EXPLORER_COUNT, GATEWAYS_HISTORICAL_COUNT,
@@ -29,7 +29,7 @@ static DELEGATION_PROGRAM_WALLET: &str = "n1rnxpdpx3kldygsklfft0gech7fhfcux4zst5
// TODO dz: query many NYM APIs:
// multiple instances running directory cache, ask sachin
pub(crate) async fn spawn_in_background(db_pool: DbPool, config: Config) -> JoinHandle<()> {
pub(crate) async fn spawn_in_background(db_pool: DbPool, config: Cli) -> JoinHandle<()> {
let network_defaults = nym_network_defaults::NymNetworkDetails::new_from_env();
loop {
@@ -54,7 +54,7 @@ pub(crate) async fn spawn_in_background(db_pool: DbPool, config: Config) -> Join
async fn run(
pool: &DbPool,
network_details: &NymNetworkDetails,
config: &Config,
config: &Cli,
) -> anyhow::Result<()> {
let default_api_url = network_details
.endpoints
@@ -70,19 +70,15 @@ async fn run(
let default_explorer_url =
default_explorer_url.expect("explorer url missing in network config");
let explorer_client = ExplorerClient::new_with_timeout(
default_explorer_url,
config.nym_explorer_client_timeout(),
)?;
let explorer_client =
ExplorerClient::new_with_timeout(default_explorer_url, config.explorer_client_timeout)?;
let explorer_gateways = explorer_client
.get_gateways()
.await
.log_error("get_gateways")?;
tracing::debug!("6");
let api_client =
// TODO dz introduce timeout ?
NymApiClient::new(default_api_url);
let api_client = NymApiClient::new_with_timeout(default_api_url, config.nym_api_client_timeout);
let gateways = api_client
.get_cached_described_gateways()
.await
@@ -126,7 +122,7 @@ async fn run(
.await
.log_error("get_active_mixnodes")?;
let delegation_program_members =
get_delegation_program_details(network_details, config.nyxd_addr()).await?;
get_delegation_program_details(network_details, &config.nyxd_addr).await?;
// keep stats for later
let count_bonded_mixnodes = mixnodes.len();