Closed alexcos20 closed 3 months ago
Clone the Repository
Clone the ocean-node
repository and switch to the develop
branch:
$ git clone https://github.com/oceanprotocol/ocean-node.git
$ cd ocean-node
$ git checkout develop
Setup Docker Compose
Ensure docker-compose.yml
is in the root directory (ocean-node
) and properly configured as per your requirements.
version: '3'
services:
ocean-node:
build:
context: .
dockerfile: Dockerfile
image: ocean-node:develop
container_name: ocean-node
restart: on-failure
ports:
- "9000:9000"
- "9001:9001"
- "9002:9002"
- "9003:9003"
- "8000:8000"
networks:
- backend
depends_on:
- typesense
environment:
PRIVATE_KEY: '<your private key>'
RPCS: '{"1":{"rpc":"https://rpc.eth.gateway.fm","chainId":1,"network":"mainet","chunkSize":100},"137":{"rpc":"https://polygon.meowrpc.com","chainId":137,"network":"polygon","chunkSize":100},"80001":{"rpc":"https://rpc-mumbai.maticvigil.com","chainId":80001,"network":"polygon-mumbai","chunkSize":100}}'
INTERFACES: '["HTTP","P2P"]'
ALLOWED_VALIDATORS: '["0x123","0x456"]'
DB_URL: "http://typesense:8108/?apiKey=xyz"
INDEXER_INTERVAL: "10000"
FEE_TOKENS: '{"1": "0x967da4048cD07aB37855c090aAF366e4ce1b9F48", "137": "0x282d8efCe846A88B159800bd4130ad77443Fa1A1", "80001": "0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8", "56": "0xDCe07662CA8EbC241316a15B611c89711414Dd1a"}'
FEE_AMOUNT: '{"amount": 1, "unit": "MB"}'
IPFS_GATEWAY: "https://ipfs.io/"
ARWEAVE_GATEWAY: "https://arweave.net/"
P2P_ipV4BindTcpPort: "9000"
P2P_ipV4BindWsPort: "9001"
P2P_ipV6BindTcpPort: "9002"
P2P_ipV6BindWsPort: "9003"
HTTP_API_PORT: "8000"
typesense:
image: typesense/typesense:0.25.2-amd64
container_name: typesense
restart: on-failure
ports:
- "8108:8108"
networks:
- backend
volumes:
- typesense-data:/data
command: '--data-dir /data --api-key=xyz'
volumes:
typesense-data:
driver: local
networks:
backend:
driver: bridge
Build and Run
Build the Docker image and start the services defined in docker-compose.yml
:
$ docker-compose up --build
This command builds the Docker image and starts the services.
Note: adding -d
option will start the services in detached mode.
$ docker-compose up --build -d
```shell
$ docker-compose up --build
[+] Running 5/5
✔ typesense 4 layers [⣿⣿⣿⣿] 0B/0B Pulled 15.0s
✔ a48641193673 Pull complete 0.7s
✔ 8c77ed25f53d Pull complete 0.7s
✔ 4f4fb700ef54 Pull complete 0.3s
✔ f3c03680c3b6 Pull complete 2.4s
[+] Building 255.2s (19/19) FINISHED docker:default
=> [ocean-node internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.23kB 0.0s
=> [ocean-node internal] load metadata for docker.io/library/ubuntu:22.04 1.2s
=> [ocean-node internal] load .dockerignore 0.0s
=> => transferring context: 78B 0.0s
=> [ocean-node base 1/6] FROM docker.io/library/ubuntu:22.04@sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b26bd5554491f0da 3.0s
=> => resolve docker.io/library/ubuntu:22.04@sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b26bd5554491f0da 0.0s
=> => sha256:3db8720ecbf5f5927d409cc61f9b4f7ffe23283917caaa992f847c4d83338cc1 2.30kB / 2.30kB 0.0s
=> => sha256:01007420e9b005dc14a8c8b0f996a2ad8e0d4af6c3d01e62f123be14fe48eec7 29.54MB / 29.54MB 0.6s
=> => sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b26bd5554491f0da 1.13kB / 1.13kB 0.0s
=> => sha256:81bba8d1dde7fc1883b6e95cd46d6c9f4874374f2b360c8db82620b33f6b5ca1 424B / 424B 0.0s
=> => extracting sha256:01007420e9b005dc14a8c8b0f996a2ad8e0d4af6c3d01e62f123be14fe48eec7 2.1s
=> [ocean-node internal] load build context 0.2s
=> => transferring context: 5.83MB 0.1s
=> [ocean-node base 2/6] RUN apt-get update && apt-get -y install bash curl 12.8s
=> [ocean-node base 3/6] COPY .nvmrc /usr/src/app/ 0.0s
=> [ocean-node base 4/6] RUN rm /bin/sh && ln -s /bin/bash /bin/sh 0.3s
=> [ocean-node base 5/6] RUN mkdir /usr/local/nvm 0.4s
=> [ocean-node base 6/6] RUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash && source /usr/local/nvm/nvm.sh && nvm install v18.19.0 && nvm alias default v18.19.0 && nvm use default 9.3s
=> [ocean-node builder 1/4] RUN apt-get update && apt-get -y install wget 5.4s
=> [ocean-node runner 1/4] COPY . /usr/src/app 0.3s
=> [ocean-node runner 2/4] WORKDIR /usr/src/app/ 0.0s
=> [ocean-node builder 2/4] COPY package*.json /usr/src/app/ 0.1s
=> [ocean-node builder 3/4] WORKDIR /usr/src/app/ 0.0s
=> [ocean-node builder 4/4] RUN npm ci 137.1s
=> [ocean-node runner 3/4] COPY --from=builder /usr/src/app/node_modules/ /usr/src/app/node_modules/ 18.3s
=> [ocean-node runner 4/4] RUN npm run build 13.6s
=> [ocean-node] exporting to image 13.6s
=> => exporting layers 13.6s
=> => writing image sha256:b9ba306290bb79f41c0ab38ced4d52e478b7786551343282251ecbc3db012447 0.0s
=> => naming to docker.io/library/ocean-node:develop 0.0s
[+] Running 4/3
✔ Network ocean-node_backend Created 0.2s
✔ Volume "ocean-node_typesense-data" Created 0.0s
✔ Container typesense Created 0.6s
✔ Container ocean-node Created 0.0s
Attaching to ocean-node, typesense
ocean-node |
ocean-node | > Ocean-Node@1.0.0 start
ocean-node | > node --trace-warnings --experimental-specifier-resolution=node dist/index.js
ocean-node |
ocean-node | (node:17) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
ocean-node | at new ModuleLoader (node:internal/modules/esm/loader:141:15)
ocean-node | at createModuleLoader (node:internal/modules/esm/loader:547:10)
ocean-node | at loadESM (node:internal/process/esm_loader:21:19)
ocean-node | at runMainESM (node:internal/modules/run_main:91:21)
ocean-node | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:124:5)
ocean-node | at node:internal/main/run_main_module:28:49
ocean-node | (node:17) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
ocean-node | at emitExperimentalWarning (node:internal/util:274:11)
ocean-node | at ModuleLoader.jsonStrategy (node:internal/modules/esm/translators:307:3)
ocean-node | at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14)
typesense | I20240304 01:11:47.648973 1 typesense_server_utils.cpp:334] Starting Typesense 0.25.2
typesense | I20240304 01:11:47.649091 1 typesense_server_utils.cpp:337] Typesense is using jemalloc.
typesense | I20240304 01:11:47.649665 1 typesense_server_utils.cpp:387] Thread pool size: 16
typesense | I20240304 01:11:47.691428 1 store.h:64] Initializing DB by opening state dir: /data/db
typesense | I20240304 01:11:47.845573 1 store.h:64] Initializing DB by opening state dir: /data/meta
typesense | I20240304 01:11:48.029429 1 ratelimit_manager.cpp:546] Loaded 0 rate limit rules.
typesense | I20240304 01:11:48.029495 1 ratelimit_manager.cpp:547] Loaded 0 rate limit bans.
typesense | I20240304 01:11:48.029791 1 typesense_server_utils.cpp:507] Starting API service...
typesense | I20240304 01:11:48.031157 1 http_server.cpp:178] Typesense has started listening on port 8108
typesense | I20240304 01:11:48.031431 118 typesense_server_utils.cpp:235] Since no --nodes argument is provided, starting a single node Typesense cluster.
typesense | I20240304 01:11:48.031471 119 batched_indexer.cpp:124] Starting batch indexer with 16 threads.
typesense | I20240304 01:11:48.032816 119 batched_indexer.cpp:129] BatchedIndexer skip_index: -9999
typesense | I20240304 01:11:48.087600 118 server.cpp:1107] Server[braft::RaftStatImpl+braft::FileServiceImpl+braft::RaftServiceImpl+braft::CliServiceImpl] is serving on port=8107.
typesense | I20240304 01:11:48.091957 118 server.cpp:1110] Check out http://4e83a8b80088:8107 in web browser.
typesense | I20240304 01:11:48.096307 118 raft_server.cpp:68] Nodes configuration: 172.24.0.2:8107:8108
typesense | I20240304 01:11:48.096396 118 raft_server.cpp:111] Snapshot does not exist. We will remove db dir and init db fresh.
typesense | I20240304 01:11:48.097272 118 store.h:299] rm /data/db success
typesense | I20240304 01:11:48.097380 118 store.h:64] Initializing DB by opening state dir: /data/db
typesense | I20240304 01:11:48.128657 118 store.h:323] DB open success!
typesense | I20240304 01:11:48.128705 118 raft_server.cpp:501] Loading collections from disk...
typesense | I20240304 01:11:48.129644 118 collection_manager.cpp:187] CollectionManager::load()
typesense | I20240304 01:11:48.130111 118 auth_manager.cpp:34] Indexing 0 API key(s) found on disk.
typesense | I20240304 01:11:48.130467 118 collection_manager.cpp:207] Loading upto 8 collections in parallel, 1000 documents at a time.
typesense | I20240304 01:11:48.130838 118 collection_manager.cpp:216] Found 0 collection(s) on disk.
typesense | I20240304 01:11:48.131659 118 collection_manager.cpp:316] Loaded 0 collection(s).
typesense | I20240304 01:11:48.132295 118 collection_manager.cpp:320] Initializing batched indexer from snapshot state...
typesense | I20240304 01:11:48.132453 118 raft_server.cpp:508] Finished loading collections from disk.
typesense | I20240304 01:11:48.133747 118 log.cpp:690] Use murmurhash32 as the checksum type of appending entries
typesense | W20240304 01:11:48.133905 118 protobuf_file.cpp:91] open file failed, path: /data/state/log/log_meta: FILE_ERROR_NOT_FOUND
typesense | W20240304 01:11:48.134056 118 log.cpp:698] /data/state/log is empty
typesense | I20240304 01:11:48.137255 118 log.cpp:1150] log save_meta /data/state/log/log_meta first_log_index: 1 time: 2834
typesense | W20240304 01:11:48.137933 118 protobuf_file.cpp:91] open file failed, path: /data/state/meta/raft_meta: FILE_ERROR_NOT_FOUND
typesense | I20240304 01:11:48.138156 118 raft_meta.cpp:521] Loaded single stable meta, path /data/state/meta term 1 votedfor 0.0.0.0:0:0 time: 176
typesense | I20240304 01:11:48.138537 118 node.cpp:608] node default_group:172.24.0.2:8107:8108 init, term: 1 last_log_id: (index=0,term=0) conf: 172.24.0.2:8107:8108 old_conf:
typesense | I20240304 01:11:48.138875 118 node.cpp:1645] node default_group:172.24.0.2:8107:8108 term 1 start vote and grant vote self
typesense | I20240304 01:11:48.150010 118 raft_meta.cpp:546] Saved single stable meta, path /data/state/meta term 2 votedfor 172.24.0.2:8107:8108 time: 10848
typesense | I20240304 01:11:48.150091 118 node.cpp:1899] node default_group:172.24.0.2:8107:8108 term 2 become leader of group 172.24.0.2:8107:8108
typesense | I20240304 01:11:48.151216 118 raft_server.cpp:134] Node last_index: 0
typesense | I20240304 01:11:48.151279 118 typesense_server_utils.cpp:283] Typesense peering service is running on 172.24.0.2:8107
typesense | I20240304 01:11:48.151309 118 typesense_server_utils.cpp:284] Snapshot interval configured as: 3600s
typesense | I20240304 01:11:48.151326 118 typesense_server_utils.cpp:285] Snapshot max byte count configured as: 4194304
typesense | W20240304 01:11:48.151350 118 controller.cpp:1487] SIGINT was installed with 1
typesense | I20240304 01:11:48.151389 118 raft_server.cpp:557] Term: 2, pending_queue: 1, last_index: 0, committed: 0, known_applied: 0, applying: 0, pending_writes: 0, queued_writes: 0, local_sequence: 0
typesense | W20240304 01:11:48.151410 118 node.cpp:843] [default_group:172.24.0.2:8107:8108 ] Refusing concurrent configuration changing
typesense | E20240304 01:11:48.151450 118 raft_server.cpp:613] Node not ready yet (known_applied_index is 0).
typesense | I20240304 01:11:48.151456 146 log.cpp:114] Created new segment `/data/state/log/log_inprogress_00000000000000000001' with fd=23
typesense | E20240304 01:11:48.151726 142 raft_server.h:62] Peer refresh failed, error: Doing another configuration change
typesense | I20240304 01:11:48.154400 146 raft_server.h:285] Configuration of this group is 172.24.0.2:8107:8108
typesense | I20240304 01:11:48.154460 146 node.cpp:3298] node default_group:172.24.0.2:8107:8108 reset ConfigurationCtx, new_peers: 172.24.0.2:8107:8108, old_peers: 172.24.0.2:8107:8108
typesense | I20240304 01:11:48.186895 146 raft_server.h:268] Node becomes leader, term: 2
ocean-node | secp256k1 unavailable, reverting to browser version
ocean-node | {
ocean-node | component: 'CONFIG',
ocean-node | moduleName: 'CONFIG',
ocean-node | level: 'error',
ocean-node | message: '[CONFIG] => ❌ [CONFIG] => Missing or Invalid address in ALLOWED_VALIDATORS env variable',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'CORE',
ocean-node | moduleName: 'CORE',
ocean-node | level: 'error',
ocean-node | message: "[CORE] => Error: ENOENT: no such file or directory, open '/root/.ocean/ocean-contracts/artifacts/address.json'",
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node |
ocean-node |
ocean-node |
ocean-node |
ocean-node |
ocean-node | {
ocean-node | component: 'OCEANNODE',
ocean-node | moduleName: 'OCEANNODE',
ocean-node | level: 'info',
ocean-node | message: '[OCEANNODE] => 🌊 [OCEANNODE] => [ Starting Ocean Node ]',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'CONFIG',
ocean-node | moduleName: 'CONFIG',
ocean-node | level: 'info',
ocean-node | message: '[CONFIG] => ✅ [CONFIG] => Starting node with peerID: 16Uiu2HAm6u88XuC4Xke7J9NmT7qLNL4zMYEyLxqdVgAc7Rnr95o6',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'CONFIG',
ocean-node | moduleName: 'CONFIG',
ocean-node | level: 'warn',
ocean-node | message: '[CONFIG] => ⚠ ️ [CONFIG] => Invalid or missing "AUTHORIZED_DECRYPTERS" env variable...',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'CONFIG',
ocean-node | moduleName: 'CONFIG',
ocean-node | level: 'error',
ocean-node | message: '[CONFIG] => ❌ [CONFIG] => Missing or Invalid address in ALLOWED_VALIDATORS env variable',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'CONFIG',
ocean-node | moduleName: 'CONFIG',
ocean-node | level: 'warn',
ocean-node | message: '[CONFIG] => Missing "FEE_AMOUNT" env variable. Will use defaults...',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'CONFIG',
ocean-node | moduleName: 'CONFIG',
ocean-node | level: 'warn',
ocean-node | message: '[CONFIG] => Missing "FEE_TOKENS" env variable. Will use defaults...',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'CORE',
ocean-node | moduleName: 'CORE',
ocean-node | level: 'error',
ocean-node | message: "[CORE] => Error: ENOENT: no such file or directory, open '/root/.ocean/ocean-contracts/artifacts/address.json'",
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'CONFIG',
ocean-node | moduleName: 'CONFIG',
ocean-node | level: 'warn',
ocean-node | message: '[CONFIG] => ⚠ ️ [CONFIG] => Invalid or missing "OPERATOR_SERVICE_URL" env variable...',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | Request /collections/order
ocean-node | Request /collections/order: Attempting GET request Try #1 to Node typesense
ocean-node | Request /collections/order: Request to Node typesense was made. Response Code was 503.
ocean-node | Request /collections/order: Request to Node typesense failed due to "undefined Not Ready or Lagging"
ocean-node | Request /collections/order: Sleeping for 0.1s and then retrying request...
ocean-node | Request /collections/order: Attempting GET request Try #2 to Node typesense
ocean-node | Request /collections/order: Request to Node typesense was made. Response Code was 503.
ocean-node | Request /collections/order: Request to Node typesense failed due to "undefined Not Ready or Lagging"
ocean-node | Request /collections/order: Sleeping for 0.1s and then retrying request...
ocean-node | Request /collections/order: Attempting GET request Try #3 to Node typesense
ocean-node | Request /collections/order: Request to Node typesense was made. Response Code was 503.
ocean-node | Request /collections/order: Request to Node typesense failed due to "undefined Not Ready or Lagging"
ocean-node | Request /collections/order: Sleeping for 0.1s and then retrying request...
ocean-node | Request /collections/order: Attempting GET request Try #4 to Node typesense
ocean-node | Request /collections/order: Request to Node typesense was made. Response Code was 503.
ocean-node | Request /collections/order: Request to Node typesense failed due to "undefined Not Ready or Lagging"
ocean-node | Request /collections/order: Sleeping for 0.1s and then retrying request...
ocean-node | Request: No retries left. Raising last error
ocean-node | {
ocean-node | component: 'OCEANNODE',
ocean-node | moduleName: 'OCEANNODE',
ocean-node | level: 'info',
ocean-node | message: '[OCEANNODE] => [OCEANNODE] => HTTP port: 8000',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'DATABASE',
ocean-node | moduleName: 'DATABASE',
ocean-node | level: 'error',
ocean-node | message: '[DATABASE] => ❌ [DATABASE] => Error when retrieving indexer entry on network 1: Not Ready or Lagging',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'INDEXER',
ocean-node | moduleName: 'INDEXER',
ocean-node | level: 'info',
ocean-node | message: '[INDEXER] => Starting worker for network 1 with {"rpcDetails":{"rpc":"https://rpc.eth.gateway.fm","chainId":1,"network":"mainet","chunkSize":100}}',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'DATABASE',
ocean-node | moduleName: 'DATABASE',
ocean-node | level: 'error',
ocean-node | message: '[DATABASE] => ❌ [DATABASE] => Error when retrieving indexer entry on network 137: Not Ready or Lagging',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'INDEXER',
ocean-node | moduleName: 'INDEXER',
ocean-node | level: 'info',
ocean-node | message: '[INDEXER] => Starting worker for network 137 with {"rpcDetails":{"rpc":"https://polygon.meowrpc.com","chainId":137,"network":"polygon","chunkSize":100}}',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'DATABASE',
ocean-node | moduleName: 'DATABASE',
ocean-node | level: 'error',
ocean-node | message: '[DATABASE] => ❌ [DATABASE] => Error when retrieving indexer entry on network 80001: Not Ready or Lagging',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | {
ocean-node | component: 'INDEXER',
ocean-node | moduleName: 'INDEXER',
ocean-node | level: 'info',
ocean-node | message: '[INDEXER] => Starting worker for network 80001 with {"rpcDetails":{"rpc":"https://rpc-mumbai.maticvigil.com","chainId":80001,"network":"polygon-mumbai","chunkSize":100}}',
ocean-node | timestamp: '2024-03-04 01:11:49'
ocean-node | }
ocean-node | (node:17) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
ocean-node | at new ModuleLoader (node:internal/modules/esm/loader:141:15)
ocean-node | at createModuleLoader (node:internal/modules/esm/loader:547:10)
ocean-node | at loadESM (node:internal/process/esm_loader:21:19)
ocean-node | at runMainESM (node:internal/modules/run_main:91:21)
ocean-node | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:124:5)
ocean-node | at MessagePort.
Check the containers status:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4fc153a6447 ocean-node:develop "npm run start" 22 minutes ago Up 9 seconds 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9000-9003->9000-9003/tcp, :::9000-9003->9000-9003/tcp ocean-node
fd1d487b722c typesense/typesense:0.25.2-amd64 "/opt/typesense-serv…" 22 minutes ago Up 10 seconds 0.0.0.0:8108->8108/tcp, :::8108->8108/tcp typesense
Review the .env
file or Docker Compose configuration for any necessary adjustments to the environment variables based on your specific setup.
In addition, have:
[ ] 2 nodes (without Circuit Relay) to index: Eth, Polygon, Optimism, Sapphire)
[ ] 2 nodes (without Circuit Relay) to index testnets: Eth Sepolia, Sapphire testnet
Let's deploy ocean-node:
DNS entries: