From b04ec534995bba84ad8532e154ee1efc85f38251 Mon Sep 17 00:00:00 2001 From: Wolfgang Welz <welzwo@gmail.com> Date: Mon, 27 Apr 2020 16:48:00 +0200 Subject: [PATCH] Tool: Docker entry node (#371) * add docker based entry node * disable analysis client plugin --- tools/entry-node/.gitignore | 1 + tools/entry-node/README.md | 38 +++++++++++++++++++++++++++++ tools/entry-node/create-volume.sh | 6 +++++ tools/entry-node/docker-compose.yml | 28 +++++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 tools/entry-node/.gitignore create mode 100644 tools/entry-node/README.md create mode 100755 tools/entry-node/create-volume.sh create mode 100644 tools/entry-node/docker-compose.yml diff --git a/tools/entry-node/.gitignore b/tools/entry-node/.gitignore new file mode 100644 index 00000000..4c49bd78 --- /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 00000000..1472c5d4 --- /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 00000000..5bde3f24 --- /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 00000000..62b12839 --- /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} -- GitLab