From 6f9d3b0e4a18765b77efcc9e2fd9e41760af430f Mon Sep 17 00:00:00 2001 From: Sean Kwak Date: Fri, 31 Oct 2025 00:11:27 +0000 Subject: [PATCH 1/4] feat: Add indexer-standalone support - Add indexer-standalone service to compose.yml - Generate and manage indexer secret in .envrc - Add INDEXER_IMAGE to qanet and testnet-02 environments - Create new preview environment configuration - Update README to document indexer integration - Add indexer.secret to .gitignore --- .envrc | 7 +++++++ .envrc.preview | 7 +++++++ .envrc.qanet | 1 + .envrc.testnet-02 | 3 ++- .gitignore | 1 + README.md | 11 ++++++++--- compose.yml | 23 +++++++++++++++++++++++ 7 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 .envrc.preview diff --git a/.envrc b/.envrc index c642786..a097242 100644 --- a/.envrc +++ b/.envrc @@ -46,6 +46,13 @@ if [ ! -f node.privatekey ]; then fi export NODE_KEY="$(cat ./midnight-node.privatekey)" +# Indexer Values: +if [ ! -f indexer.secret ]; then + # Generate 32-byte hex secret for indexer + openssl rand -hex 32 > indexer.secret +fi +export INDEXER_SECRET="$(cat ./indexer.secret)" + # # Partner chains config: # diff --git a/.envrc.preview b/.envrc.preview new file mode 100644 index 0000000..c02fe43 --- /dev/null +++ b/.envrc.preview @@ -0,0 +1,7 @@ +# overrides for preview +export MIDNIGHT_NODE_IMAGE="ghcr.io/midnight-ntwrk/midnight-node:0.17.0-rc.4" +export INDEXER_IMAGE="ghcr.io/midnight-ntwrk/indexer-standalone:3.0.0-alpha.5" + +# Well known addresses of network that allow discovery of all other nodes. +export BOOTNODES="/dns/midnight-node-boot-01/tcp/30333/ws/p2p/12D3KooWK66i7dtGVNSwDh9tTeqov1q6LSdWsRLJvTyzTCaywYgK \ +/dns/midnight-node-boot-02/tcp/30333/ws/p2p/12D3KooWHqFfXFwb7WW4jwR8pr4BEf562v5M6c8K3CXAJq4Wx6ym" \ No newline at end of file diff --git a/.envrc.qanet b/.envrc.qanet index 4e493aa..13da85f 100644 --- a/.envrc.qanet +++ b/.envrc.qanet @@ -1,5 +1,6 @@ # overrides for qanet export MIDNIGHT_NODE_IMAGE="ghcr.io/midnight-ntwrk/midnight-node:0.12.0-rc.3" +export INDEXER_IMAGE="ghcr.io/midnight-ntwrk/indexer-standalone:2.1.4" # Well known addresses of network that allow discovery of all other nodes. export BOOTNODES="/dns/boot-node-01.qanet.dev.midnight.network/tcp/30333/ws/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp \ diff --git a/.envrc.testnet-02 b/.envrc.testnet-02 index 2d5e64a..3346998 100644 --- a/.envrc.testnet-02 +++ b/.envrc.testnet-02 @@ -1,5 +1,6 @@ # overrides for testnet-02 -export MIDNIGHT_NODE_IMAGE="midnightnetwork/midnight-node:0.12.0" +export MIDNIGHT_NODE_IMAGE="midnightnetwork/midnight-node:0.12.1" +export INDEXER_IMAGE="ghcr.io/midnight-ntwrk/indexer-standalone:2.1.4" # These are well known addresses of a network that allow you to discover all the other nodes. export BOOTNODES="/dns/boot-node-01.testnet-02.midnight.network/tcp/30333/ws/p2p/12D3KooWMjUq13USCvQR9Y6yFzYNYgTQBLNAcmc8psAuPx2UUdnB \ diff --git a/.gitignore b/.gitignore index 2cbdf12..e58663d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /data *.privatekey *.password +*.secret ogmios_client.log diff --git a/README.md b/README.md index 2a68a1e..6c88c65 100644 --- a/README.md +++ b/README.md @@ -12,17 +12,22 @@ This allows for easy orchestration of the Midnight Node service. 1. Clone repository -2. In `.envrc` set CFG_PRESET to be the environment you wish to point to (E.g. testnet-02). +2. In `.envrc` set CFG_PRESET to be the environment you wish to point to. Available options: + - `qanet` - QA network + - `testnet-02` - TestNet 02 + - `preview` - Preview network 3. run `direnv allow` to load the environment variables 4. Run `docker-compose up` -The `.envrc` file will automatically create a random private key and save it as `midnight-node.privatekey`. +The `.envrc` file will automatically create a random private key and save it as `midnight-node.privatekey` and a random secret for the indexer saved as `indexer.secret`. + +The default `compose.yml` now includes both the Midnight Node and Indexer Standalone, providing a GraphQL API at `http://localhost:8088`. Choose which compose files to use: -- `compose.yml` for Midnight Node +- `compose.yml` for Midnight Node + Indexer - `compose-partner-chains.yml` for Cardano + DB Sync - `proof-server.yml` for Local Proof Server diff --git a/compose.yml b/compose.yml index af88c53..b1c2673 100644 --- a/compose.yml +++ b/compose.yml @@ -15,6 +15,7 @@ volumes: midnight-data-testnet: {} + indexer-data: {} services: midnight-node-testnet: @@ -38,3 +39,25 @@ services: - ./data:/data - ./envs/${CFG_PRESET}/pc-chain-config.json:/pc-chain-config.json - midnight-data-testnet:/node + + indexer-standalone: + container_name: indexer + restart: unless-stopped + image: ${INDEXER_IMAGE} + ports: + - "8088:8088" # GraphQL API + environment: + - APP__APPLICATION__NETWORK_ID=${CFG_PRESET} + - APP__INFRA__NODE__URL=ws://midnight-node:9944 + - APP__INFRA__STORAGE__CNN_URL=/data/indexer.sqlite + - APP__INFRA__SECRET=${INDEXER_SECRET} + depends_on: + midnight-node-testnet: + condition: service_healthy + volumes: + - indexer-data:/data + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost:8088/health" ] + interval: 5s + timeout: 3s + retries: 5 From 6e9be7d6bd43632ca40901db4c76c88cffce1011 Mon Sep 17 00:00:00 2001 From: Sean Kwak Date: Fri, 31 Oct 2025 12:57:45 +0000 Subject: [PATCH 2/4] feat: Add Cardano stack for midnight-node operation Add cardano-node and cardano-db-sync services to support midnight-node's main chain follower. Midnight-node requires access to Cardano blockchain data via PostgreSQL populated by cardano-db-sync. Services added: - cardano-node: Connects to Cardano preview network, provides blockchain data - cardano-db-sync: Syncs Cardano data to PostgreSQL (cexplorer database) Changes: - Added cardano-ipc and db-sync-data volumes for inter-service communication - Updated midnight-node-testnet to depend on cardano-db-sync - Created cardano-data/ directory for persistent node data - Set indexer APP__APPLICATION__NETWORK_ID=TestNet to match testnet-02 - Added interactions/ to .git/info/exclude Known issue - indexer version incompatibility: - Indexer 2.1.4 expects "Undeployed" network but testnet-02 uses "TestNet" - This is a version compatibility issue, not configuration - Cardano stack works correctly; indexer needs compatible version Other limitations: - Cardano sync takes significant time (hours to days for full sync) - Midnight-node shows verification errors until db-sync catches up Related: PM-20249 --- .envrc | 31 ++++++++++++++----- .envrc.preview | 4 +++ .envrc.qanet | 4 +++ .envrc.testnet-02 | 4 +++ compose.yml | 78 +++++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 107 insertions(+), 14 deletions(-) diff --git a/.envrc b/.envrc index a097242..17aabbf 100644 --- a/.envrc +++ b/.envrc @@ -29,20 +29,17 @@ export POSTGRES_PASSWORD="$(cat ./postgres.password)" export POSTGRES_DB="cexplorer" -# We bring together the above variables into a database connection string: -export DB_SYNC_POSTGRES_CONNECTION_STRING="psql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB" - # To start with debug logs, add "-l debug" to APPEND_ARGS # To expose safe rpc method to the host port 9944, add "--unsafe-rpc-external" to APPEND_ARGS or --validator export APPEND_ARGS="--allow-private-ip --pool-limit 10 --trie-cache-size 0 --prometheus-external --rpc-external --rpc-cors all" -# Validator Values: -if [ ! -f node.privatekey ]; then - # generate node key like this: - DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -it docker.io/parity/subkey:latest generate-node-key | sed -n '2p' > midnight-node.privatekey - # Use the second line of output for NODE_KEY (that's what sed -n '2p' does) +# Node Key: +# Generate a unique node key for P2P networking +if [ ! -f midnight-node.privatekey ]; then + # Generate node key using parity/subkey + DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm docker.io/parity/subkey:latest generate-node-key > midnight-node.privatekey fi export NODE_KEY="$(cat ./midnight-node.privatekey)" @@ -53,6 +50,24 @@ if [ ! -f indexer.secret ]; then fi export INDEXER_SECRET="$(cat ./indexer.secret)" +# +# Mock mode vs Cardano stack: +# Set USE_MOCK=true to run midnight-node with mock Cardano (fast, for dev/testing) +# Set USE_MOCK=false (default) to run full Cardano stack (real blockchain data) +# +export USE_MOCK=${USE_MOCK:-false} + +if [ "$USE_MOCK" = "true" ]; then + # Mock mode: Skip Cardano services and indexer + export COMPOSE_PROFILES="" + export DB_SYNC_POSTGRES_CONNECTION_STRING="" + echo "📝 Mock mode enabled - midnight-node will use mock Cardano data" +else + # Cardano stack mode: Run all services + export COMPOSE_PROFILES="cardano" + export DB_SYNC_POSTGRES_CONNECTION_STRING="psql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB" +fi + # # Partner chains config: # diff --git a/.envrc.preview b/.envrc.preview index c02fe43..5316017 100644 --- a/.envrc.preview +++ b/.envrc.preview @@ -1,6 +1,10 @@ # overrides for preview export MIDNIGHT_NODE_IMAGE="ghcr.io/midnight-ntwrk/midnight-node:0.17.0-rc.4" export INDEXER_IMAGE="ghcr.io/midnight-ntwrk/indexer-standalone:3.0.0-alpha.5" +export INDEXER_NETWORK_ID="Preview" + +# Mock mode configuration +export MOCK_REGISTRATIONS_FILE="res/mock-bridge-data/default-registrations.json" # Well known addresses of network that allow discovery of all other nodes. export BOOTNODES="/dns/midnight-node-boot-01/tcp/30333/ws/p2p/12D3KooWK66i7dtGVNSwDh9tTeqov1q6LSdWsRLJvTyzTCaywYgK \ diff --git a/.envrc.qanet b/.envrc.qanet index 13da85f..770d5a8 100644 --- a/.envrc.qanet +++ b/.envrc.qanet @@ -1,6 +1,10 @@ # overrides for qanet export MIDNIGHT_NODE_IMAGE="ghcr.io/midnight-ntwrk/midnight-node:0.12.0-rc.3" export INDEXER_IMAGE="ghcr.io/midnight-ntwrk/indexer-standalone:2.1.4" +export INDEXER_NETWORK_ID="QANet" + +# Mock mode configuration +export MOCK_REGISTRATIONS_FILE="res/mock-bridge-data/qanet-mock.json" # Well known addresses of network that allow discovery of all other nodes. export BOOTNODES="/dns/boot-node-01.qanet.dev.midnight.network/tcp/30333/ws/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp \ diff --git a/.envrc.testnet-02 b/.envrc.testnet-02 index 3346998..91d5264 100644 --- a/.envrc.testnet-02 +++ b/.envrc.testnet-02 @@ -1,6 +1,10 @@ # overrides for testnet-02 export MIDNIGHT_NODE_IMAGE="midnightnetwork/midnight-node:0.12.1" export INDEXER_IMAGE="ghcr.io/midnight-ntwrk/indexer-standalone:2.1.4" +export INDEXER_NETWORK_ID="TestNet" + +# Mock mode configuration +export MOCK_REGISTRATIONS_FILE="res/mock-bridge-data/testnet-02-mock.json" # These are well known addresses of a network that allow you to discover all the other nodes. export BOOTNODES="/dns/boot-node-01.testnet-02.midnight.network/tcp/30333/ws/p2p/12D3KooWMjUq13USCvQR9Y6yFzYNYgTQBLNAcmc8psAuPx2UUdnB \ diff --git a/compose.yml b/compose.yml index b1c2673..77926cd 100644 --- a/compose.yml +++ b/compose.yml @@ -16,8 +16,73 @@ volumes: midnight-data-testnet: {} indexer-data: {} + postgres-data: {} + cardano-ipc: {} + db-sync-data: {} services: + postgres: + profiles: ["cardano"] + image: postgres:15.3 + platform: linux/amd64 + container_name: db-sync-postgres + restart: unless-stopped + environment: + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_DB=${POSTGRES_DB} + - POSTGRES_USER=${POSTGRES_USER} + volumes: + - postgres-data:/var/lib/postgresql/data + ports: + - "${POSTGRES_PORT}:5432" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] + interval: 5s + timeout: 5s + retries: 5 + + cardano-node: + profiles: ["cardano"] + image: ${CARDANO_IMAGE} + platform: linux/amd64 + container_name: cardano-node + restart: unless-stopped + environment: + - NETWORK=${CARDANO_NETWORK} + - CARDANO_NODE_SOCKET_PATH=/ipc/node.socket + volumes: + - cardano-ipc:/ipc + - ${CARDANO_DATA_DIR}:/data + ports: + - "3001:3001" + healthcheck: + test: ["CMD-SHELL", "curl -f 127.0.0.1:12788 || exit 1"] + interval: 60s + timeout: 10s + retries: 5 + + cardano-db-sync: + profiles: ["cardano"] + image: ghcr.io/intersectmbo/cardano-db-sync:13.6.0.4 + platform: linux/amd64 + container_name: cardano-db-sync + restart: unless-stopped + depends_on: + postgres: + condition: service_healthy + cardano-node: + condition: service_healthy + environment: + - NETWORK=${CARDANO_NETWORK} + - POSTGRES_HOST=${POSTGRES_HOST} + - POSTGRES_PORT=${POSTGRES_PORT} + - POSTGRES_DB=${POSTGRES_DB} + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + volumes: + - cardano-ipc:/node-ipc + - db-sync-data:/var/lib/cexplorer + midnight-node-testnet: container_name: midnight-node restart: unless-stopped @@ -41,13 +106,19 @@ services: - midnight-data-testnet:/node indexer-standalone: + profiles: ["cardano"] container_name: indexer restart: unless-stopped image: ${INDEXER_IMAGE} ports: - "8088:8088" # GraphQL API environment: - - APP__APPLICATION__NETWORK_ID=${CFG_PRESET} + # v2.1.4 config structure (testnet-02, qanet) + - APP__CHAIN_INDEXER_APPLICATION__NETWORK_ID=${INDEXER_NETWORK_ID} + - APP__WALLET_INDEXER_APPLICATION__NETWORK_ID=${INDEXER_NETWORK_ID} + - APP__INFRA__API__NETWORK_ID=${INDEXER_NETWORK_ID} + # v3.x config structure (preview) + - APP__APPLICATION__NETWORK_ID=${INDEXER_NETWORK_ID} - APP__INFRA__NODE__URL=ws://midnight-node:9944 - APP__INFRA__STORAGE__CNN_URL=/data/indexer.sqlite - APP__INFRA__SECRET=${INDEXER_SECRET} @@ -56,8 +127,3 @@ services: condition: service_healthy volumes: - indexer-data:/data - healthcheck: - test: [ "CMD", "curl", "-f", "http://localhost:8088/health" ] - interval: 5s - timeout: 3s - retries: 5 From 4afe477c96e916564bff9a7ae2a6a8972c347c04 Mon Sep 17 00:00:00 2001 From: Sean Kwak Date: Tue, 4 Nov 2025 14:21:26 +0000 Subject: [PATCH 3/4] using uuidgen for indexer in .envrc Co-authored-by: Squirrel --- .envrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.envrc b/.envrc index 17aabbf..1e4bc42 100644 --- a/.envrc +++ b/.envrc @@ -46,7 +46,7 @@ export NODE_KEY="$(cat ./midnight-node.privatekey)" # Indexer Values: if [ ! -f indexer.secret ]; then # Generate 32-byte hex secret for indexer - openssl rand -hex 32 > indexer.secret + uuidgen | tr -d '-' | head -c 32 > indexer.secret fi export INDEXER_SECRET="$(cat ./indexer.secret)" From 21876e241cc937e2dc3a93d7c0158d8935078b63 Mon Sep 17 00:00:00 2001 From: Sean Kwak Date: Tue, 4 Nov 2025 14:28:22 +0000 Subject: [PATCH 4/4] fix: address review feedback on indexer integration Fix critical network ID capitalization bugs (preview/qanet/testnet-02), standardize on .secret file extension for all sensitive data, consolidate all services into single compose.yml with Docker Compose profiles, and remove legacy compose files as requested. --- .envrc | 12 ++--- .envrc.preview | 2 +- .envrc.qanet | 2 +- .envrc.testnet-02 | 2 +- .github/workflows/ci.yaml | 10 +++-- .gitignore | 2 - README.md | 35 +++++++++------ compose-partner-chains.yml | 92 -------------------------------------- compose.yml | 34 +++++++++++++- proof-server.yml | 23 ---------- test.sh | 4 +- 11 files changed, 72 insertions(+), 146 deletions(-) delete mode 100644 compose-partner-chains.yml delete mode 100644 proof-server.yml diff --git a/.envrc b/.envrc index 1e4bc42..2f64928 100644 --- a/.envrc +++ b/.envrc @@ -22,10 +22,10 @@ export POSTGRES_USER="postgres" # A random password is used for your safety. Docker (but not podman) exposes # ports to the internet by default. This needs to be unguessable. -if [ ! -f postgres.password ]; then - uuidgen | tr -d '-' | head -c 16 > postgres.password +if [ ! -f postgres.secret ]; then + uuidgen | tr -d '-' | head -c 16 > postgres.secret fi -export POSTGRES_PASSWORD="$(cat ./postgres.password)" +export POSTGRES_PASSWORD="$(cat ./postgres.secret)" export POSTGRES_DB="cexplorer" @@ -37,11 +37,11 @@ export APPEND_ARGS="--allow-private-ip --pool-limit 10 --trie-cache-size 0 --pro # Node Key: # Generate a unique node key for P2P networking -if [ ! -f midnight-node.privatekey ]; then +if [ ! -f midnight-node.secret ]; then # Generate node key using parity/subkey - DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm docker.io/parity/subkey:latest generate-node-key > midnight-node.privatekey + DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm docker.io/parity/subkey:latest generate-node-key > midnight-node.secret fi -export NODE_KEY="$(cat ./midnight-node.privatekey)" +export NODE_KEY="$(cat ./midnight-node.secret)" # Indexer Values: if [ ! -f indexer.secret ]; then diff --git a/.envrc.preview b/.envrc.preview index 5316017..357ae15 100644 --- a/.envrc.preview +++ b/.envrc.preview @@ -1,7 +1,7 @@ # overrides for preview export MIDNIGHT_NODE_IMAGE="ghcr.io/midnight-ntwrk/midnight-node:0.17.0-rc.4" export INDEXER_IMAGE="ghcr.io/midnight-ntwrk/indexer-standalone:3.0.0-alpha.5" -export INDEXER_NETWORK_ID="Preview" +export INDEXER_NETWORK_ID="preview" # Mock mode configuration export MOCK_REGISTRATIONS_FILE="res/mock-bridge-data/default-registrations.json" diff --git a/.envrc.qanet b/.envrc.qanet index 770d5a8..94d0f81 100644 --- a/.envrc.qanet +++ b/.envrc.qanet @@ -1,7 +1,7 @@ # overrides for qanet export MIDNIGHT_NODE_IMAGE="ghcr.io/midnight-ntwrk/midnight-node:0.12.0-rc.3" export INDEXER_IMAGE="ghcr.io/midnight-ntwrk/indexer-standalone:2.1.4" -export INDEXER_NETWORK_ID="QANet" +export INDEXER_NETWORK_ID="qanet" # Mock mode configuration export MOCK_REGISTRATIONS_FILE="res/mock-bridge-data/qanet-mock.json" diff --git a/.envrc.testnet-02 b/.envrc.testnet-02 index 91d5264..33cfab7 100644 --- a/.envrc.testnet-02 +++ b/.envrc.testnet-02 @@ -1,7 +1,7 @@ # overrides for testnet-02 export MIDNIGHT_NODE_IMAGE="midnightnetwork/midnight-node:0.12.1" export INDEXER_IMAGE="ghcr.io/midnight-ntwrk/indexer-standalone:2.1.4" -export INDEXER_NETWORK_ID="TestNet" +export INDEXER_NETWORK_ID="testnet" # Mock mode configuration export MOCK_REGISTRATIONS_FILE="res/mock-bridge-data/testnet-02-mock.json" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8eef3db..54f9418 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,9 +27,13 @@ jobs: - name: Check compose files run: | source ./.envrc - docker compose -f compose.yml config -q - docker compose -f compose-partner-chains.yml config -q - docker compose -f proof-server.yml config -q + # Test main compose file + docker compose config -q + # Test profiles + docker compose --profile cardano config -q + docker compose --profile ogmios config -q + docker compose --profile proof-server config -q + docker compose --profile cardano --profile ogmios --profile proof-server config -q - name: Run Super-linter uses: github/super-linter@b807e99ddd37e444d189cfd2c2ca1274d8ae8ef1 #v7 diff --git a/.gitignore b/.gitignore index e58663d..62d7fd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ /cardano-data/* /data -*.privatekey -*.password *.secret ogmios_client.log diff --git a/README.md b/README.md index 6c88c65..b5165e1 100644 --- a/README.md +++ b/README.md @@ -21,34 +21,41 @@ This allows for easy orchestration of the Midnight Node service. 4. Run `docker-compose up` -The `.envrc` file will automatically create a random private key and save it as `midnight-node.privatekey` and a random secret for the indexer saved as `indexer.secret`. +The `.envrc` file will automatically create random secrets and save them as `postgres.secret` (database password), `midnight-node.secret` (node private key), and `indexer.secret` (indexer app secret). -The default `compose.yml` now includes both the Midnight Node and Indexer Standalone, providing a GraphQL API at `http://localhost:8088`. +All services are defined in a single `compose.yml` file. Use Docker Compose profiles to control which services run: -Choose which compose files to use: +**Available profiles:** -- `compose.yml` for Midnight Node + Indexer -- `compose-partner-chains.yml` for Cardano + DB Sync -- `proof-server.yml` for Local Proof Server +- (no profile) - Midnight Node only +- `cardano` - Adds Cardano stack (cardano-node, postgres, cardano-db-sync) and Indexer with GraphQL API at `http://localhost:8088` +- `ogmios` - Adds Ogmios service at `http://localhost:1337` +- `proof-server` - Adds local Proof Server at `http://localhost:6300` -One can use one or multiple compose files at once. +**Usage examples:** -For example, to run the Midnight Node, you can do: +Run Midnight Node only: ```shell docker compose up -d ``` -or to run the Midnight Node and Cardano DB Sync, you can do: +Run Midnight Node + Cardano stack + Indexer: ```shell -docker compose -f ./compose-partner-chains.yml -f ./compose.yml up -d +docker compose --profile cardano up -d ``` -or to run the Midnight Node, Cardano DB Sync and a local Proof Server, you can do: +Run with Cardano stack + Ogmios: ```shell -docker compose -f ./compose-partner-chains.yml -f ./compose.yml -f ./proof-server.yml up -d +docker compose --profile cardano --profile ogmios up -d +``` + +Run everything (Cardano + Ogmios + Proof Server): + +```shell +docker compose --profile cardano --profile ogmios --profile proof-server up -d ``` 🚀 That's it. @@ -65,8 +72,8 @@ If you're using `midnight-node smartcontract` or `midnight-node wizards` that ne To restart from fresh, run: ```sh -docker compose -f ./compose-partner-chains.yml -f ./compose.yml -f ./proof-server.yml down -v -docker compose -f ./compose-partner-chains.yml -f ./compose.yml -f ./proof-server.yml kill +docker compose --profile cardano --profile ogmios --profile proof-server down -v +docker compose --profile cardano --profile ogmios --profile proof-server kill rm -R ./cardano-data docker volume rm midnight-node-docker_midnight-data-testnet ``` diff --git a/compose-partner-chains.yml b/compose-partner-chains.yml deleted file mode 100644 index 4b73f4b..0000000 --- a/compose-partner-chains.yml +++ /dev/null @@ -1,92 +0,0 @@ -# This file is part of https://github.com/midnightntwrk/midnight-node-docker -# Copyright (C) 2025 Midnight Foundation -# SPDX-License-Identifier: Apache-2.0 -# Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -volumes: - cardano-ipc: {} - db-sync-data: {} - postgres-data: {} - ogmios-data: {} - -services: - cardano-node: - image: ${CARDANO_IMAGE} - platform: linux/amd64 - restart: unless-stopped - container_name: cardano-node - ports: - - "3001:3001" - environment: - - NETWORK=${CARDANO_NETWORK} - - CARDANO_NODE_SOCKET_PATH=/ipc/node.socket - volumes: - - cardano-ipc:/ipc - - ${CARDANO_DATA_DIR}:/data - - postgres: - image: postgres:15.3 - platform: linux/amd64 - container_name: db-sync-postgres - environment: - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - - POSTGRES_DB=${POSTGRES_DB} - - POSTGRES_USER=${POSTGRES_USER} - volumes: - - postgres-data:/var/lib/postgresql/data - ports: - - "${POSTGRES_PORT}:${POSTGRES_PORT}" - healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] - interval: 5s - timeout: 5s - retries: 5 - - cardano-db-sync: - image: ghcr.io/intersectmbo/cardano-db-sync:13.6.0.4 - platform: linux/amd64 - container_name: cardano-db-sync - restart: unless-stopped - depends_on: - postgres: - condition: service_healthy - environment: - - NETWORK=${CARDANO_NETWORK} - - POSTGRES_HOST=${POSTGRES_HOST} - - POSTGRES_PORT=${POSTGRES_PORT} - - POSTGRES_DB=${POSTGRES_DB} - - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - volumes: - - cardano-ipc:/node-ipc - - db-sync-data:/var/lib - - cardano-ogmios: - image: cardanosolutions/ogmios:v6.11.0 - platform: linux/amd64 - container_name: cardano-ogmios - restart: unless-stopped - environment: - - DATA_DIR=/data - ports: - - "1337:1337" - volumes: - - cardano-ipc:/ipc - - ogmios-data:/data - command: - - --node-socket - - /ipc/node.socket - - --node-config - - /config/${CARDANO_NETWORK}/cardano-node/config.json - - --host - - 0.0.0.0 diff --git a/compose.yml b/compose.yml index 77926cd..31e019b 100644 --- a/compose.yml +++ b/compose.yml @@ -19,6 +19,7 @@ volumes: postgres-data: {} cardano-ipc: {} db-sync-data: {} + ogmios-data: {} services: postgres: @@ -34,7 +35,7 @@ services: volumes: - postgres-data:/var/lib/postgresql/data ports: - - "${POSTGRES_PORT}:5432" + - "${POSTGRES_PORT}:${POSTGRES_PORT}" healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] interval: 5s @@ -127,3 +128,34 @@ services: condition: service_healthy volumes: - indexer-data:/data + + cardano-ogmios: + profiles: ["ogmios"] + image: cardanosolutions/ogmios:v6.11.0 + platform: linux/amd64 + container_name: cardano-ogmios + restart: unless-stopped + environment: + - DATA_DIR=/data + ports: + - "1337:1337" + volumes: + - cardano-ipc:/ipc + - ogmios-data:/data + command: + - --node-socket + - /ipc/node.socket + - --node-config + - /config/${CARDANO_NETWORK}/cardano-node/config.json + - --host + - 0.0.0.0 + + proof-server: + profiles: ["proof-server"] + image: midnightnetwork/proof-server:4.0.0 + container_name: proof-server + ports: + - "6300:6300" + command: "'midnight-proof-server --network testnet'" + healthcheck: + test: ["CMD", "/bin/bash", "-c", ":> /dev/tcp/127.0.0.1/6300 || exit 1"] diff --git a/proof-server.yml b/proof-server.yml deleted file mode 100644 index 0067a01..0000000 --- a/proof-server.yml +++ /dev/null @@ -1,23 +0,0 @@ -# This file is part of https://github.com/midnightntwrk/midnight-node-docker -# Copyright (C) 2025 Midnight Foundation -# SPDX-License-Identifier: Apache-2.0 -# Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -services: - proof-server: - image: midnightnetwork/proof-server:4.0.0 - ports: - - "6300:6300" - command: "'midnight-proof-server --network testnet'" - healthcheck: - test: ["CMD", "/bin/bash", "-c", ":> /dev/tcp/127.0.0.1/6300 || exit 1"] diff --git a/test.sh b/test.sh index 0d61b34..9f9731a 100755 --- a/test.sh +++ b/test.sh @@ -22,7 +22,7 @@ fi cardano_container=$(docker ps --filter "name=cardano-node") if [[ "$cardano_container" != *"cardano"* ]]; then - echo "cardano container not running, please run docker compose -f ./compose-partner-chains.yml -d" + echo "cardano container not running, please run: docker compose --profile cardano up -d" exit 1 fi @@ -119,7 +119,7 @@ fi # midnight=$(docker ps --filter "name=midnight") if [[ "$midnight" != *"midnight"* ]]; then - echo "❌ midnight container not running, please run docker compose -d" + echo "❌ midnight container not running, please run: docker compose up -d" exit 1 fi