From 0638d717a380a0fcb656086afbe69cf131d467d6 Mon Sep 17 00:00:00 2001 From: marc0olo Date: Fri, 17 Nov 2023 12:08:12 +0100 Subject: [PATCH] first commit with leap v4.0.4 --- .github/workflows/docker-publish.yaml | 29 +++++ Dockerfile | 25 +++++ README.md | 12 +++ example-usage/cleanup.sh | 2 + example-usage/docker-compose.yaml | 13 +++ example-usage/xpr-mainnet/.gitignore | 1 + example-usage/xpr-mainnet/config/config.ini | 102 ++++++++++++++++++ example-usage/xpr-mainnet/config/genesis.json | 24 +++++ start.sh | 10 ++ 9 files changed, 218 insertions(+) create mode 100644 .github/workflows/docker-publish.yaml create mode 100644 Dockerfile create mode 100644 README.md create mode 100755 example-usage/cleanup.sh create mode 100644 example-usage/docker-compose.yaml create mode 100644 example-usage/xpr-mainnet/.gitignore create mode 100644 example-usage/xpr-mainnet/config/config.ini create mode 100644 example-usage/xpr-mainnet/config/genesis.json create mode 100755 start.sh diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml new file mode 100644 index 0000000..950e9bb --- /dev/null +++ b/.github/workflows/docker-publish.yaml @@ -0,0 +1,29 @@ +name: docker-build-and-push + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Push to DockerHub + id: docker_build + uses: docker/build-push-action@v5 + with: + push: true + tags: kryptokrauts/leap:${{github.ref_name}} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c2bbd40 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:22.04 AS builder + +RUN apt-get update && apt-get -y install wget +RUN wget https://github.com/AntelopeIO/leap/releases/download/v4.0.4/leap_4.0.4-ubuntu22.04_amd64.deb +RUN apt install -y ./leap_4.0.4-ubuntu22.04_amd64.deb + +FROM ubuntu:22.04 AS runner + +COPY --from=builder /usr/bin /usr/bin + +RUN adduser --disabled-password leap && \ + mkdir -p /opt/leap && \ + chown -R leap:leap /opt + +WORKDIR /opt/leap +USER leap + +COPY start.sh /opt/leap/start.sh + +ENTRYPOINT [\ + "/opt/leap/start.sh",\ + "--data-dir", "/opt/leap/data",\ + "--config-dir", "/opt/leap/config",\ + "--genesis-json", "/opt/leap/config/genesis.json"\ +] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b195a57 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# leap-image-builder + +This repository includes a Github action that builds a docker image for [Antelope Leap](https://github.com/AntelopeIO/leap). + +The images are published on DockerHub: +- https://hub.docker.com/repository/docker/kryptokrauts/leap + +## Example usage + +The provided [`docker-compose.yaml`](./example-usage/docker-compose.yaml) showcases how the docker image can be used to run a node on the [XPR Network](https://xprnetwork.org) that has the [`state-history-plugin`](https://github.com/AntelopeIO/leap/blob/main/docs/01_nodeos/03_plugins/state_history_plugin/index.md) enabled. + +Note: You can use the [`.cleanup.sh`](./example-usage/cleanup.sh) script to easily remove all the chain relevant files that will be added when running the node. \ No newline at end of file diff --git a/example-usage/cleanup.sh b/example-usage/cleanup.sh new file mode 100755 index 0000000..faa51e8 --- /dev/null +++ b/example-usage/cleanup.sh @@ -0,0 +1,2 @@ +rm -rf xpr-mainnet/data/* +rm -rf xpr-mainnet/config/protocol_features \ No newline at end of file diff --git a/example-usage/docker-compose.yaml b/example-usage/docker-compose.yaml new file mode 100644 index 0000000..2342d6b --- /dev/null +++ b/example-usage/docker-compose.yaml @@ -0,0 +1,13 @@ +services: + leap: + build: + context: ../ + dockerfile: Dockerfile + container_name: leap + command: + - "--disable-replay-opts" + volumes: + - ./xpr-mainnet/config:/opt/leap/config + - ./xpr-mainnet/data:/opt/leap/data + ports: + - "8888:8888" \ No newline at end of file diff --git a/example-usage/xpr-mainnet/.gitignore b/example-usage/xpr-mainnet/.gitignore new file mode 100644 index 0000000..07f43b8 --- /dev/null +++ b/example-usage/xpr-mainnet/.gitignore @@ -0,0 +1 @@ +data/* \ No newline at end of file diff --git a/example-usage/xpr-mainnet/config/config.ini b/example-usage/xpr-mainnet/config/config.ini new file mode 100644 index 0000000..ecfca6d --- /dev/null +++ b/example-usage/xpr-mainnet/config/config.ini @@ -0,0 +1,102 @@ +http-server-address = 0.0.0.0:8888 +p2p-listen-endpoint = 0.0.0.0:9876 +p2p-server-address = DOMAIN_OR_IP:9876 + +enable-account-queries = true + +chain-state-db-size-mb = 8192 + +contracts-console = true + +p2p-max-nodes-per-host = 100 + +chain-threads = 8 +http-threads = 6 +#wasm-runtime = wabt +http-validate-host = false +verbose-http-errors = true +abi-serializer-max-time-ms = 2000 + +#produce-time-offset-us = 250000 +last-block-time-offset-us = -300000 +# eosio2.0 +http-max-response-time-ms = 100 +#Only!! for performance eosio 2.0+ +#eos-vm-oc-compile-threads = 4 +#eos-vm-oc-enable = 1 +wasm-runtime = eos-vm-jit +#END + + +# Safely shut down node when free space +chain-state-db-guard-size-mb = 128 +#reversible-blocks-db-guard-size-mb = 2 + + +access-control-allow-origin = * +access-control-allow-headers = Origin, X-Requested-With, Content-Type, Accept +# access-control-allow-headers = +# access-control-max-age = +# access-control-allow-credentials = false + + +# actor-whitelist = +# actor-blacklist = +# contract-whitelist = +# contract-blacklist = +# filter-on = + + +# SSL +# Filename with https private key in PEM format. Required for https (eosio::http_plugin) +# https-server-address = +# Filename with the certificate chain to present on https connections. PEM format. Required for https. (eosio::http_plugin) +# https-certificate-chain-file = +# Filename with https private key in PEM format. Required for https (eosio::http_plugin) +# https-private-key-file = + +########################################################################### +# State History (For 1.8.0-rc1+ add to start params --disable-replay-opts ) +plugin = eosio::state_history_plugin +state-history-dir = state-history +trace-history = true +chain-state-history = true +state-history-endpoint = 0.0.0.0:8080 +# debug mode info (https://github.com/EOSIO/eos/pull/7298) +# #trace-history-debug-mode +############################################################################ + +allowed-connection = any + +# allowed-connection = specified +# peer-private-key = ["!!NEW_KEY_PUB!!","!!NEW_KEY_PRIV!!"] #create new key for private peers +# peer-key = "!![PUBKEY]!!" + + +max-clients = 100 +connection-cleanup-period = 30 +sync-fetch-span = 2000 +enable-stale-production = false + + +pause-on-startup = false +max-irreversible-block-age = -1 +#txn-reference-block-lag = 0 + +# peer-key = +# peer-private-key = +plugin = eosio::http_plugin +plugin = eosio::producer_plugin +#plugin = eosio::producer_api_plugin +plugin = eosio::chain_plugin +plugin = eosio::chain_api_plugin + +#p2p-peer-address = +p2p-peer-address = api.protonnz.com:9876 +p2p-peer-address = proton.protonuk.io:9876 +p2p-peer-address = proton.p2p.eosusa.io:9879 +p2p-peer-address = protonp2p.eoscafeblock.com:9130 +p2p-peer-address = p2p.alvosec.com:9876 +p2p-peer-address = mainnet.brotonbp.com:9876 +p2p-peer-address = proton.eu.eosamsterdam.net:9103 +p2p-peer-address = proton.genereos.io:9876 \ No newline at end of file diff --git a/example-usage/xpr-mainnet/config/genesis.json b/example-usage/xpr-mainnet/config/genesis.json new file mode 100644 index 0000000..e31334c --- /dev/null +++ b/example-usage/xpr-mainnet/config/genesis.json @@ -0,0 +1,24 @@ +{ + "initial_timestamp": "2020-04-22T17:00:00", + "initial_key": "EOS5XPRJt1zUiLH98rtDLj9TnPi52DLQ7gTZbkRvBGJXLv6ak6Cdq", + "initial_configuration": { + "max_block_net_usage": 1048576, + "target_block_net_usage_pct": 1000, + "max_transaction_net_usage": 524288, + "base_per_transaction_net_usage": 12, + "net_usage_leeway": 500, + "context_free_discount_net_usage_num": 20, + "context_free_discount_net_usage_den": 100, + "max_block_cpu_usage": 200000, + "target_block_cpu_usage_pct": 2500, + "max_transaction_cpu_usage": 150000, + "min_transaction_cpu_usage": 100, + "max_transaction_lifetime": 3600, + "deferred_trx_expiration_window": 600, + "max_transaction_delay": 3888000, + "max_inline_action_size": 4096, + "max_inline_action_depth": 6, + "max_authority_depth": 6, + "max_ram_size": 34359738368 + } +} \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..3bda286 --- /dev/null +++ b/start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +NODEOSBINDIR="/usr/bin" + +echo -e "Starting Nodeos \n"; + +ulimit -n 65535 +ulimit -s 64000 + +$NODEOSBINDIR/nodeos "$@" \ No newline at end of file