diff --git a/tools/entry-node/.gitignore b/tools/entry-node/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..4c49bd78f1d08f2bc09fa0bd8191ed38b7dce5e3 --- /dev/null +++ b/tools/entry-node/.gitignore @@ -0,0 +1 @@ +.env diff --git a/tools/entry-node/README.md b/tools/entry-node/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1472c5d49332d2ff3eaf9a805585712adcc415f1 --- /dev/null +++ b/tools/entry-node/README.md @@ -0,0 +1,38 @@ +# Docker entry node + +This folder contains the scripts for running a GoShimmer entry node with Docker. + +It builds the Docker image directly from the specified Git tag (such as `v0.1.3`, `master`, `af0ae41d5bfd607123e6cbae271da839a050b220`, ...) and does not depend on the locally checked out version. +The GoShimmer DB is persisted in a named Docker volume. + +The entry node exposes the following ports on the host: +- 14626/udp (Autopeering) +- 188/tcp (Analysis Server) +- 80/tcp (Analysis Visualizer) + +## How to run + +### Create the Docker volume +Before starting an entry node for the specified git tag the first time, a Docker volume needs to be created. +This is only needed once and can be done via the following command: +```sh +TAG=tag ./create-volume.sh +``` +The environment variable `TAG` contains the Git tag of the desired GoShimmer version. +### Run the GoShimmer entry node +To start the actual entry node, run the following: +```sh +TAG=tag SEED=seed docker-compose up -d --build +``` +The optional environment variable `SEED` contains the autopeering seed of the entry node in Base64 encoding. +If `SEED` is not set, the seed will be taken from the DB (if present) in the volume. +As such, `SEED` is only required once when setting or changing the seed of the entry node. + +Alternatively to providing the variables in the command, create the file `.env` in the base folder with the following content: +``` +# Git tag of the entry node version +TAG=tag + +# Autopeering seed used for the entry node +SEED=seed +``` diff --git a/tools/entry-node/create-volume.sh b/tools/entry-node/create-volume.sh new file mode 100755 index 0000000000000000000000000000000000000000..5bde3f24dd7e889ec6e717c914fe0bdb74f69466 --- /dev/null +++ b/tools/entry-node/create-volume.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +[ -z "$TAG" ] && echo "TAG not set" >&2 && exit 1 + +# create docker volume and fix permissions +docker run --rm -v entrynode_db-"$TAG":/volume busybox chown -R 65532:65532 /volume diff --git a/tools/entry-node/docker-compose.yml b/tools/entry-node/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..62b128391cbff0be0409f1e023d4cb42d3b7628f --- /dev/null +++ b/tools/entry-node/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3" + +services: + entrynode: + image: "iotaledger/goshimmer-entrynode:${TAG}" + container_name: goshimmer-entrynode + build: + context: "https://github.com/iotaledger/goshimmer.git#${TAG}" + volumes: + - entrynode:/tmp/mainnetdb + - entrynode:/mainnetdb + ports: + - "1888:188/tcp" # analysis server + - "8080:80/tcp" # analysis HTTP server + - "14626:14626/udp" # autopeering discovery + restart: unless-stopped + command: > + --autopeering.seed=${SEED} + --autopeering.entryNodes= + --analysis.client.serverAddress= + --analysis.server.port=1888 + --analysis.httpServer.bindAddress=0.0.0.0:8080 + --node.disablePlugins=gossip,portcheck,spa,dashboard,webapi,webapibroadcastdataendpoint,webapifindtransactionhashesendpoint,webapigetneighborsendpoint,webapigettransactionobjectsbyhashendpoint,webapigettransactiontrytesbyhashendpoint + +volumes: + entrynode: + external: + name: entrynode_db-${TAG}