From 859a7f13735c800acbf2f8e1497d228a13f32072 Mon Sep 17 00:00:00 2001 From: Sebastian <379651+czarly@users.noreply.github.com> Date: Fri, 20 Oct 2023 18:17:41 +0200 Subject: [PATCH] fantom fullnode --- fantom.yml | 10 ++++--- fantom/Dockerfile-fullnode | 28 +++++++++++++++++++ fantom/scripts/entrypoint-fullnode.sh | 39 +++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 fantom/Dockerfile-fullnode create mode 100644 fantom/scripts/entrypoint-fullnode.sh diff --git a/fantom.yml b/fantom.yml index 72ab2ad6..336393fc 100644 --- a/fantom.yml +++ b/fantom.yml @@ -3,15 +3,19 @@ services: fantom: build: args: - VERSION: release/1.1.0-rc.4 + VERSION: release/1.1.3-rc.5 context: ./fantom - dockerfile: Dockerfile + dockerfile: Dockerfile-fullnode environment: - - SNAPSHOT_URL=https://download.fantom.network/opera_5may22.tgz + - CACHE_SIZE=${FANTOM_CACHE_SIZE:-16000} volumes: - "fantom:/datadir" expose: - "18545" + - "19921" + ports: + - "19921:19921" + - "19921:19921/udp" networks: - chains restart: unless-stopped diff --git a/fantom/Dockerfile-fullnode b/fantom/Dockerfile-fullnode new file mode 100644 index 00000000..28ddabca --- /dev/null +++ b/fantom/Dockerfile-fullnode @@ -0,0 +1,28 @@ +# Build Fantom in a stock Go builder container +FROM golang:1.19-alpine as builder + +# Install packages we need +RUN apk add --no-cache make gcc musl-dev linux-headers git + +# Make a folder to work in +RUN mkdir /fantom + +# Grab VERSION from Build Args +ARG VERSION + +# Clone the repo to that folder +RUN git clone --branch ${VERSION} https://github.com/Fantom-foundation/go-opera.git /fantom + +# Build Fantom +RUN cd /fantom && make + +# Pull Fantom into a second stage deploy alpine container +FROM alpine:latest + +RUN apk add --no-cache ca-certificates wget tzdata +COPY --from=builder /fantom/build/opera /usr/local/bin/ + +# Set entrypoint +COPY ./scripts/entrypoint-fullnode.sh /usr/local/bin/entrypoint.sh +RUN chmod u+x /usr/local/bin/entrypoint.sh +ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] diff --git a/fantom/scripts/entrypoint-fullnode.sh b/fantom/scripts/entrypoint-fullnode.sh new file mode 100644 index 00000000..56a72686 --- /dev/null +++ b/fantom/scripts/entrypoint-fullnode.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# exit script on any error +set -e + +# Set fantom Home Directory +FANTOM_HOME=/datadir + +if [ ! -f "$FANTOM_HOME/testnet-16200-pruned-mpt.g" ]; +then + cd $FANTOM_HOME + echo "downloading launch genesis file" + wget --quiet https://download.fantom.network/mainnet-109331-no-history.g +fi + +# uncomment the next line and do docker-compose build in case you have to try to fix the db after unclean shutdown etc. +# opera --db.preset pbl-1 --datadir=$FANTOM_HOME db heal --experimental + +opera \ + --genesis=$FANTOM_HOME/mainnet-109331-no-history.g \ + --port=19921 \ + --maxpeers=200 \ + --datadir=$FANTOM_HOME \ + --http \ + --http.addr=0.0.0.0 \ + --http.port=18544 \ + --http.api=ftm,eth,debug,admin,web3,personal,net,txpool,sfc,trace \ + --http.corsdomain="*" \ + --http.vhosts="*" \ + --ws \ + --ws.addr=0.0.0.0 \ + --ws.port=18544 \ + --ws.api=ftm,eth,debug,admin,web3,personal,net,txpool,sfc \ + --ws.origins="*" \ + --nousb \ + --db.migration.mode reformat \ + --db.preset pbl-1 \ + --cache=${CACHE_SIZE:-16000} \ + --syncmode=snap