diff --git a/docker/fullnode-x/README.md b/docker/fullnode-x/README.md new file mode 100644 index 0000000000000..d21a124e923e0 --- /dev/null +++ b/docker/fullnode-x/README.md @@ -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` diff --git a/docker/fullnode-x/docker-compose.yaml b/docker/fullnode-x/docker-compose.yaml new file mode 100644 index 0000000000000..a33e99c6d9ec1 --- /dev/null +++ b/docker/fullnode-x/docker-compose.yaml @@ -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 diff --git a/docker/fullnode-x/fullnode/config/.keep b/docker/fullnode-x/fullnode/config/.keep new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/docker/fullnode-x/fullnode/entry.sh b/docker/fullnode-x/fullnode/entry.sh new file mode 100755 index 0000000000000..b7a97141b937c --- /dev/null +++ b/docker/fullnode-x/fullnode/entry.sh @@ -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 + diff --git a/docker/fullnode-x/indexer/indexer.sh b/docker/fullnode-x/indexer/indexer.sh new file mode 100755 index 0000000000000..9020843922564 --- /dev/null +++ b/docker/fullnode-x/indexer/indexer.sh @@ -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} diff --git a/docker/fullnode-x/postgres/.keep b/docker/fullnode-x/postgres/.keep new file mode 100644 index 0000000000000..e69de29bb2d1d