From 32cedb717d4a187640f1d3f45c5e127f8c076ee4 Mon Sep 17 00:00:00 2001
From: Slava <20563034+veaceslavdoina@users.noreply.github.com>
Date: Sun, 31 Mar 2024 01:45:40 +0200
Subject: [PATCH] Update geth sync check (#11)
* Update Geth sync check in docker-compose.yaml
* Update the guide
* Geth check service name and container name updated
---
README.md | 32 ++++++++++++++++++++++++--------
docker-compose.yaml | 27 +++++++++++++++++++--------
2 files changed, 43 insertions(+), 16 deletions(-)
diff --git a/README.md b/README.md
index 8c31ce7..c1f0fa3 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,14 @@ Hit the ground running with Codex.

Using the Testnet Starter, you can run a (mostly preconfigured) Codex node on your machine. You always have the option to build and run Codex from sources [Here](https://github.com/codex-storage/nim-codex/).
+### Links
+ - Codex Website - [codex.storage](https://codex.storage)
+ - Codex Whitepaper - [codex.storage](https://codex.storage)
+ - Codex API - [api.codex.storage](https://api.codex.storage)
+ - Codex Discord - [discord.gg/codex-storage](https://discord.gg/codex-storage)
+ - Block explorer - [explorer.testnet.codex.storage](https://explorer.testnet.codex.storage)
+ - Web wallet - [wallet.testnet.codex.storage](https://wallet.testnet.codex.storage)
+
## [How to start](#codex-testnet-starter)
1. [Have Docker with compose installed](https://docs.docker.com/engine/install/)
@@ -23,7 +31,7 @@ Using the Testnet Starter, you can run a (mostly preconfigured) Codex node on yo
git clone https://github.com/codex-storage/codex-testnet-starter && cd codex-testnet-starter
```
- 3. Create an Ethereum public/private key pair
+ 3. Create an Ethereum public/private key pair using [web wallet](https://wallet.testnet.codex.storage) or consider other local methods
Use Docker
@@ -34,7 +42,7 @@ Using the Testnet Starter, you can run a (mostly preconfigured) Codex node on yo
- Use metamask
+ Use MetaMask
1. [Accounts and Addresses](https://support.metamask.io/hc/en-us/sections/4471975962907-Accounts-and-Addresses)
2. [How to export an account's private key](https://support.metamask.io/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key)
@@ -133,15 +141,23 @@ Using the Testnet Starter, you can run a (mostly preconfigured) Codex node on yo
## [How to get ready](#codex-testnet-starter)
When starting the Testnet Starter for the first time, (or restarting after a long pause) please keep in mind:
- Your local Geth node will need time to sync.
-- Codex should automatically wait until Geth is ready. However, in some situations Codex will attempt to start too soon and promptly crash. This is a known issue. When this happens, please manually restart Codex's container when your Geth node is synced.
+- Geth checker will wait until Geth is in sync and only then Codex will start.
Before you can use the marketplace functionality of Codex, you will need to obtain some tokens in the testnet.
1. Join the [Codex Discord server](https://discord.gg/codex-storage)
-1. Find the appropriate testnet channel.
-1. Give your public key to the bot using `set` command.
-
-1. Ask it politely to mint some tokens for you using `mint` command.
-
+2. Find the appropriate testnet channel.
+3. Give your public key to the bot using `set` command.
+
+ example
+
+ 
+
+4. Ask it politely to mint some tokens for you using `mint` command.
+
+ example
+
+ 
+
(It may or may not happen in the future that testnet participation will be rewarded automatically with Discord server roles.)
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 69506a9..2a5ecad 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -40,9 +40,25 @@ services:
networks:
- codex
depends_on:
- geth:
+ geth-check:
condition: service_healthy
+ # Geth check
+ geth-check:
+ image: curlimages/curl
+ container_name: geth-check
+ command: sleep infinity
+ depends_on:
+ - geth
+ networks:
+ - codex
+ healthcheck:
+ test: |
+ curl -s -m 2 http://geth:8545 -XPOST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' | grep '"result":false'
+ interval: 5s
+ timeout: 3s
+ retries: 1000
+
# Geth init
geth-init:
image: ethereum/client-go:v1.13.14
@@ -66,10 +82,11 @@ services:
- GETH_NAT=${GETH_NAT:-auto}
- GETH_DISCOVERY_PORT=${GETH_DISCOVERY_PORT:-8547}
- GETH_PORT=${GETH_PORT:-8548}
- - GETH_VERBOSITY=${GETH_VERBOSITY:-2}
+ - GETH_VERBOSITY=${GETH_VERBOSITY:-3}
- GETH_HTTP=true
- GETH_HTTP_PORT=8545
- GETH_HTTP_ADDR=0.0.0.0
+ - GETH_HTTP_VHOSTS=*
- GETH_WS=true
- GETH_WS_PORT=8546
- GETH_WS_ADDR=0.0.0.0
@@ -90,12 +107,6 @@ services:
- geth-init
networks:
- codex
- healthcheck:
- test: ["CMD", "sleep", "15"]
- interval: 10s
- timeout: 60s
- retries: 100
- start_period: 1m
networks:
codex: