do fantom with sonic as well
This commit is contained in:
26
fantom/Dockerfile.sonic
Normal file
26
fantom/Dockerfile.sonic
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
FROM golang:1.22 as builder
|
||||||
|
|
||||||
|
ARG VERSION
|
||||||
|
ARG REPO
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y git musl-dev make
|
||||||
|
|
||||||
|
RUN cd /go && git clone ${REPO:-https://github.com/Fantom-foundation/sonic.git} sonic && cd sonic && git fetch --tags && git checkout -b ${VERSION} tags/${VERSION}
|
||||||
|
|
||||||
|
WORKDIR /go/sonic
|
||||||
|
|
||||||
|
ARG GOPROXY
|
||||||
|
RUN go mod download
|
||||||
|
RUN make all
|
||||||
|
|
||||||
|
FROM golang:1.22
|
||||||
|
|
||||||
|
COPY --from=builder /go/sonic/build/sonicd /usr/local/bin/
|
||||||
|
COPY --from=builder /go/sonic/build/sonictool /usr/local/bin/
|
||||||
|
|
||||||
|
COPY ./scripts/entrypoint.sonic.sh /usr/local/bin/entrypoint.sh
|
||||||
|
|
||||||
|
VOLUME /var/sonic
|
||||||
|
|
||||||
|
RUN chmod u+x /usr/local/bin/entrypoint.sh
|
||||||
|
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
||||||
23
fantom/scripts/entrypoint.sonic.sh
Normal file
23
fantom/scripts/entrypoint.sonic.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
datadir=/var/sonic
|
||||||
|
|
||||||
|
if [ ! -f "$datadir/initialized" ]; then
|
||||||
|
echo "Initializing Sonic..."
|
||||||
|
|
||||||
|
url="${GENESIS:-https://download.fantom.network/opera/mainnet/mainnet-5577-archive.g}"
|
||||||
|
filename=$(basename "$url")
|
||||||
|
|
||||||
|
wget -P "$datadir" "$url"
|
||||||
|
|
||||||
|
GOMEMLIMIT="${CACHE_GB}GiB" sonictool --datadir "$datadir" --cache "${CACHE_GB}000" genesis "$datadir/$filename"
|
||||||
|
rm "$datadir/$filename"
|
||||||
|
|
||||||
|
touch "$datadir/initialized"
|
||||||
|
|
||||||
|
echo "Initialization complete."
|
||||||
|
else
|
||||||
|
echo "Sonic is already initialized."
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec sonicd --cache "${CACHE_GB}000" --datadir "$datadir" "$@"
|
||||||
51
fantom/sonic/fantom-mainnet-sonic-archive.yml
Normal file
51
fantom/sonic/fantom-mainnet-sonic-archive.yml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
services:
|
||||||
|
fantom-mainnet-archive:
|
||||||
|
build:
|
||||||
|
context: ./fantom
|
||||||
|
dockerfile: Dockerfile.sonic
|
||||||
|
args:
|
||||||
|
VERSION: "${FANTOM_SONIC_VERSION:-v1.2.1-h}"
|
||||||
|
REPO: "https://github.com/Fantom-foundation/sonic.git"
|
||||||
|
stop_grace_period: 3m
|
||||||
|
volumes:
|
||||||
|
- "fantom-mainnet-sonic-archive:/var/sonic"
|
||||||
|
expose:
|
||||||
|
- "8545"
|
||||||
|
ports:
|
||||||
|
- "10335:10335"
|
||||||
|
- "10335:10335/udp"
|
||||||
|
networks:
|
||||||
|
- chains
|
||||||
|
environment:
|
||||||
|
- "IP=${IP}"
|
||||||
|
- "GENESIS=https://download.fantom.network/mainnet-latest-archive.g"
|
||||||
|
- "CACHE_GB=${FANTOM_MAINNET_SONIC_CACHE_GB:-28}"
|
||||||
|
restart: unless-stopped
|
||||||
|
command: >
|
||||||
|
--port=10335
|
||||||
|
--nat=extip:${IP}
|
||||||
|
--maxpeers=200
|
||||||
|
--http
|
||||||
|
--http.addr=0.0.0.0
|
||||||
|
--http.port=8545
|
||||||
|
--http.api=admin,debug,web3,eth,dag,txpool,personal,abft,net,trace,ftm
|
||||||
|
--http.corsdomain="*"
|
||||||
|
--http.vhosts="*"
|
||||||
|
--ws
|
||||||
|
--ws.addr=0.0.0.0
|
||||||
|
--ws.port=8545
|
||||||
|
--ws.api=admin,debug,web3,eth,dag,txpool,personal,abft,net,trace,ftm
|
||||||
|
--ws.origins="*"
|
||||||
|
--rpc.gascap=600000000
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.middlewares.fantom-mainnet-sonic-archive-stripprefix.stripprefix.prefixes=/fantom-mainnet-archive"
|
||||||
|
- "traefik.http.services.fantom-mainnet-sonic-archive.loadbalancer.server.port=18544"
|
||||||
|
- "traefik.http.routers.fantom-mainnet-sonic-archive.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.fantom-mainnet-sonic-archive.tls.certresolver=myresolver"
|
||||||
|
- "traefik.http.routers.fantom-mainnet-sonic-archive.rule=Host(`$DOMAIN`) && PathPrefix(`/fantom-mainnet-archive`)"
|
||||||
|
- "traefik.http.routers.fantom-mainnet-sonic-archive.middlewares=fantom-mainnet-sonic-archive-stripprefix, ipwhitelist"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
fantom-mainnet-sonic-archive:
|
||||||
51
fantom/sonic/fantom-testnet-sonic-archive.yml
Normal file
51
fantom/sonic/fantom-testnet-sonic-archive.yml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
services:
|
||||||
|
fantom-testnet-archive:
|
||||||
|
build:
|
||||||
|
context: ./fantom
|
||||||
|
dockerfile: Dockerfile.sonic
|
||||||
|
args:
|
||||||
|
VERSION: "${FANTOM_SONIC_VERSION:-v1.2.1-h}"
|
||||||
|
REPO: "https://github.com/Fantom-foundation/sonic.git"
|
||||||
|
stop_grace_period: 3m
|
||||||
|
volumes:
|
||||||
|
- "fantom-testnet-sonic-archive:/var/sonic"
|
||||||
|
expose:
|
||||||
|
- "8545"
|
||||||
|
ports:
|
||||||
|
- "10652:10652"
|
||||||
|
- "10652:10652/udp"
|
||||||
|
networks:
|
||||||
|
- chains
|
||||||
|
environment:
|
||||||
|
- "IP=${IP}"
|
||||||
|
- "GENESIS=https://download.fantom.network/opera/testnet/testnet-26650-rpc.g"
|
||||||
|
- "CACHE_GB=${FANTOM_TESTNET_SONIC_CACHE_GB:-28}"
|
||||||
|
restart: unless-stopped
|
||||||
|
command: >
|
||||||
|
--port=10652
|
||||||
|
--nat=extip:${IP}
|
||||||
|
--maxpeers=200
|
||||||
|
--http
|
||||||
|
--http.addr=0.0.0.0
|
||||||
|
--http.port=8545
|
||||||
|
--http.api=admin,debug,web3,eth,dag,txpool,personal,abft,net,trace,ftm
|
||||||
|
--http.corsdomain="*"
|
||||||
|
--http.vhosts="*"
|
||||||
|
--ws
|
||||||
|
--ws.addr=0.0.0.0
|
||||||
|
--ws.port=8545
|
||||||
|
--ws.api=admin,debug,web3,eth,dag,txpool,personal,abft,net,trace,ftm
|
||||||
|
--ws.origins="*"
|
||||||
|
--rpc.gascap=600000000
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.middlewares.fantom-testnet-sonic-archive-stripprefix.stripprefix.prefixes=/fantom-testnet-archive"
|
||||||
|
- "traefik.http.services.fantom-testnet-sonic-archive.loadbalancer.server.port=18544"
|
||||||
|
- "traefik.http.routers.fantom-testnet-sonic-archive.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.fantom-testnet-sonic-archive.tls.certresolver=myresolver"
|
||||||
|
- "traefik.http.routers.fantom-testnet-sonic-archive.rule=Host(`$DOMAIN`) && PathPrefix(`/fantom-testnet-archive`)"
|
||||||
|
- "traefik.http.routers.fantom-testnet-sonic-archive.middlewares=fantom-testnet-sonic-archive-stripprefix, ipwhitelist"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
fantom-testnet-sonic-archive:
|
||||||
Reference in New Issue
Block a user