Skip to content

Commit

Permalink
Revised mithril relay lb with timeouts (#49)
Browse files Browse the repository at this point in the history
* Add PSB to mainnet topology.json (cardano-community#1799)

## Description
Adding my Edmonton datacentre relay.

* Fix version on setup-grest

* [mithril-client.sh] Use the DB_DIR instead of CNODE_HOME/db (cardano-community#1800)

Updates mithril.library to use env DB_DIR value instead of CNODE_HOME/db
when creating the mithril.env, and mithril-client.sh to use the
DB_DIRECTORY value from the mithril.env file per upstream mithril
documentation.

* [documentation] Fix typo showing guild-deploy.sh -p using full path to CNODE_HOME instead of parent directory (cardano-community#1801)

Reported in Telegram by @jorgepascoal (https://t.me/jorgepascoal)


>Hi Guys, I don't know if anybody else had the same issue I had when
upgrading to 9.1.0.
>
>After running the upgrade following the guide at
https://cardano-community.github.io/guild-operators/upgrade/ I found
that the script run with this line ./guild-deploy.sh -s dl -b master -n
mainnet -t cnode -p /opt/cardano/cnode the original cnode folder was not
replaced with the new scripts and files. Instead a new cnode folder was
created under /opt/cardano/cnode to /opt/cardano/cnode/cnode!
>
>Easy quick fix to get the new node running when moving them to the
correct location and path. Just thought I'd mention it because I
couldn't see that I did path settings incorrectly on my side. Maybe a
typo in the guild-deploy.sh script?

* squid config ask for additional allows, nginx mithril relay lb use stream, proxy_connect_timeout 10, max_fails=1 and fail_timeout 10 seconds per relay

* Enhanced verify_signer_registered

* MITHRIL_HOME to allow custom paths outside of CNODE_HOME

* Refactor mithril functions into mithril library.

* Use status code greater than 200

* Provide a way to support checking compatible version of mithril and node binaries.

* fixup! Provide a way to support checking compatible version of mithril and node binaries.

---------

Co-authored-by: Boris P. <[email protected]>
Co-authored-by: rdlrt <[email protected]>
  • Loading branch information
3 people authored Aug 7, 2024
1 parent 1081029 commit bfbe614
Show file tree
Hide file tree
Showing 11 changed files with 904 additions and 696 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/mithril-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
get-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
fetch-depth: 0
Expand All @@ -18,13 +18,18 @@ jobs:
- name: Assigns release version
run: |
VERSION=$(cat ./files/docker/node/release-versions/mithril-latest.txt)
- name: Source mithril.library and check upgrade safety
id: safety-check
run: |
. scripts/cnode-helper-scripts/mithril.library offline
check_mithril_upgrade_safe
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")
- name: Commit latest release version
if: steps.git-check.outputs.modified == 'true'
if: steps.git-check.outputs.modified == 'true' && steps.safety-check.outcome == 'success'
run: |
git config --global user.name ${{ secrets.REPO_SCOPED_USER }}
git config --global user.email ${{ secrets.REPO_SCOPED_EMAIL }}
git commit -am "New mithril release version ${VERSION}"
git push
git push
4 changes: 2 additions & 2 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
``` bash
mkdir "$HOME/tmp";cd "$HOME/tmp"
curl -sfS -o guild-deploy.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/guild-deploy.sh && chmod 700 guild-deploy.sh
./guild-deploy.sh -s dl -b master -n mainnet -t cnode -p /opt/cardano/cnode
./guild-deploy.sh -s dl -b master -n mainnet -t cnode -p /opt/cardano
```

- Another scenario would be when you're required to overwrite configs (eg: node-8.1.2 to node-9.1.0 introduced change in genesis/config/topology file formats). In this case, you'd want to overwrite your config files as well. You should follow changelog in node release notes to verify if you'd need to overwrite configs. Note that every time you do this, you may need to re-add your customisations - if any - to the relevant config files (typically - almost always, you'd have to update the topology.json when overwriting configs). There are backups created of original file in `"${CNODE_HOME}"/files` folder if you'd like to compare/reuse previous version.
``` bash
mkdir "$HOME/tmp";cd "$HOME/tmp"
curl -sfS -o guild-deploy.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/guild-deploy.sh && chmod 700 guild-deploy.sh
./guild-deploy.sh -s dlf -b master -n mainnet -t cnode -p /opt/cardano/cnode
./guild-deploy.sh -s dlf -b master -n mainnet -t cnode -p /opt/cardano
```
!!! warning "Beware"
Expand Down
3 changes: 2 additions & 1 deletion files/configs/mainnet/topology.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
{
"accessPoints": [
{"address": "208.118.69.126", "port": 3003, "pool": "PSB", "location": "NA/CA/Edmonton" },
{"address": "node-dus.poolunder.com", "port": 6900, "pool": "UNDR", "location": "EU/DE/Dusseldorf" },
{"address": "node-syd.poolunder.com", "port": 6900, "pool": "UNDR", "location": "OC/AU/Sydney" },
{"address": "194.36.145.157", "port": 6000, "pool": "RDLRT", "location": "EU/DE/Baden" },
Expand All @@ -39,7 +40,7 @@
"advertise": false,
"trustable": false,
"hotValency": 5,
"warmValency": 10
"warmValency": 11
}
],
"publicRoots": [
Expand Down
2 changes: 2 additions & 0 deletions scripts/cnode-helper-scripts/env
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
#CIP0094_POLL_URL="https://raw.githubusercontent.com/cardano-foundation/CIP-0094-polls/main/networks/polls.json" # URL for polls to vote against

#MITHRIL_DOWNLOAD="N" # (Y|N) Download latest Mithril snapshot
#MITHRIL_HOME="${CNODE_HOME}/mithril" # Override default Mithril path
#MITHRIL_SIGNER_ENABLED="N" # (Y|N) Enable the gLiveView Mithril Signer Section

#STRICT_VERSION_CHECK="Y" # (Y|N) Restrict operation to supported major.minor version leaving patch version open. If disabled, any version will be accepted (unsupported)
Expand Down Expand Up @@ -950,6 +951,7 @@ set_default_vars() {
[[ -z ${ASSET_POLICY_ID_FILENAME} ]] && ASSET_POLICY_ID_FILENAME="policy.id"
[[ -z ${CIP0094_POLL_URL} ]] && CIP0094_POLL_URL="https://raw.githubusercontent.com/cardano-foundation/CIP-0094-polls/main/networks/polls.json"
[[ -z ${MITHRIL_DOWNLOAD} ]] && MITHRIL_DOWNLOAD="N"
[[ -z ${MITHRIL_HOME} ]] && MITHRIL_HOME="${CNODE_HOME}/mithril"
[[ -z ${MITHRIL_SIGNER_ENABLED} ]] && MITHRIL_SIGNER_ENABLED="N"
[[ -z ${STRICT_VERSION_CHECK} ]] && STRICT_VERSION_CHECK="Y"
FG_BLACK='\e[30m'
Expand Down
4 changes: 2 additions & 2 deletions scripts/cnode-helper-scripts/gLiveView.sh
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,8 @@ unset cpu_now cpu_last

mithrilSignerVars() {
# mithril.env sourcing needed to have values in ${METRICS_SERVER_IP} and ${METRICS_SERVER_PORT}
. ${CNODE_HOME}/mithril/mithril.env
signerMetricsEnabled=$(grep -q "ENABLE_METRICS_SERVER=true" ${CNODE_HOME}/mithril/mithril.env && echo "true" || echo "false")
. ${MITHRIL_HOME}/mithril.env
signerMetricsEnabled=$(grep -q "ENABLE_METRICS_SERVER=true" ${MITHRIL_HOME}/mithril.env && echo "true" || echo "false")
if [[ "${signerMetricsEnabled}" == "true" ]] ; then
mithrilSignerMetrics=$(curl -s "http://${METRICS_SERVER_IP}:${METRICS_SERVER_PORT}/metrics" 2>/dev/null | grep -v -E "HELP|TYPE" | sed 's/mithril_signer_//g')
SIGNER_METRICS_HTTP_RESPONSE=$(curl --write-out "%{http_code}" --silent --output /dev/null --connect-timeout 2 http://${METRICS_SERVER_IP}:${METRICS_SERVER_PORT}/metrics)
Expand Down
2 changes: 1 addition & 1 deletion scripts/cnode-helper-scripts/guild-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ setup_folder() {
echo -e "\nexport ${CNODE_VNAME}_HOME=${CNODE_HOME}" >> "${HOME}"/.bashrc
fi

$sudo mkdir -p "${CNODE_HOME}"/files "${CNODE_HOME}"/db "${CNODE_HOME}"/guild-db "${CNODE_HOME}"/logs "${CNODE_HOME}"/scripts "${CNODE_HOME}"/scripts/archive "${CNODE_HOME}"/sockets "${CNODE_HOME}"/priv "${CNODE_HOME}"/mithril/data-stores
$sudo mkdir -p "${CNODE_HOME}"/files "${CNODE_HOME}"/db "${CNODE_HOME}"/guild-db "${CNODE_HOME}"/logs "${CNODE_HOME}"/scripts "${CNODE_HOME}"/scripts/archive "${CNODE_HOME}"/sockets "${CNODE_HOME}"/priv "${MITHRIL_HOME}"/data-stores
$sudo chown -R "$U_ID":"$G_ID" "${CNODE_HOME}" 2>/dev/null

}
Expand Down
Loading

0 comments on commit bfbe614

Please sign in to comment.