Skip to content

Instantly share code, notes, and snippets.

@KazW
Created May 23, 2021 08:35
Show Gist options
  • Save KazW/c7ef4cad7806089de509e4c0e62f161d to your computer and use it in GitHub Desktop.
Save KazW/c7ef4cad7806089de509e4c0e62f161d to your computer and use it in GitHub Desktop.
Run a Cardano Node with DB Syncing to Postgres
apiVersion: v1
data:
db-sync-config.json: |
{
"EnableLogMetrics": false,
"EnableLogging": true,
"NetworkName": "mainnet",
"NodeConfigFile": "/nix/store/9qxnjirql2snfln1w2gwdl8169l7404x-config-mainnet.json",
"RequiresNetworkMagic": "RequiresNoMagic",
"defaultBackends": [
"KatipBK"
],
"defaultScribes": [
[
"StdoutSK",
"stdout"
]
],
"hasPrometheus": [
"0.0.0.0",
12698
],
"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
}
]
}
node-config.json: |
{
"ApplicationName": "cardano-sl",
"ApplicationVersion": 1,
"ByronGenesisFile": "/nix/store/3678ccikas3q16jcqcghwviqsd5k9wjx-mainnet-byron-genesis.json",
"ByronGenesisHash": "5f20df933584822601f9e3f8c024eb5eb252fe8cefb24d1317dc3d432e940ebb",
"LastKnownBlockVersion-Alt": 0,
"LastKnownBlockVersion-Major": 3,
"LastKnownBlockVersion-Minor": 0,
"MaxKnownMajorProtocolVersion": 2,
"Protocol": "Cardano",
"RequiresNetworkMagic": "RequiresNoMagic",
"ShelleyGenesisFile": "/nix/store/hxgam7f415s8b0j6c3qwakgkzd0pr5h4-mainnet-shelley-genesis.json",
"ShelleyGenesisHash": "1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81",
"TraceBlockFetchClient": false,
"TraceBlockFetchDecisions": false,
"TraceBlockFetchProtocol": false,
"TraceBlockFetchProtocolSerialised": false,
"TraceBlockFetchServer": false,
"TraceChainDb": true,
"TraceChainSyncBlockServer": false,
"TraceChainSyncClient": false,
"TraceChainSyncHeaderServer": false,
"TraceChainSyncProtocol": false,
"TraceDNSResolver": true,
"TraceDNSSubscription": true,
"TraceErrorPolicy": true,
"TraceForge": true,
"TraceHandshake": false,
"TraceIpSubscription": true,
"TraceLocalChainSyncProtocol": false,
"TraceLocalErrorPolicy": true,
"TraceLocalHandshake": false,
"TraceLocalTxSubmissionProtocol": false,
"TraceLocalTxSubmissionServer": false,
"TraceMempool": true,
"TraceMux": false,
"TraceTxInbound": false,
"TraceTxOutbound": false,
"TraceTxSubmissionProtocol": false,
"TracingVerbosity": "NormalVerbosity",
"TurnOnLogMetrics": true,
"TurnOnLogging": true,
"defaultBackends": [
"KatipBK"
],
"defaultScribes": [
[
"StdoutSK",
"stdout"
]
],
"hasEKG": 12788,
"hasPrometheus": [
"0.0.0.0",
12798
],
"minSeverity": "Info",
"options": {
"mapBackends": {
"cardano.node.metrics": [
"EKGViewBK"
],
"cardano.node.resources": [
"EKGViewBK"
]
},
"mapSubtrace": {
"cardano.node.metrics": {
"subtrace": "Neutral"
}
}
},
"rotation": {
"rpKeepFilesNum": 10,
"rpLogLimitBytes": 5000000,
"rpMaxAgeHours": 24
},
"setupBackends": [
"KatipBK"
],
"setupScribes": [
{
"scFormat": "ScText",
"scKind": "StdoutSK",
"scName": "stdout",
"scRotation": null
}
]
}
kind: ConfigMap
metadata:
name: dev-cardano-db-sync-config
---
apiVersion: v1
data:
postgres_db: Y2FyZGFub19tYWlubmV0Cg==
postgres_password: a0hXUFNqSEVlMg==
postgres_user: cG9zdGdyZXMK
kind: Secret
metadata:
name: dev-cardano-db-sync-secrets
type: Opaque
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: dev-cardano-db-sync
spec:
replicas: 1
selector:
matchLabels:
app: cardano-db-sync
serviceName: cardano-db-sync
template:
metadata:
labels:
app: cardano-db-sync
spec:
containers:
- args:
- run
- --config
- /config/node-config.json
- --database-path
- /data/db
- --topology
- /nix/store/mb0zb61472xp1hgw3q9pz7m337rmfx7f-topology.yaml
- --host-addr
- 0.0.0.0
- --port
- "3001"
- --socket-path
- /ipc/node.socket
image: inputoutput/cardano-node:1.27.0
name: cardano-node
ports:
- containerPort: 12798
- containerPort: 3001
volumeMounts:
- mountPath: /config
name: config
- mountPath: /data
name: node-data
- mountPath: /ipc
name: sock
- args:
- --config
- /config/db-sync-config.json
- --state-dir
- /data
- --socket-path
- /ipc/node.socket
env:
- name: EXTENDED
value: "true"
- name: POSTGRES_HOST
value: postgresql.default.svc.cluster.local
- name: POSTGRES_PORT
value: "5432"
image: inputoutput/cardano-db-sync:9.0.0
name: cardano-db-sync
ports:
- containerPort: 12698
volumeMounts:
- mountPath: /config
name: config
- mountPath: /data
name: sync-data
- mountPath: /ipc
name: sock
- mountPath: /run/secrets
name: secrets
readOnly: true
volumes:
- emptyDir: {}
name: sock
- name: secrets
secret:
secretName: dev-cardano-db-sync-secrets
- configMap:
name: dev-cardano-db-sync-config
name: config
volumeClaimTemplates:
- metadata:
name: node-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 15Gi
- metadata:
name: sync-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 15Gi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment