Skip to content

Instantly share code, notes, and snippets.

@Mleekko
Created August 7, 2023 08:03
Show Gist options
  • Save Mleekko/ff2fdbbda02121802631f42298d98e0f to your computer and use it in GitHub Desktop.
Save Mleekko/ff2fdbbda02121802631f42298d98e0f to your computer and use it in GitHub Desktop.
Babylon RC2 Aggregator + Gateway
# Used by Docker Compose: https://docs.docker.com/compose/env-file/
#################################
# NETWORK GATEWAY CONFIGURATION #
#################################
# The logical network name which the nodes you connect to must match with
# EG mainnet | stokenet | localnet
NETWORK_NAME=ansharnet
POSTGRES_SUPERUSER=postgres
POSTGRES_SUPERUSER_PASSWORD=<SECRET_PG_PASSWORD>
POSTGRES_DB_NAME=radix_ledger
# Define the Full Node Core APIs to connect to below
# Note that fullnode resolves to the fullnode in the docker-compose file
# Note that host.docker.internal can be used to translate to the host machine's localhost from a docker container when run in Docker Desktop on Mac or Windows
# See - https://www.cloudsavvyit.com/14114/how-to-connect-to-localhost-within-a-docker-container/
NODE_0_NAME=One
NODE_0_CORE_API_ADDRESS=http://core:3333/core
---
services:
core:
cap_add:
- NET_ADMIN
environment:
JAVA_OPTS: --enable-preview -server -Xms8g -Xmx8g -XX:MaxDirectMemorySize=2048m
-XX:+HeapDumpOnOutOfMemoryError -XX:+UseCompressedOops -Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts
-Djavax.net.ssl.trustStoreType=jks -Djava.security.egd=file:/dev/urandom -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
RADIXDLT_API_PORT: 3333
RADIXDLT_GENESIS_DATA_FILE: /home/radixdlt/genesis_data_file.bin
RADIXDLT_LOG_LEVEL: info
RADIXDLT_NETWORK_ID: 13
RADIXDLT_NETWORK_SEEDS_REMOTE: radix://node_tdx_d_1qwq2nfe6vxqwe3mqmfm9l2xl97as7lkwndval63cymvc3qszn8nqx6g2s3m@3.109.161.178
RADIXDLT_NETWORK_USE_PROXY_PROTOCOL: 'false'
RADIXDLT_SIGN_ENABLE: 'true'
RADIXDLT_TRANSACTIONS_API_ENABLE: 'true'
RADIXDLT_VALIDATOR_KEY_LOCATION: /home/radixdlt/node-keystore.ks
RADIX_NODE_KEYSTORE_PASSWORD: <SECRET_KEYSTORE_PASSWORD>
image: radixdlt/babylon-node:rcnet-v2-phase2-r4
init: true
mem_limit: 12000m
stop_grace_period: 30s
restart: unless-stopped
ports:
- 3333:3333
ulimits:
memlock: -1
nofile:
hard: 65536
soft: 65536
volumes:
- babylon_ledger:/home/radixdlt/RADIXDB
- /root/babylon-node-config/node-keystore.ks:/home/radixdlt/node-keystore.ks
- /radix/ansharnet_genesis_data_file.bin:/home/radixdlt/genesis_data_file.bin
nginx:
environment:
RADIXDLT_GATEWAY_API_ENABLE: 'true'
RADIXDLT_GATEWAY_BEHIND_AUTH: 'false'
RADIXDLT_NETWORK_USE_PROXY_PROTOCOL: 'false'
RADIXDLT_TRANSACTIONS_API_ENABLE: 'true'
image: radixdlt/babylon-nginx:1.0.0-rc5
ports:
- 443:443
- 30000:30000
restart: unless-stopped
ulimits:
nofile:
hard: 65536
soft: 65536
volumes:
- nginx_secrets:/etc/nginx/secrets
radix_db:
image: postgres:15.2-alpine
shm_size: 256m
command: postgres -c listen_addresses='*'
restart: unless-stopped
stop_grace_period: 30s
environment:
POSTGRES_USER: "${POSTGRES_SUPERUSER}"
POSTGRES_PASSWORD: "${POSTGRES_SUPERUSER_PASSWORD}"
POSTGRES_DB: "${POSTGRES_DB_NAME}"
healthcheck:
test: pg_isready -U ${POSTGRES_SUPERUSER} -d ${POSTGRES_DB_NAME}
interval: 7s
timeout: 3s
retries: 5
start_period: 60s
volumes:
- /WRITEDB:/var/lib/postgresql/data
# - ./pgsql/etc/postgresql:/etc/postgresql
ports:
- 127.0.0.1:50032:5432 # Allow connections to port 50032 from localhost
database_migrations: # This is the base -- the _image and _built containers are defined below
image: "radixdlt/babylon-ng-database-migrations:rcnet-v2-phase2-r4"
environment:
ConnectionStrings__NetworkGatewayMigrations: "Host=radix_db;Port=5432;Database=${POSTGRES_DB_NAME};Username=${POSTGRES_SUPERUSER};Password=${POSTGRES_SUPERUSER_PASSWORD}"
# restart: on-failure
depends_on:
radix_db:
condition: service_healthy
data_aggregator:
image: radixdlt/babylon-ng-data-aggregator:rcnet-v2-phase2-r4
cpus: "2.0"
ports:
- "5208:80" # This allows you to connect to the API (for root and health checks) at http://localhost:5208
- "1234:1234" # This allows you to connect to the metrics API at http://localhost:1234
restart: unless-stopped
environment:
# WIPE_DATABASE: "true"
ASPNETCORE_URLS: "http://*:80" # Binds to 80 on all interfaces
RADIX_NG_AGGREGATOR__MaxWaitForDbOnStartupMs: "${MAX_DB_WAIT_MS_ON_START}"
PrometheusMetricsPort: "1234"
ConnectionStrings__NetworkGatewayReadOnly: "Host=radix_db;Port=5432;Database=${POSTGRES_DB_NAME};Username=${POSTGRES_SUPERUSER};Password=${POSTGRES_SUPERUSER_PASSWORD}"
ConnectionStrings__NetworkGatewayReadWrite: "Host=radix_db;Port=5432;Database=${POSTGRES_DB_NAME};Username=${POSTGRES_SUPERUSER};Password=${POSTGRES_SUPERUSER_PASSWORD}"
DataAggregator__Network__NetworkName: "${NETWORK_NAME}"
DataAggregator__Network__DisableCoreApiHttpsCertificateChecks: "false"
DataAggregator__Network__CoreApiNodes__0__Name: "${NODE_0_NAME}"
DataAggregator__Network__CoreApiNodes__0__CoreApiAddress: "${NODE_0_CORE_API_ADDRESS}"
DataAggregator__Network__CoreApiNodes__0__CoreApiAuthorizationHeader: ""
DataAggregator__Network__CoreApiNodes__0__TrustWeighting: "1"
DataAggregator__Network__CoreApiNodes__0__Enabled: "true"
depends_on:
radix_db:
condition: service_started
database_migrations:
condition: service_completed_successfully
gateway_api:
image: radixdlt/babylon-ng-gateway-api:rcnet-v2-phase2-r4
ports:
- "5207:80" # This allows you to connect to the API at http://localhost:5207
- "1235:1235" # This allows you to connect to the metrics API at http://localhost:1235
restart: unless-stopped
environment:
ASPNETCORE_URLS: "http://*:80" # Binds to 80 on all interfaces
GatewayApiVersion: "1.1.13-test"
PrometheusMetricsPort: "1235"
EnableSwagger: "false"
GatewayApi__Endpoint_MaxPageSize: "30"
ConnectionStrings__NetworkGatewayReadOnly: "Host=radix_db:5432;Database=${POSTGRES_DB_NAME};Username=${POSTGRES_SUPERUSER};Password=${POSTGRES_SUPERUSER_PASSWORD}"
ConnectionStrings__NetworkGatewayReadWrite: "Host=radix_db:5432;Database=${POSTGRES_DB_NAME};Username=${POSTGRES_SUPERUSER};Password=${POSTGRES_SUPERUSER_PASSWORD}"
GatewayApi__AcceptableLedgerLag__PreventReadRequestsIfDbLedgerIsBehind: "true"
GatewayApi__AcceptableLedgerLag__PreventConstructionRequestsIfDbLedgerIsBehind: "true"
GatewayApi__AcceptableLedgerLag__ReadRequestAcceptableDbLedgerLagSeconds: "60"
GatewayApi__AcceptableLedgerLag__ConstructionRequestsAcceptableDbLedgerLagSeconds: "60"
GatewayApi__Network__NetworkName: "${NETWORK_NAME}"
GatewayApi__Network__DisableCoreApiHttpsCertificateChecks: "true"
GatewayApi__Network__MaxAllowedStateVersionLagToBeConsideredSynced: "100"
GatewayApi__Network__IgnoreNonSyncedNodes: "true"
GatewayApi__Network__CoreApiNodes__0__Name: "${NODE_0_NAME}"
GatewayApi__Network__CoreApiNodes__0__CoreApiAddress: "${NODE_0_CORE_API_ADDRESS}"
GatewayApi__Network__CoreApiNodes__0__CoreApiAuthorizationHeader: ""
GatewayApi__Network__CoreApiNodes__0__RequestWeighting: "1"
GatewayApi__Network__CoreApiNodes__0__Enabled: "true"
depends_on:
radix_db:
condition: service_started
database_migrations:
condition: service_completed_successfully
version: '3.8'
volumes:
babylon_ledger:
driver: local
driver_opts:
device: /RADIXDB
o: bind
type: none
nginx_secrets:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment