From 2089fa6cf38488a006be86244b26a11dcb35f991 Mon Sep 17 00:00:00 2001 From: Haneen Khalifa Date: Mon, 20 May 2024 02:35:45 +0300 Subject: [PATCH] feat: add docker compose in grandine.tmpl --- .../services/merge/consensus/grandine.tmpl | 45 +++++++++++++++++++ .../services/merge/validator/grandine.tmpl | 38 ++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 templates/services/merge/consensus/grandine.tmpl create mode 100644 templates/services/merge/validator/grandine.tmpl diff --git a/templates/services/merge/consensus/grandine.tmpl b/templates/services/merge/consensus/grandine.tmpl new file mode 100644 index 00000000..b1451c24 --- /dev/null +++ b/templates/services/merge/consensus/grandine.tmpl @@ -0,0 +1,45 @@ +{{/* grandine.tmpl */}} +{{ define "consensus" }} + consensus: + stop_grace_period: 30s + container_name: sedge-consensus-client{{if .ContainerTag}}-{{.ContainerTag}}{{end}} + restart: unless-stopped + image: ${CC_IMAGE_VERSION}{{if .Mev}} + depends_on:{{if .Mev}} + mev-boost: + condition: service_started{{end}}{{end}} + networks: + - sedge + volumes: + - ${CC_DATA_DIR}:/root/.grandine + - ${CC_JWT_SECRET_PATH}:/root/.grandine/jwtsecret{{if .CustomConsensusConfigs}}{{if .CustomNetworkConfigPath}} + - {{.CustomNetworkConfigPath}}:/network/config.yaml{{end}}{{if .CustomGenesisPath}} + - {{.CustomGenesisPath}}:/network/genesis.ssz{{end}}{{if .CustomDeployBlockPath}} + - {{.CustomDeployBlockPath}}:/network/deploy_block.txt{{end}}{{end}} + ports: + - "{{.ClDiscoveryPort}}:{{.ClDiscoveryPort}}/tcp" + - "{{.ClDiscoveryPort}}:{{.ClDiscoveryPort}}/udp" + - "{{.ClMetricsPort}}:{{.ClMetricsPort}}/tcp"{{if .MapAllPorts}} + - "{{.ClApiPort}}:{{.ClApiPort}}"{{end}} + expose: + - {{.ClApiPort}} + command: + - grandine{{if .CustomConsensusConfigs}} + - --config-file=/network/config.yaml{{end}} + - --datadir=/root/.grandine + - --eth1-rpc-urls=${EC_API_URL} + - --jwt-secret=/root/.grandine/jwtsecret + - --http-address=0.0.0.0 + - --http-port={{.ClApiPort}}{{if not .CustomConsensusConfigs}} + - --network={{if .SplittedNetwork}}${CL_NETWORK}{{else}}${NETWORK}{{end}}{{end}} + - --timeout=10000{{range $flag := .ClExtraFlags}} + - --{{$flag}}{{end}}{{if .MevBoostEndpoint}} + - --checkpoint-sync-url={{if .CheckpointSyncUrl}}{{ .CheckpointSyncUrl }}{{else}}${CHECKPOINT_SYNC_URL}{{end}}{{end}}{{range $flag := .ClExtraFlags}} + - --{{$flag}}{{end}}{{if .MevBoostEndpoint}} + - --builder={{.MevBoostEndpoint}}{{end}}{{if .LoggingDriver}} + logging: + driver: "{{.LoggingDriver}}"{{if eq .LoggingDriver "json-file"}} + options: + max-size: "10m" + max-file: "10"{{end}}{{end}} +{{ end }} \ No newline at end of file diff --git a/templates/services/merge/validator/grandine.tmpl b/templates/services/merge/validator/grandine.tmpl new file mode 100644 index 00000000..624c5180 --- /dev/null +++ b/templates/services/merge/validator/grandine.tmpl @@ -0,0 +1,38 @@ +{{/* grandine.tmpl */}} +{{ define "validator" }} + validator: + container_name: sedge-validator-client{{if .ContainerTag}}-{{.ContainerTag}}{{end}} + image: ${VL_IMAGE_VERSION} + depends_on: + validator-blocker: + condition: service_completed_successfully + networks: + - sedge + ports: + - "{{.VlMetricsPort}}:{{.VlMetricsPort}}" + volumes: + - ${VL_DATA_DIR}:/data{{if .CustomConsensusConfigs}}{{if .CustomNetworkConfigPath}} + - {{.CustomNetworkConfigPath}}:/network_config/config.yaml{{end}}{{if .CustomGenesisPath}} + - {{.CustomGenesisPath}}:/network_config/genesis.ssz{{end}}{{if .CustomDeployBlockPath}} + - {{.CustomDeployBlockPath}}:/network_config/deploy_block.txt{{end}}{{end}} + command: + - grandine{{if .CustomConsensusConfigs}} + - --testnet-dir=/network_config{{end}} + - vc{{if not .CustomConsensusConfigs}} + - --network={{if .SplittedNetwork}}${CL_NETWORK}{{else}}${NETWORK}{{end}}{{end}} + - --beacon-nodes=${CC_API_URL} + - --graffiti=${GRAFFITI} + - --debug-level=${VL_LOG_LEVEL} + - --validators-dir=/data/validators{{with .FeeRecipient}} + - --suggested-fee-recipient=${FEE_RECIPIENT}{{end}} + - --metrics + - --metrics-port={{.VlMetricsPort}} + - --metrics-address=0.0.0.0{{range $flag := .VlExtraFlags}} + - --{{$flag}}{{end}}{{if .MevBoostOnValidator}} + - --builder-proposals{{end}}{{if .LoggingDriver}} + logging: + driver: "{{.LoggingDriver}}"{{if eq .LoggingDriver "json-file"}} + options: + max-size: "10m" + max-file: "10"{{end}}{{end}} +{{ end }} \ No newline at end of file