From d73ef7c334d0874b021aecb7e7851d6eb08b3c92 Mon Sep 17 00:00:00 2001 From: rilesdun Date: Mon, 16 Jan 2023 20:35:55 -0400 Subject: [PATCH 1/5] added docker directory, slimmed 20.04 docker image --- Dockerfile | 193 ------------------ docker/ubuntu-base/Dockerfile | 40 ++++ .../ubuntu18/Dockerfile.18.04 | 0 docker/ubuntu20/Dockerfile | 75 +++++++ 4 files changed, 115 insertions(+), 193 deletions(-) delete mode 100644 Dockerfile create mode 100644 docker/ubuntu-base/Dockerfile rename Dockerfile.18.04 => docker/ubuntu18/Dockerfile.18.04 (100%) create mode 100644 docker/ubuntu20/Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 3f4c62b5..00000000 --- a/Dockerfile +++ /dev/null @@ -1,193 +0,0 @@ -FROM ubuntu:20.04 -MAINTAINER Peerplays Blockchain Standards Association - -#=============================================================================== -# Ubuntu setup -#=============================================================================== - -RUN \ - apt-get update -y && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - apt-utils \ - autoconf \ - bash \ - bison \ - build-essential \ - ca-certificates \ - dnsutils \ - expect \ - flex \ - git \ - graphviz \ - libbz2-dev \ - libcurl4-openssl-dev \ - libncurses-dev \ - libsnappy-dev \ - libssl-dev \ - libtool \ - libzip-dev \ - locales \ - lsb-release \ - mc \ - nano \ - net-tools \ - ntp \ - openssh-server \ - pkg-config \ - python3 \ - python3-jinja2 \ - sudo \ - systemd-coredump \ - wget - -ENV HOME /home/peerplays -RUN useradd -rm -d /home/peerplays -s /bin/bash -g root -G sudo -u 1000 peerplays -RUN echo "peerplays ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/peerplays -RUN chmod 440 /etc/sudoers.d/peerplays - -RUN service ssh start -RUN echo 'peerplays:peerplays' | chpasswd - -# SSH -EXPOSE 22 - -#=============================================================================== -# Boost setup -#=============================================================================== - -WORKDIR /home/peerplays/ - -RUN \ - wget https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.gz && \ - tar -xzvf boost_1_72_0.tar.gz boost_1_72_0 && \ - cd boost_1_72_0/ && \ - ./bootstrap.sh && \ - ./b2 install - -#=============================================================================== -# cmake setup -#=============================================================================== - -WORKDIR /home/peerplays/ - -RUN \ - wget -c 'https://cmake.org/files/v3.23/cmake-3.23.1-linux-x86_64.sh' -O cmake-3.23.1-linux-x86_64.sh && \ - chmod 755 ./cmake-3.23.1-linux-x86_64.sh && \ - ./cmake-3.23.1-linux-x86_64.sh --prefix=/usr/ --skip-license && \ - cmake --version - -#=============================================================================== -# libzmq setup -#=============================================================================== - -WORKDIR /home/peerplays/ - -RUN \ - wget https://github.com/zeromq/libzmq/archive/refs/tags/v4.3.4.zip && \ - unzip v4.3.4.zip && \ - cd libzmq-4.3.4 && \ - mkdir build && \ - cd build && \ - cmake .. && \ - make -j$(nproc) install && \ - ldconfig - -#=============================================================================== -# cppzmq setup -#=============================================================================== - -WORKDIR /home/peerplays/ - -RUN \ - wget https://github.com/zeromq/cppzmq/archive/refs/tags/v4.8.1.zip && \ - unzip v4.8.1.zip && \ - cd cppzmq-4.8.1 && \ - mkdir build && \ - cd build && \ - cmake .. && \ - make -j$(nproc) install && \ - ldconfig - -#=============================================================================== -# Doxygen setup -#=============================================================================== - -WORKDIR /home/peerplays/ - -RUN \ - sudo apt install -y bison flex && \ - wget https://github.com/doxygen/doxygen/archive/refs/tags/Release_1_8_17.tar.gz && \ - tar -xvf Release_1_8_17.tar.gz && \ - cd doxygen-Release_1_8_17 && \ - mkdir build && \ - cd build && \ - cmake .. && \ - make -j$(nproc) install && \ - ldconfig - -#=============================================================================== -# Perl setup -#=============================================================================== - -WORKDIR /home/peerplays/ - -RUN \ - wget https://github.com/Perl/perl5/archive/refs/tags/v5.30.0.tar.gz && \ - tar -xvf v5.30.0.tar.gz && \ - cd perl5-5.30.0 && \ - ./Configure -des && \ - make -j$(nproc) install && \ - ldconfig - -#=============================================================================== -# Peerplays setup -#=============================================================================== - -WORKDIR /home/peerplays/ - -## Clone Peerplays -#RUN \ -# git clone https://gitlab.com/PBSA/peerplays.git && \ -# cd peerplays && \ -# git checkout develop && \ -# git submodule update --init --recursive && \ -# git branch --show-current && \ -# git log --oneline -n 5 - -# Add local source -ADD . peerplays - -# Configure Peerplays -RUN \ - cd peerplays && \ - git submodule update --init --recursive && \ - git symbolic-ref --short HEAD && \ - git log --oneline -n 5 && \ - mkdir build && \ - cd build && \ - cmake -DCMAKE_BUILD_TYPE=Release .. - -# Build Peerplays -RUN \ - cd peerplays/build && \ - make -j$(nproc) cli_wallet witness_node - -WORKDIR /home/peerplays/peerplays-network - -# Setup Peerplays runimage -RUN \ - ln -s /home/peerplays/peerplays/build/programs/cli_wallet/cli_wallet ./ && \ - ln -s /home/peerplays/peerplays/build/programs/witness_node/witness_node ./ - -RUN ./witness_node --create-genesis-json genesis.json && \ - rm genesis.json - -RUN chown peerplays:root -R /home/peerplays/peerplays-network - -# Peerplays RPC -EXPOSE 8090 -# Peerplays P2P: -EXPOSE 9777 - -# Peerplays -CMD ["./witness_node", "-d", "./witness_node_data_dir"] diff --git a/docker/ubuntu-base/Dockerfile b/docker/ubuntu-base/Dockerfile new file mode 100644 index 00000000..41f8679c --- /dev/null +++ b/docker/ubuntu-base/Dockerfile @@ -0,0 +1,40 @@ +FROM ubuntu:20.04 +LABEL Peerplays Blockchain Standards Association + +RUN \ + apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + libzmq5 \ + apt-utils \ + autoconf \ + bash \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + dnsutils \ + doxygen \ + expect \ + git \ + graphviz \ + libboost-all-dev \ + libbz2-dev \ + libcurl4-openssl-dev \ + libncurses-dev \ + libsnappy-dev \ + libssl-dev \ + libtool \ + libzip-dev \ + locales \ + lsb-release \ + mc \ + nano \ + net-tools \ + ntp \ + pkg-config \ + perl \ + python3 \ + python3-jinja2 \ + sudo \ + systemd-coredump \ + wget \ No newline at end of file diff --git a/Dockerfile.18.04 b/docker/ubuntu18/Dockerfile.18.04 similarity index 100% rename from Dockerfile.18.04 rename to docker/ubuntu18/Dockerfile.18.04 diff --git a/docker/ubuntu20/Dockerfile b/docker/ubuntu20/Dockerfile new file mode 100644 index 00000000..750f48be --- /dev/null +++ b/docker/ubuntu20/Dockerfile @@ -0,0 +1,75 @@ +FROM peerplays/ubuntu-build:20.04 AS deps +LABEL Peerplays Blockchain Standards Association +RUN groupadd peerplays && \ + useradd -rm -d /home/peerplays -s /bin/bash -g peerplays -u 1000 peerplays + +WORKDIR /home/peerplays/ + +#=============================================================================== +# libzmq setup +#=============================================================================== +RUN \ + wget https://github.com/zeromq/libzmq/archive/refs/tags/v4.3.4.zip && \ + unzip v4.3.4.zip && \ + cd libzmq-4.3.4 && \ + mkdir build && \ + cd build && \ + cmake .. && \ + make -j$(nproc) install && \ + ldconfig +#=============================================================================== +# cppzmq setup +#=============================================================================== +RUN \ + wget https://github.com/zeromq/cppzmq/archive/refs/tags/v4.8.1.zip && \ + unzip v4.8.1.zip && \ + cd cppzmq-4.8.1 && \ + mkdir build && \ + cd build && \ + cmake .. && \ + make -j$(nproc) install && \ + ldconfig + +#=============================================================================== +# Peerplays setup +#=============================================================================== + +# Add local source +ADD . peerplays + +# Configure and build Peerplays +RUN \ + cd peerplays && \ + git submodule update --init --recursive && \ + mkdir build && \ + cd build && \ + cmake -DCMAKE_BUILD_TYPE=Release .. && \ + make -j$(nproc) cli_wallet witness_node && \ + chown -R peerplays:peerplays /home/peerplays/ + +# Fresh image for running compiled binaries +FROM ubuntu:20.04 + +RUN apt update -y && \ + DEBIAN_FRONTEND=noninteractive apt install -y \ + curl \ + libzmq5 && \ + groupadd peerplays && \ + useradd -rm -d /home/peerplays -s /bin/bash -g peerplays -u 1000 peerplays && \ + chown -R peerplays:peerplays /home/peerplays/ + +USER peerplays + +WORKDIR /home/peerplays/ + +# Copying the build artifacts from the above ubuntu-build image +COPY --from=deps /home/peerplays/peerplays/build/programs/witness_node/witness_node . +COPY --from=deps /home/peerplays/peerplays/build/programs/cli_wallet/cli_wallet . + +# Peerplays RPC +EXPOSE 8090 +# Peerplays P2P: +EXPOSE 9777 + +# Peerplays +CMD ["./witness_node", "-d", "./witness_node_data_dir"] -- 2.45.2 From e4a8764259b55acf311dc75a2508682c9a644c77 Mon Sep 17 00:00:00 2001 From: Rily Dunlap Date: Tue, 17 Jan 2023 00:45:49 +0000 Subject: [PATCH 2/5] Delete .dockerignore --- .dockerignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 378eac25..00000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -build -- 2.45.2 From d1cc535579f0f18267f5bc49da19ac45b4ee4c8f Mon Sep 17 00:00:00 2001 From: Rily Dunlap Date: Tue, 17 Jan 2023 15:21:49 +0000 Subject: [PATCH 3/5] Update Dockerfile - added mainnet genesis.json file to final runtime image --- docker/ubuntu20/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/ubuntu20/Dockerfile b/docker/ubuntu20/Dockerfile index 750f48be..3e7d2436 100644 --- a/docker/ubuntu20/Dockerfile +++ b/docker/ubuntu20/Dockerfile @@ -65,6 +65,7 @@ WORKDIR /home/peerplays/ # Copying the build artifacts from the above ubuntu-build image COPY --from=deps /home/peerplays/peerplays/build/programs/witness_node/witness_node . COPY --from=deps /home/peerplays/peerplays/build/programs/cli_wallet/cli_wallet . +COPY --from=deps /home/peerplays/peerplays/genesis-mainet.json . # Peerplays RPC EXPOSE 8090 -- 2.45.2 From e5c1c3cd1b68da39156d450ccb6c6eaccecfa2b9 Mon Sep 17 00:00:00 2001 From: Rily Dunlap Date: Wed, 18 Jan 2023 19:05:30 +0000 Subject: [PATCH 4/5] added example.config.ini --- example.config.ini | 278 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 example.config.ini diff --git a/example.config.ini b/example.config.ini new file mode 100644 index 00000000..814a82f6 --- /dev/null +++ b/example.config.ini @@ -0,0 +1,278 @@ +# Endpoint for P2P node to listen on +p2p-endpoint = 0.0.0.0:9777 + +# P2P nodes to connect to on startup (may specify multiple times) +# seed-node = + +# JSON array of P2P nodes to connect to on startup +seed-nodes = ["51.222.110.110:9777","95.216.90.243:9777","ca.peerplays.info:9777","de.peerplays.xyz:9777","pl.peerplays.org:9777","seed.i9networks.net.br:9777","witness.serverpit.com:9777"] + +# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints. +# checkpoint = + +# Endpoint for websocket RPC to listen on +rpc-endpoint = 127.0.0.1:8090 + +# Endpoint for TLS websocket RPC to listen on +# rpc-tls-endpoint = + +# The TLS certificate file for this server +# server-pem = + +# Password for this certificate +# server-pem-password = + +# File to read Genesis State from +# genesis-json = + +# Block signing key to use for init witnesses, overrides genesis file +# dbg-init-key = + +# JSON file specifying API permissions +# api-access = + +# Whether to enable tracking of votes of standby witnesses and committee members. Set it to true to provide accurate data to API clients, set to false for slightly better performance. +# enable-standby-votes-tracking = + +# Space-separated list of plugins to activate +plugins = account_history accounts_list affiliate_stats bookie market_history witness + + +# ============================================================================== +# witness plugin options +# ============================================================================== + +# Enable block production, even if the chain is stale. +enable-stale-production = false + +# Percent of witnesses (0-99) that must be participating in order to produce blocks +required-participation = false + +# ID of witness controlled by this node (e.g. "1.6.5", quotes are required, may specify multiple times) +# witness-id = + +# IDs of multiple witnesses controlled by this node (e.g. ["1.6.5", "1.6.6"], quotes are required) +# witness-ids = + +# Tuple of [PublicKey, WIF private key] (may specify multiple times) +private-key = [] + + +# ============================================================================== +# debug_witness plugin options +# ============================================================================== + +# Tuple of [PublicKey, WIF private key] (may specify multiple times) +debug-private-key = [] + + +# ============================================================================== +# account_history plugin options +# ============================================================================== + +# Account ID to track history for (may specify multiple times) +# track-account = + +# Keep only those operations in memory that are related to account history tracking +partial-operations = 1 + +# Maximum number of operations per account will be kept in memory +max-ops-per-account = 100 + + +# ============================================================================== +# elasticsearch plugin options +# ============================================================================== + +# Elastic Search database node url(http://localhost:9200/) +# elasticsearch-node-url = + +# Number of bulk documents to index on replay(10000) +# elasticsearch-bulk-replay = + +# Number of bulk documents to index on a syncronied chain(100) +# elasticsearch-bulk-sync = + +# Use visitor to index additional data(slows down the replay(false)) +# elasticsearch-visitor = + +# Pass basic auth to elasticsearch database('') +# elasticsearch-basic-auth = + +# Add a prefix to the index(peerplays-) +# elasticsearch-index-prefix = + +# Save operation as object(true) +# elasticsearch-operation-object = + +# Start doing ES job after block(0) +# elasticsearch-start-es-after-block = + +# Save operation as string. Needed to serve history api calls(false) +# elasticsearch-operation-string = + +# Mode of operation: only_save(0), only_query(1), all(2) - Default: 0 +# elasticsearch-mode = + + +# ============================================================================== +# es_objects plugin options +# ============================================================================== + +# Elasticsearch node url(http://localhost:9200/) +# es-objects-elasticsearch-url = + +# Basic auth username:password('') +# es-objects-auth = + +# Number of bulk documents to index on replay(10000) +# es-objects-bulk-replay = + +# Number of bulk documents to index on a synchronized chain(100) +# es-objects-bulk-sync = + +# Store proposal objects(true) +# es-objects-proposals = + +# Store account objects(true) +# es-objects-accounts = + +# Store asset objects(true) +# es-objects-assets = + +# Store balances objects(true) +# es-objects-balances = + +# Store limit order objects(false) +# es-objects-limit-orders = + +# Store feed data(true) +# es-objects-bitasset = + +# Store account role objects (true) +# es-objects-account-role = + +# Store committee member objects(true) +# es-objects-committee-member = + +# Store nft objects (true) +# es-objects-nft = + +# Store son objects (true) +# es-objects-son = + +# Store transaction objects (true) +# es-objects-transaction = + +# Store vesting balance objects (true) +# es-objects-vesting-balance = + +# Store witness objects (true) +# es-objects-witness = + +# Store worker objects (true) +# es-objects-worker = + +# Add a prefix to the index(ppobjects-) +# es-objects-index-prefix = + +# Keep only current state of the objects(true) +# es-objects-keep-only-current = + +# Start doing ES job after block(0) +# es-objects-start-es-after-block = + + +# ============================================================================== +# market_history plugin options +# ============================================================================== + +# Track market history by grouping orders into buckets of equal size measured in seconds specified as a JSON array of numbers +bucket-size = [15,60,300,3600,86400] + +# How far back in time to track history for each bucket size, measured in the number of buckets (default: 1000) +history-per-size = 1000 + + +# ============================================================================== +# peerplays_sidechain plugin options +# ============================================================================== + +# ID of SON controlled by this node (e.g. "1.33.5", quotes are required) +# son-id = + +# IDs of multiple SONs controlled by this node (e.g. ["1.33.5", "1.33.6"], quotes are required) +# son-ids = + +# Tuple of [PublicKey, WIF private key] (may specify multiple times) +peerplays-private-key = [] + +# Sidechain retry throttling threshold +sidechain-retry-threshold = 150 + +# Outputs RPC calls to console +debug-rpc-calls = 0 + +# Bitcoin sidechain handler enabled +bitcoin-sidechain-enabled = 0 + +# IP address of Bitcoin node +bitcoin-node-ip = 127.0.0.1 + +# ZMQ port of Bitcoin node +bitcoin-node-zmq-port = 11111 + +# RPC port of Bitcoin node +bitcoin-node-rpc-port = 8332 + +# Bitcoin RPC user +bitcoin-node-rpc-user = changeme + +# Bitcoin RPC password +bitcoin-node-rpc-password = changeme + +# Bitcoin wallet +# bitcoin-wallet = + +# Bitcoin wallet password +# bitcoin-wallet-password = + +# Tuple of [Bitcoin public key, Bitcoin private key] (may specify multiple times) +bitcoin-private-key = [] + +# Hive sidechain handler enabled +hive-sidechain-enabled = 0 + +# Hive node RPC URL [http[s]://]host[:port] +hive-node-rpc-url = 127.0.0.1:28090 + +# Hive node RPC user +# hive-node-rpc-user = + +# Hive node RPC password +# hive-node-rpc-password = + +# Tuple of [Hive public key, Hive private key] (may specify multiple times) +hive-private-key = [] + + +# ============================================================================== +# snapshot plugin options +# ============================================================================== + +# Block number after which to do a snapshot +# snapshot-at-block = + +# Block time (ISO format) after which to do a snapshot +# snapshot-at-time = + +# Pathname of JSON file where to store the snapshot +# snapshot-to = + + +# ============================================================================== +# logging options +# ============================================================================== +# +# Logging configuration is loaded from logging.ini by default. +# If logging.ini exists, logging configuration added in this file will be ignored. -- 2.45.2 From f1f969b207cc1a03e6c6f8e84e74c56968f639c5 Mon Sep 17 00:00:00 2001 From: Rily Dunlap Date: Wed, 18 Jan 2023 20:05:57 +0000 Subject: [PATCH 5/5] Update Dockerfile - Creating witness_node_data_dir and taking example config.ini (will be used to mount so config can be changed on fly) --- docker/ubuntu20/Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docker/ubuntu20/Dockerfile b/docker/ubuntu20/Dockerfile index 3e7d2436..e1f7313d 100644 --- a/docker/ubuntu20/Dockerfile +++ b/docker/ubuntu20/Dockerfile @@ -37,6 +37,7 @@ RUN \ # Add local source ADD . peerplays + # Configure and build Peerplays RUN \ cd peerplays && \ @@ -50,14 +51,19 @@ RUN \ # Fresh image for running compiled binaries FROM ubuntu:20.04 +WORKDIR /home/peerplays/witness_node_data_dir/ +COPY --from=deps /home/peerplays/peerplays/example.config.ini /home/peerplays/witness_node_data_dir/config.ini + RUN apt update -y && \ DEBIAN_FRONTEND=noninteractive apt install -y \ curl \ + nano \ libzmq5 && \ groupadd peerplays && \ useradd -rm -d /home/peerplays -s /bin/bash -g peerplays -u 1000 peerplays && \ chown -R peerplays:peerplays /home/peerplays/ + USER peerplays WORKDIR /home/peerplays/ @@ -65,7 +71,7 @@ WORKDIR /home/peerplays/ # Copying the build artifacts from the above ubuntu-build image COPY --from=deps /home/peerplays/peerplays/build/programs/witness_node/witness_node . COPY --from=deps /home/peerplays/peerplays/build/programs/cli_wallet/cli_wallet . -COPY --from=deps /home/peerplays/peerplays/genesis-mainet.json . + # Peerplays RPC EXPOSE 8090 -- 2.45.2