-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1f98432
Showing
7 changed files
with
826 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,49 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# GitHub recommends pinning actions to a commit SHA. | ||
# To get a newer version, you will need to update the SHA. | ||
# You can also reference a tag or branch, but the action may change without warning. | ||
|
||
name: Publish Docker image | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
push_to_registries: | ||
name: Push Docker image to registry | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository }} | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
build-args: | | ||
BASE_ALGORAND_IMAGE=${{ github.event.release.tag_name }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,18 @@ | ||
ARG BASE_ALGORAND_VERSION=3.20.1 | ||
FROM algorand/algod:$BASE_ALGORAND_VERSION-stable | ||
LABEL "network.voi"="Voi Network" | ||
LABEL version=$BASE_ALGORAND_VERSION | ||
|
||
ENV NETWORK=voitest \ | ||
GENESIS_ADDRESS=https://testnet-api.voi.nodly.io \ | ||
TELEMETRY_NAME="${HOSTNAME}" \ | ||
## Mimics the behavior of Algorand's fast catchup variable, though they are less aggressive in catchup up when invoking `goal node catchup` | ||
VOI_FAST_CATCHUP=1 | ||
|
||
COPY ./config.json /etc/algorand/config.json | ||
COPY ./start.sh /node/run/start.sh | ||
COPY ./voi-startup.sh /node/run/voi-catchup.sh | ||
|
||
RUN apt-get update && apt-get dist-upgrade -y && apt install -y jq bc curl | ||
|
||
CMD "/node/run/start.sh" |
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
# Voi Network Participation Node Docker image | ||
|
||
This repository contains a Dockerfile for building a Voi Network participation node Docker image. | ||
The image contains no key material, and is intended to be used with a participation key injected at runtime. | ||
|
||
## Building the image | ||
|
||
The image can be built using the following command: | ||
|
||
```bash | ||
docker build . | ||
``` | ||
|
||
To provide an Algorand version to use as base image, use the `BASE_ALGORAND_VERSION` build argument: | ||
```bash | ||
docker build --build-arg="BASE_ALGORAND_VERSION=3.20.1" . | ||
``` | ||
|
||
The `BASE_ALGORAND_VERSION` argument is used to specify the version of the Algorand image to use as base image. | ||
Defaults to `3.20.1`. | ||
|
||
## Running the image | ||
|
||
```bash | ||
docker run <image_tag> | ||
``` | ||
|
||
By default the image will listen on port 8080 for incoming connections. To run the image with the REST API exposed on | ||
local port 8080 execute: | ||
```bash | ||
docker run -p 8080:8080 <image_tag> | ||
``` | ||
|
||
## Container registry | ||
Images will be published via GitHub Actions packaged releases and will be available at the following location: | ||
|
||
```bash | ||
docker pull ghcr.io/voinetwork/docker-participation-node:latest | ||
``` | ||
|
||
Versioned images will be available by replacing `latest` with the desired version number. | ||
```bash: | ||
docker pull ghcr.io/voinetwork/docker-participation-node:3.20.1 | ||
``` | ||
|
||
## Creating a release | ||
To create a release and publish the image to the container registry, create a new release in GitHub and tag it with the | ||
version number of the Algorand image to use as base image. The GitHub Action will then build and publish the image to | ||
registry. | ||
|
||
## Notes | ||
|
||
* Mount points inside the image are using the default Algorand mount points, which can be overridden for persistent claims. | ||
* The image versioning is aligned with the official Algorand release versions. | ||
* Catchup via the environment variable VOI_FAST_CATCHUP is set to true by default. | ||
* This variable mimics the behavior from the Algorand image, but will result in faster catchup (as more aggressive). |
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,7 @@ | ||
{ | ||
"EndpointAddress": "0.0.0.0:8080", | ||
"DNSBootstrapID": "<network>.voi.network", | ||
"EnableCatchupFromArchiveServers": true, | ||
"BaseLoggerDebugLevel": 4, | ||
"FallbackDNSResolverAddress": "1.1.1.1" | ||
} |
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,5 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
/node/run/run.sh & | ||
/node/run/voi-catchup.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,30 @@ | ||
#!/bin/bash | ||
|
||
while ! goal node status | ||
do | ||
sleep 5 | ||
echo "Waiting for Algod" | ||
done | ||
|
||
## Catchup | ||
if [ "$VOI_FAST_CATCHUP" = '1' ]; then | ||
echo "fast catchup enabled" | ||
myNodeRound=`goal node lastround` | ||
blockchainRoundMath=$(curl -s https://testnet-api.voi.nodly.io/v2/status | jq -r '.["last-round"]' )" - 1000" | ||
blockchainRound=$(echo $blockchainRoundMath | bc) | ||
|
||
echo "catchup check: my round is $myNodeRound, blockchain round is $blockchainRound" | ||
if [ "$myNodeRound" -lt "$blockchainRound" ]; then | ||
echo "Executing catchup script because my current round is $myNodeRound" | ||
catchup=$(curl -s https://testnet-api.voi.nodly.io/v2/status | jq -r '.["last-catchpoint"]') | ||
sleep 10s | ||
echo "going to run 'goal node catchup $catchup'" | ||
goal node catchup $catchup || error_code=$? | ||
if [ $error_code_int -ne 0 ]; then | ||
echo "failed to start catchup"; | ||
exit 1; | ||
fi | ||
fi | ||
fi | ||
|
||
while true; do date; goal node status; sleep 600;done |