-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v0.43.0' of github.com:nymtech/nyxd into test/0…
….51.0
- Loading branch information
Showing
3 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Build and upload Nyxd rpcnode container to harbor.nymte.ch | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
type: string | ||
description: Which version of nyxd-rpcnode is this? | ||
|
||
env: | ||
WORKING_DIRECTORY: "docker/rpcnode" | ||
CONTAINER_NAME: "nyxd-rpcnode" | ||
|
||
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 "[email protected]" | ||
git config --global user.name "Lawrence Stalder" | ||
- name: Remove existing tag if exists | ||
run: | | ||
if git rev-parse ${{ env.CONTAINER_NAME }}-${{ github.event.inputs.version }} >/dev/null 2>&1; then | ||
git push --delete origin ${{ env.CONTAINER_NAME }}-${{ github.event.inputs.version }} | ||
git tag -d ${{ env.CONTAINER_NAME }}-${{ github.event.inputs.version }} | ||
fi | ||
- name: Create tag | ||
run: | | ||
git tag -a ${{ env.CONTAINER_NAME }}-${{ github.event.inputs.version }} -m "Version ${{ github.event.inputs.version }}" | ||
git push origin ${{ env.CONTAINER_NAME }}-${{ github.event.inputs.version }} | ||
- name: BuildAndPushImageOnHarbor | ||
run: | | ||
docker build -f ${{ env.WORKING_DIRECTORY }}/Dockerfile ${{ env.WORKING_DIRECTORY }} -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:${{ github.event.inputs.version }} -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:latest | ||
docker push harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }} --all-tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM --platform=linux/amd64 ubuntu:24.04 | ||
|
||
ARG UID=1001 | ||
ARG GID=1001 | ||
ARG NYM_CLI_GIT_TAG=master | ||
ARG WASMD_VERSION=v0.43.0 | ||
ARG RETAIN_BLOCKS | ||
|
||
#################################### | ||
# Necessary env variables: | ||
# CHAIN_ID | ||
# DENOM | ||
# STAKE_DENOM | ||
# VALIDATOR_ENDPOINT | ||
# PEERS | ||
#################################### | ||
|
||
RUN apt update && apt upgrade -y \ | ||
&& apt -y install ca-certificates jq curl vim wget | ||
|
||
# Set up a nym user | ||
RUN groupadd -g "${GID}" nym \ | ||
&& useradd --create-home --no-log-init -u "${UID}" -g "${GID}" nym | ||
|
||
WORKDIR /home/nym | ||
|
||
# Download nyxd, libwasmvm and nym-cli from our Github releases | ||
RUN wget https://builds.ci.nymte.ch/${NYM_CLI_GIT_TAG}/nym-cli | ||
RUN wget https://github.com/nymtech/nyxd/releases/download/${WASMD_VERSION}/nyxd-ubuntu-22.04.tar.gz | ||
RUN tar -zxvf nyxd-ubuntu-22.04.tar.gz | ||
|
||
RUN chmod u+x nyxd | ||
RUN chmod u+x nym-cli | ||
RUN chmod u+x libwasmvm.x86_64.so | ||
|
||
# libwasmvm.so needs to be in this directory to be automatically recognized when running nyxd. Alternative is to update env variables. | ||
RUN mv libwasmvm*.so /lib/x86_64-linux-gnu/ | ||
|
||
# Ubuntu 22.04 uses libssl3 instead of 1.1 that nym-cli is built with. This is a quick fix for that so that we don't need to recompile it. | ||
RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb | ||
RUN ls | grep *.deb | ||
RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb | ||
|
||
RUN mkdir ".nyxd" | ||
RUN mkdir output | ||
RUN chown -R nym:nym ./ | ||
|
||
VOLUME /home/nym/.nyxd | ||
VOLUME /home/nym/output | ||
|
||
COPY start.sh . | ||
RUN chmod +x *.sh | ||
|
||
USER nym | ||
|
||
ENTRYPOINT ["./start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":/home/nym | ||
APP_NAME=nyxd | ||
VALIDATOR_DATA_DIRECTORY="/home/nym/.${APP_NAME}" | ||
EXPOSED_PORT=${EXPOSED_PORT:-26656} | ||
|
||
function initialise_validator() { | ||
# initialise the validator | ||
./${APP_NAME} init "${CHAIN_ID}" --chain-id "${CHAIN_ID}" --default-denom ${STAKE_DENOM} | ||
|
||
sleep 2 | ||
|
||
echo "changing params" | ||
sed -i 's/minimum-gas-prices = "0stake"/minimum-gas-prices = "0.025'${STAKE_DENOM}',0.025'${DENOM}'"/' "${VALIDATOR_DATA_DIRECTORY}/config/app.toml" | ||
sed -i '0,/enable = false/s//enable = true/' "${VALIDATOR_DATA_DIRECTORY}/config/app.toml" | ||
|
||
# Network requests | ||
sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["*"\]/' "${VALIDATOR_DATA_DIRECTORY}/config/config.toml" | ||
sed -i 's/laddr = "tcp:\/\/127.0.0.1:26657"/laddr = "tcp:\/\/0.0.0.0:26657"/' "${VALIDATOR_DATA_DIRECTORY}/config/config.toml" | ||
sed -i 's/26656/'${EXPOSED_PORT}'/' "${VALIDATOR_DATA_DIRECTORY}/config/config.toml" | ||
sed -i 's#external_address = ""#external_address = "'${RPC_FQDN}':'${EXPOSED_PORT}'"#' "${VALIDATOR_DATA_DIRECTORY}/config/config.toml" | ||
sed -i 's/address = "tcp:\/\/localhost:1317"/address = "tcp:\/\/0.0.0.0:1317"/' "${VALIDATOR_DATA_DIRECTORY}/config/app.toml" | ||
|
||
# Set pruning settings | ||
sed -i 's/pruning = "default"/pruning = "custom"/' "${HOME}/.nyxd/config/config.toml" | ||
sed -i 's/pruning-keep-recent = "0"/pruning-keep-recent = "750000"/' "${HOME}/.nyxd/config/config.toml" | ||
sed -i 's/pruning-interval = "0"/pruning-interval = "100"/' "${HOME}/.nyxd/config/config.toml" | ||
|
||
echo "params changed" | ||
|
||
# statesync so we don't catch up from the start | ||
SNAP_RPC="${VALIDATOR_ENDPOINT}:443" | ||
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height) | ||
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000)) | ||
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) | ||
|
||
sed -i "s|^persistent_peers =.*|persistent_peers = \"$PEERS\"|" "${HOME}/.nyxd/config/config.toml" | ||
sed -i 's/^enable = false/enable = true/' "${HOME}/.nyxd/config/config.toml" | ||
sed -i "s|^rpc_servers =.*|rpc_servers = \"$SNAP_RPC,$SNAP_RPC\"|" "${HOME}/.nyxd/config/config.toml" | ||
sed -i "s|^trust_height =.*|trust_height = $BLOCK_HEIGHT|" "${HOME}/.nyxd/config/config.toml" | ||
sed -i "s|^trust_hash =.*|trust_hash = \"$TRUST_HASH\"|" "${HOME}/.nyxd/config/config.toml" | ||
} | ||
|
||
if [[ ! -f "$VALIDATOR_DATA_DIRECTORY/config/genesis.json" ]]; then | ||
initialise_validator | ||
fi | ||
|
||
./${APP_NAME} start |