forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding fullnode x docker compose example (MystenLabs#9637)
## Description This is a docker compose configuration and some instructions for running the fullnode+indexer+Pg locally on a desktop/laptop. ## Test Plan Just verified it starts up and catches up with the network epoch.
- Loading branch information
1 parent
0e5dfca
commit d0e0f68
Showing
6 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
0. Build the containers locally to your desktop/laptop with: | ||
- `docker compose build` | ||
- The build process can take a while to complete. | ||
|
||
1. First start postgres so you can create the DB with the `diesel` command: | ||
- `docker compose up postgres -d` | ||
* **Note** that postgres will store its db data in `./postgres/data` | ||
- `psql -U postgres -p 5432 -h localhost -c 'create database sui_indexer_testnet'` | ||
- run these in sui.git/crates/sui-indexer: | ||
* `diesel setup --database-url=postgres://postgres:admin@localhost:5432/sui_indexer_testnet` | ||
|
||
2. Copy the fullnode.yaml and genesis.blob files for the network to use and put them in the `fullnode/config/` folder. | ||
|
||
3. `docker compose up fullnode -d` | ||
- verify it's working by watching the logs with `docker compose logs fullnode -f` | ||
|
||
4. Once the full node is working, then start indexer with: `docker compose up indexer -d` | ||
|
||
- You will see the indexer catching up checkpoint by checkpoint until it's up to date and ready to serve requests. | ||
`docker compose logs indexer | tail -30` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
version: "3.9" | ||
|
||
services: | ||
|
||
fullnode: | ||
build: | ||
context: ../.. | ||
dockerfile: ./docker/sui-node/Dockerfile | ||
args: | ||
# update with git sha of whichever branch you're building on. | ||
GIT_REVISION: db24658bc9 | ||
BUILD_DATE: today | ||
|
||
environment: | ||
- LD_PRELOAD | ||
- RUST_JSON_LOG="true" | ||
- RUST_LOG="info" | ||
# don't use debug, it generates volumes of data. | ||
image: sui-node:latest | ||
command: /opt/sui/entry.sh | ||
restart: unless-stopped | ||
# populate your local ./fullnode/config/ directory with fullnode.yaml and genesis.blob for the network you want to use. | ||
volumes: | ||
- ./fullnode:/opt/sui | ||
ports: | ||
- 9000 | ||
- 9184 | ||
- target: 8084 | ||
published: 8084 | ||
protocol: udp | ||
|
||
indexer: | ||
build: | ||
context: ../.. | ||
dockerfile: ./docker/sui-indexer/Dockerfile | ||
image: sui-indexer:latest | ||
command: /opt/sui/indexer.sh | ||
restart: unless-stopped | ||
volumes: | ||
- ./indexer:/opt/sui | ||
environment: | ||
- RUST_LOG="info" | ||
- RUST_JSON_LOG="true" | ||
- DATABASE_URL=postgres://postgres:admin@postgres:5432/sui_indexer_testnet | ||
- RPC_CLIENT_URL=http://fullnode:9000 | ||
ports: | ||
- target: 9000 | ||
published: 9000 | ||
protocol: tcp | ||
- 9184 | ||
depends_on: | ||
- postgres | ||
- fullnode | ||
|
||
postgres: | ||
image: postgres:15 | ||
restart: unless-stopped | ||
environment: | ||
- POSTGRES_PASSWORD=admin | ||
ports: | ||
- target: 5432 | ||
published: 5432 | ||
volumes: | ||
- ./postgres/data:/var/lib/postgresql/data |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# Copyright (c) Mysten Labs, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
unset LD_PRELOAD | ||
|
||
/usr/local/bin/sui-node --config-path /opt/sui/config/fullnode.yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# Copyright (c) Mysten Labs, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
/usr/local/bin/sui-indexer --db-url ${DATABASE_URL} --rpc-client-url ${RPC_CLIENT_URL} |
Empty file.