Skip to content

Instantly share code, notes, and snippets.

@Tknott95
Last active January 16, 2025 08:34
Show Gist options
  • Save Tknott95/22f2f067764ae62215576d17afda5267 to your computer and use it in GitHub Desktop.
Save Tknott95/22f2f067764ae62215576d17afda5267 to your computer and use it in GitHub Desktop.
node and sync (external psql) - docker-compose.yaml
name: nodes_and_syncs
services:
relay:
container_name: relay
build:
context: . # Assuming Dockerfile is in the current directory
image: ghcr.io/intersectmbo/cardano-node:10.1.3
ports:
- "3001:3001"
volumes:
- cardano-node-ipc:/ipc
- cardano-node-data:/data
- /mnt/id3/MithrilSnapshots/122224/db:/data/db
environment:
- NETWORK=mainnet
restart: always
dbsync:
container_name: dbsync
network_mode: "host"
image: ghcr.io/intersectmbo/cardano-db-sync:13.3.0.0
environment:
# - NETWORK=${NETWORK:-mainnet} - COMMENTED OUT IF USING db-sync-config.json
- POSTGRES_HOST=0.0.0.0 # Use localhost for your local PostgreSQL
- POSTGRES_PORT=5432 # Ensure this is the correct port
- POSTGRES_DB=cexplorer
- POSTGRES_USER=postgres
- PGSSLMODE=disable
- CARDANO_NODE_SOCKET_PATH=/ipc/node.socket
- EXTRA_DB_SYNC_ARGS=' --state-dir ./ledger-state/mainnet/ --schema-dir ./schema'
- RESTORE_RECREATE_DB=N
command: --socket-path /ipc/node.socket --config ./config/db-sync-config.json # Adjusted to use config and socket path
restart: on-failure
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
volumes:
- db-sync-data:/var/lib/cexplorer
- cardano-node-ipc:/ipc
- ./config/:/config/
- ./ledger-state/mainnet/:/ledger-state/mainnet/
- ./schema:/schema/
volumes:
cardano-node-ipc:
cardano-node-data:
db-sync-data:
networks:
default:
name: postgres
@Tknott95
Copy link
Author

Tknott95 commented Jan 15, 2025

{
  "EnableFutureGenesis": true,
  "EnableLogMetrics": false,
  "EnableLogging": true,
  "NetworkName": "mainnet",
  "NodeConfigFile": "config.json",
  "PrometheusPort": 8080,
  "RequiresNetworkMagic": "RequiresNoMagic",
  "enpSocketPath": "/ipc/node.socket",
  "defaultBackends": [
    "KatipBK"
  ],
  "defaultScribes": [
    [
      "StdoutSK",
      "stdout"
    ]
  ],
  "minSeverity": "Info",
  "options": {
    "cfokey": {
      "value": "Release-1.0.0"
    },
    "mapBackends": {},
    "mapSeverity": {
      "db-sync-node": "Info",
      "db-sync-node.Mux": "Error",
      "db-sync-node.Subscription": "Error"
    },
    "mapSubtrace": {
      "#ekgview": {
        "contents": [
          [
            {
              "contents": "cardano.epoch-validation.benchmark",
              "tag": "Contains"
            },
            [
              {
                "contents": ".monoclock.basic.",
                "tag": "Contains"
              }
            ]
          ],
          [
            {
              "contents": "cardano.epoch-validation.benchmark",
              "tag": "Contains"
            },
            [
              {
                "contents": "diff.RTS.cpuNs.timed.",
                "tag": "Contains"
              }
            ]
          ],
          [
            {
              "contents": "#ekgview.#aggregation.cardano.epoch-validation.benchmark",
              "tag": "StartsWith"
            },
            [
              {
                "contents": "diff.RTS.gcNum.timed.",
                "tag": "Contains"
              }
            ]
          ]
        ],
        "subtrace": "FilterTrace"
      },
      "#messagecounters.aggregation": {
        "subtrace": "NoTrace"
      },
      "#messagecounters.ekgview": {
        "subtrace": "NoTrace"
      },
      "#messagecounters.katip": {
        "subtrace": "NoTrace"
      },
      "#messagecounters.monitoring": {
        "subtrace": "NoTrace"
      },
      "#messagecounters.switchboard": {
        "subtrace": "NoTrace"
      },
      "benchmark": {
        "contents": [
          "GhcRtsStats",
          "MonotonicClock"
        ],
        "subtrace": "ObservableTrace"
      },
      "cardano.epoch-validation.utxo-stats": {
        "subtrace": "NoTrace"
      }
    }
  },
  "rotation": {
    "rpKeepFilesNum": 10,
    "rpLogLimitBytes": 5000000,
    "rpMaxAgeHours": 24
  },
  "setupBackends": [
    "AggregationBK",
    "KatipBK"
  ],
  "setupScribes": [
    {
      "scFormat": "ScText",
      "scKind": "StdoutSK",
      "scName": "stdout",
      "scRotation": null
    }
  ]
}

@Tknott95
Copy link
Author

Tknott95 commented Jan 15, 2025

db-sync.config.json you need to change the node socket so it doesn't point wrong as it will point to /node-ipc/ while node is at \ipc\ even if you override the env vars. Get the rest via curl -O from official sources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment