From 1ebccbf74203948b9c0a29820ca93da1048cd0a6 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Wed, 14 Feb 2024 16:13:28 +0100 Subject: [PATCH] docker's not working, I'll just leave it here for now --- .dockerignore | 1 + .github/workflows/test.yml | 2 +- Dockerfile | 5 + docker-compose.yml | 53 +++++++-- util/node-config.toml | 238 +++++++++++++++++++++++++++++++++++++ 5 files changed, 289 insertions(+), 10 deletions(-) create mode 100644 Dockerfile create mode 100644 util/node-config.toml diff --git a/.dockerignore b/.dockerignore index e99d048..9fcf330 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ .tmp .git +*.gen.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2b24e27..fa6a548 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: pull_request: paths: - "realm/**" - - "packages/**" + - "package/**" - "Makefile" - "go.sum" push: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a370dd5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM ghcr.io/gnolang/gno:latest + +COPY ./util/node-config.toml ./gno.land/testdir/config/config.toml +COPY ./package ./examples/gno.land/p/demo/chess +COPY ./realm ./examples/gno.land/r/demo/chess diff --git a/docker-compose.yml b/docker-compose.yml index 797e574..3b50c44 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,18 +4,25 @@ volumes: gnonode: {} faucet: {} +networks: + gnochess: + enable_ipv6: false + services: gnoland: - build: ./util/gnolanddev + build: . + image: ghcr.io/gnolang/gnochess:latest environment: - LOG_LEVEL=4 - volumes: - - "gnonode:/opt/gno/src/testdir" - - "./util/gnolanddev/config.toml:/opt/gno/src/gno.land/testdir/config/config.toml" - - ".:/mnt" ports: - - 26657:26657 + - "26657:26657" restart: on-failure + working_dir: /opt/gno/src/gno.land + command: gnoland start + sysctls: + - net.ipv6.conf.all.disable_ipv6=1 + networks: + gnochess: logging: driver: "json-file" options: @@ -23,12 +30,17 @@ services: max-size: "100m" gnoweb: - image: ghcr.io/gnolang/gno:latest + build: . + image: ghcr.io/gnolang/gnochess:latest working_dir: /opt/gno/src/gno.land command: gnoweb -bind 0.0.0.0:8888 -remote gnoland:26657 + sysctls: + - net.ipv6.conf.all.disable_ipv6=1 ports: - - 8888:8888 + - "8888:8888" restart: on-failure + networks: + gnochess: logging: driver: "json-file" options: @@ -37,9 +49,14 @@ services: web: build: ./web + image: ghcr.io/gnolang/gnochess/web:latest + sysctls: + - net.ipv6.conf.all.disable_ipv6=1 ports: - - 1313:1313 + - "1313:1313" restart: on-failure + networks: + gnochess: logging: driver: "json-file" options: @@ -55,6 +72,10 @@ services: redis: image: "redis:7.2" + networks: + gnochess: + sysctls: + - net.ipv6.conf.all.disable_ipv6=1 ports: - "6379:6379" @@ -63,6 +84,8 @@ services: depends_on: - "redis" - "gnoland" + sysctls: + - net.ipv6.conf.all.disable_ipv6=1 command: - "go" - "run" @@ -79,11 +102,17 @@ services: volumes: - "faucet:/go" - "./faucet:/app" + ports: + - "5050:5050" + networks: + gnochess: signup-web: image: node command: ["yarn", "run", "dev", "--host=0.0.0.0", "--port=8080"] working_dir: "/app" + sysctls: + - net.ipv6.conf.all.disable_ipv6=1 volumes: - "./signup:/app" ports: @@ -91,10 +120,14 @@ services: environment: VITE_API_BASE_URL: "localhost:8080" VITE_NETLIFY_FUNCTIONS_URL: "http://localhost:9000" + networks: + gnochess: signup-functions: image: williamjackson/netlify-cli stop_grace_period: 500ms # XXX: improve by making this a dockerfile which has dumb-init + sysctls: + - net.ipv6.conf.all.disable_ipv6=1 depends_on: - redis command: ["functions:serve", "-f", "./functions", "-p", "9000"] @@ -106,3 +139,5 @@ services: environment: NODE_ENV: "development" REDIS_URL: "redis://redis:6379" + networks: + gnochess: diff --git a/util/node-config.toml b/util/node-config.toml new file mode 100644 index 0000000..c49ac4f --- /dev/null +++ b/util/node-config.toml @@ -0,0 +1,238 @@ +# This config is used in the Dockerfile to set up the default configuration. +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +##### main base config options ##### + +# TCP or UNIX socket address of the ABCI application, +# or the name of an ABCI application compiled in with the Tendermint binary +proxy_app = "tcp://127.0.0.1:26658" + +# A custom human readable name for this node +moniker = "45-79-178-97" + +# If this node is many blocks behind the tip of the chain, FastSync +# allows them to catchup quickly by downloading blocks in parallel +# and verifying their commits +fast_sync = true + +# Database backend: goleveldb | cleveldb | boltdb +# * goleveldb (github.com/gnolang/goleveldb, fork of github.com/syndtr/goleveldb) - most popular implementation) +# - pure go +# - stable +# * cleveldb (uses levigo wrapper) +# - fast +# - requires gcc +# - use cleveldb build tag (go build -tags cleveldb) +# * boltdb (uses etcd's fork of bolt - go.etcd.io/bbolt) +# - EXPERIMENTAL +# - may be faster is some use-cases (random reads - indexer) +# - use boltdb build tag (go build -tags boltdb) +db_backend = "goleveldb" + +# Database directory +db_dir = "data" + +# Output level for logging, including package level options +log_level = "main:info,state:info,*:error" + +# Output format: 'plain' (colored text) or 'json' +log_format = "plain" + +##### additional base config options ##### + +# Path to the JSON file containing the initial validator set and other meta data +genesis_file = "config/genesis.json" + +# Path to the JSON file containing the private key to use as a validator in the consensus protocol +priv_validator_key_file = "config/priv_validator_key.json" + +# Path to the JSON file containing the last sign state of a validator +priv_validator_state_file = "data/priv_validator_state.json" + +# TCP or UNIX socket address for Tendermint to listen on for +# connections from an external PrivValidator process +priv_validator_laddr = "" + +# Path to the JSON file containing the private key to use for node authentication in the p2p protocol +node_key_file = "config/node_key.json" + +# Mechanism to connect to the ABCI application: socket | grpc +abci = "socket" + +# TCP or UNIX socket address for the profiling server to listen on +prof_laddr = "" + +# If true, query the ABCI app on connecting to a new peer +# so the app can decide if we should keep the connection or not +filter_peers = false + +##### advanced configuration options ##### + +##### rpc server configuration options ##### +[rpc] + +# TCP or UNIX socket address for the RPC server to listen on +laddr = "tcp://0.0.0.0:26657" + +# A list of origins a cross-domain request can be executed from +# Default value '[]' disables cors support +# Use '["*"]' to allow any origin +cors_allowed_origins = ["*"] + +# A list of methods the client is allowed to use with cross-domain requests +cors_allowed_methods = ["HEAD", "GET", "POST", ] + +# A list of non simple headers the client is allowed to use with cross-domain requests +cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time", ] + +# TCP or UNIX socket address for the gRPC server to listen on +# NOTE: This server only supports /broadcast_tx_commit +grpc_laddr = "" + +# Maximum number of simultaneous connections. +# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} +# 1024 - 40 - 10 - 50 = 924 = ~900 +grpc_max_open_connections = 900 + +# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool +unsafe = false + +# Maximum number of simultaneous connections (including WebSocket). +# Does not include gRPC connections. See grpc_max_open_connections +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} +# 1024 - 40 - 10 - 50 = 924 = ~900 +max_open_connections = 900 + +# How long to wait for a tx to be committed during /broadcast_tx_commit. +# WARNING: Using a value larger than 10s will result in increasing the +# global HTTP write timeout, which applies to all connections and endpoints. +# See https://github.com/tendermint/classic/issues/3435 +timeout_broadcast_tx_commit = "10s" + +# Maximum size of request body, in bytes +max_body_bytes = 1000000 + +# Maximum size of request header, in bytes +max_header_bytes = 1048576 + +# The path to a file containing certificate that is used to create the HTTPS server. +# Might be either absolute path or path related to tendermint's config directory. +# If the certificate is signed by a certificate authority, +# the certFile should be the concatenation of the server's certificate, any intermediates, +# and the CA's certificate. +# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. Otherwise, HTTP server is run. +tls_cert_file = "" + +# The path to a file containing matching private key that is used to create the HTTPS server. +# Might be either absolute path or path related to tendermint's config directory. +# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. Otherwise, HTTP server is run. +tls_key_file = "" + +##### peer to peer configuration options ##### +[p2p] + +# Address to listen for incoming connections +laddr = "tcp://0.0.0.0:26656" + +# Address to advertise to peers for them to dial +# If empty, will use the same port as the laddr, +# and will introspect on the listener or use UPnP +# to figure out the address. +external_address = "" + +# Comma separated list of seed nodes to connect to +seeds = "" + +# Comma separated list of nodes to keep persistent connections to +persistent_peers = "" + +# UPNP port forwarding +upnp = false + +# Maximum number of inbound peers +max_num_inbound_peers = 40 + +# Maximum number of outbound peers to connect to, excluding persistent peers +max_num_outbound_peers = 10 + +# Time to wait before flushing messages out on the connection +flush_throttle_timeout = "100ms" + +# Maximum size of a message packet payload, in bytes +max_packet_msg_payload_size = 1024 + +# Rate at which packets can be sent, in bytes/second +send_rate = 5120000 + +# Rate at which packets can be received, in bytes/second +recv_rate = 5120000 + +# Set true to enable the peer-exchange reactor +pex = true + +# Seed mode, in which node constantly crawls the network and looks for +# peers. If another node asks it for addresses, it responds and disconnects. +# +# Does not work if the peer-exchange reactor is disabled. +seed_mode = false + +# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) +private_peer_ids = "" + +# Toggle to disable guard against peers connecting from the same ip. +allow_duplicate_ip = false + +# Peer connection configuration. +handshake_timeout = "20s" +dial_timeout = "3s" + +##### mempool configuration options ##### +[mempool] + +recheck = true +broadcast = true +wal_dir = "" + +# Maximum number of transactions in the mempool +size = 5000 + +# Limit the total size of all txs in the mempool. +# This only accounts for raw transactions (e.g. given 1MB transactions and +# max_txs_bytes=5MB, mempool will only accept 5 transactions). +max_pending_txs_bytes = 1073741824 + +# Size of the cache (used to filter transactions we saw earlier) in transactions +cache_size = 10000 + +##### consensus configuration options ##### +[consensus] + +wal_file = "data/cs.wal/wal" + +timeout_propose = "3s" +timeout_propose_delta = "500ms" +timeout_prevote = "1s" +timeout_prevote_delta = "500ms" +timeout_precommit = "1s" +timeout_precommit_delta = "500ms" +timeout_commit = "5s" + +# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) +skip_timeout_commit = false + +# EmptyBlocks mode and possible interval between empty blocks +create_empty_blocks = true +create_empty_blocks_interval = "0s" + +# Reactor sleep duration parameters +peer_gossip_sleep_duration = "100ms" +peer_query_maj23_sleep_duration = "2s" +