join the fantom testnet fun

This commit is contained in:
Sebastian
2023-10-20 17:01:58 +02:00
parent 818db4a42e
commit e84519646e
3 changed files with 99 additions and 0 deletions

32
fantom-testnet.yml Normal file
View File

@@ -0,0 +1,32 @@
version: "3.1"
services:
fantom-testnet:
build:
args:
VERSION: release/1.1.3-rc.5
context: ./fantom
dockerfile: Dockerfile-testnet
environment:
- CACHE_SIZE=${FANTOM_CACHE_SIZE:-16000}
volumes:
- "fantom-testnet:/datadir"
expose:
- "18544"
- "44629"
ports:
- "44629:44629"
- "44629:44629/udp"
networks:
- chains
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.fantom-testnet-stripprefix.stripprefix.prefixes=/fantom-testnet"
- "traefik.http.services.fantom-testnet.loadbalancer.server.port=18544"
- "traefik.http.routers.fantom-testnet.entrypoints=websecure"
- "traefik.http.routers.fantom-testnet.tls.certresolver=myresolver"
- "traefik.http.routers.fantom-testnet.rule=Host(`$DOMAIN`) && PathPrefix(`/fantom-testnet`)"
- "traefik.http.routers.fantom-testnet.middlewares=fantom-testnet-stripprefix, ipwhitelist"
volumes:
fantom-testnet:

28
fantom/Dockerfile-testnet Normal file
View File

@@ -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-testnet-fullnode.sh /usr/local/bin/entrypoint.sh
RUN chmod u+x /usr/local/bin/entrypoint.sh
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]

View File

@@ -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://files.fantom.network/testnet-16200-pruned-mpt.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/testnet-16200-pruned-mpt.g \
--port=44629 \
--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