Skip to content

Commit

Permalink
refactor: teku & besu
Browse files Browse the repository at this point in the history
  • Loading branch information
eenagy committed Sep 11, 2024
1 parent 2007e58 commit 12ab9fc
Show file tree
Hide file tree
Showing 11 changed files with 348 additions and 103 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "eth-node-besu-testnet"
bin_package = "eth-node-besu"
binary = "/usr/lib/eth-node-besu-testnet/run-service.sh"
binary = "/usr/lib/eth-node-besu-testnet/run-besu-service.sh"
user = { name = "eth-node-besu-testnet", group = true, create = { home = false } }
runtime_dir = { mode = "750" }
# Service Fields
Expand Down Expand Up @@ -42,18 +42,22 @@ WorkingDirectory=/var/lib/eth-node-testnet/besu
"""
## hack to actually use system.d but let debcrafter manage the user creation
add_files = [
"debian/scripts/run-service.sh /usr/lib/eth-node-besu-testnet/",
"debian/scripts/run-besu-service.sh /usr/lib/eth-node-besu-testnet/",
"debian/scripts/run-besu.sh /usr/lib/eth-node-besu-testnet/bin/",
# "debian/conf/besu-testnet.conf /etc/eth-node-besu-testnet/",
"debian/tmp/eth-node-besu-testnet.service /lib/systemd/system/",
]
provides = ["eth-node-testnet-el-service"]
conflicts = ["eth-node-testnet-el-service"]
depends=["eth-node-testnet-config", "eth-node-testnet"]
summary = "service file for eth-node-besu for network: testnet"

# [extra_groups."eth-node-testnet"]
# create = true
[[plug]]
run_as_user = "root"
register_cmd = ["bash", "-c",
"adduser --system --quiet --group eth-node-testnet && mkdir -p /var/lib/eth-node-testnet && chown eth-node-testnet:eth-node-testnet /var/lib/eth-node-testnet && mkdir -p /var/lib/eth-node-testnet/besu && chown eth-node-besu-testnet:eth-node-besu-testnet /var/lib/eth-node-testnet/besu"]
unregister_cmd = ["echo", "hello_world > /dev/null"]



[config."besu-testnet.conf"]
format = "plain"
Expand Down Expand Up @@ -137,11 +141,5 @@ default = "$BASE_CONFIG_EL_RPC_PORT"
priority = "low"
summary = "Set the RPC HTTP port"

[[plug]]
run_as_user = "root"
register_cmd = ["bash", "-c",
"adduser --system --quiet --group eth-node-testnet && mkdir -p /var/lib/eth-node-testnet && chown eth-node-testnet:eth-node-testnet /var/lib/eth-node-testnet && mkdir -p /var/lib/eth-node-testnet/besu && chown eth-node-besu-testnet:eth-node-besu-testnet /var/lib/eth-node-testnet/besu"]
unregister_cmd = ["echo", "hello_world > /dev/null"]



Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ package_hash=[
# { hash="3c4029ca33e6f26976012c3cab2dc68f46ce30f8", name= "eth-node-besu-testnet_0.0.1-1.dsc"},
{ hash="b35f46d5fb424aee57b5d666e61b2eff83543aad", name= "eth-node-besu-testnet_0.0.1.orig.tar.gz"},
# { hash="bf82dcf8ae59dc94c3dbb41f5e0df8b5d15934cd", name= "eth-node-besu-testnet_0.0.1-1.debian.tar.xz"},
{ hash="54a1a34a1e392d2012c72ac702c5dcbbd5888f05", name= "eth-node-besu-testnet_0.0.1-1_all.deb"},
{ hash="26921e33d083f7604e069e878709b6b75581d530", name= "eth-node-besu-testnet_0.0.1-1_all.deb"},

]
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ override_dh_dwz:
override_dh_prep:
mkdir debian/tmp
cp debian/eth-node-besu-testnet.eth-node-besu-testnet.service debian/tmp/eth-node-besu-testnet.service
chmod a+x debian/scripts/run-service.sh
chmod a+x debian/scripts/run-besu-service.sh
chmod a+x debian/scripts/run-besu.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash


/bin/bash /usr/lib/eth-node-besu-testnet/bin/run-besu.sh \
exec /usr/lib/eth-node-besu-testnet/bin/run-besu.sh \
--conf-file /etc/eth-node-testnet/conf.d/testnet.conf \
--conf-file /etc/eth-node-besu-testnet/besu-testnet.conf
Original file line number Diff line number Diff line change
@@ -1,26 +1,145 @@
name = "eth-node-teku-testnet"
bin_package = "eth-node-config-testnet-teku"
binary = "/usr/lib/eth-node-config-testnet/bin/run-teku.sh"
conf_param = "--conf-file"
user = { group = true, create = { home = false } }
bin_package = "eth-node-teku"
binary = "/usr/lib/eth-node-teku-testnet/run-teku-service.sh"
user = { name = "eth-node-teku-testnet", group = true, create = { home = false } }
runtime_dir = { mode = "750" }
# Service Fields
after = "multi-user.target"
service_type = "simple"
extra_service_config = """
# no need to specify, these come from debcrafter
# User=eth-node-teku-testnet
# NoNewPrivileges=true
# ProtectHome=true
# PrivateTmp=true
# PrivateDevices=true
# additional flags not specified by debcrafter
CapabilityBoundingSet=
IPAddressDeny=none
LockPersonality=true
PrivateIPC=true
PrivateUsers=true
ProtectClock=true
ProtectControlGroups=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectProc=invisible
ReadWritePaths=/var/lib/eth-node-testnet/teku
ReadOnlyPaths=/var/lib/eth-node-testnet
RemoveIPC=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
SystemCallArchitectures=native
SystemCallFilter=@system-service
UMask=0077
WorkingDirectory=/var/lib/eth-node-testnet/teku
"""
## hack to actually use system.d but let debcrafter manage the user creation
add_files = ["debian/lib/systemd/system/eth-node-teku-testnet.service /lib/systemd/system/"]
add_files = [
"debian/scripts/run-teku-service.sh /usr/lib/eth-node-teku-testnet/",
"debian/scripts/run-teku.sh /usr/lib/eth-node-teku-testnet/bin/",
"debian/tmp/eth-node-teku-testnet.service /lib/systemd/system/",
]
provides = ["eth-node-testnet-cl-service"]
conflicts = ["eth-node-testnet-cl-service"]
depends=["eth-node-config-testnet-teku", "eth-node-testnet-config", "eth-node-testnet"]
summary = "systemd service files for eth-node-teku using eth-node-config-testnet-teku and eth-node-testnet-config"

# TODO debcrafter should do this
# [config."vars"]
# format = "plain"

# [config."vars.toml".ivars.base_dir]
# type = "path"
# file_type = "dir"
# create = { mode = 755, owner = "$service", group = "$service" }
# default = "/var/lib/eth-node-testnet/besu"
# priority = "low"
# summary = "Node working directory"
depends=["eth-node-testnet-config", "eth-node-testnet"]
summary = "service file for eth-node-teku for network: testnet"

[[plug]]
run_as_user = "root"
register_cmd = ["bash", "-c",
"adduser --system --quiet --group eth-node-testnet && mkdir -p /var/lib/eth-node-testnet && chown eth-node-testnet:eth-node-testnet /var/lib/eth-node-testnet && mkdir -p /var/lib/eth-node-testnet/teku && chown eth-node-teku-testnet:eth-node-teku-testnet /var/lib/eth-node-testnet/teku"]
unregister_cmd = ["echo", "hello_world > /dev/null"]

[config."teku-testnet.conf"]
format = "plain"

[config."teku-testnet.conf".ivars."TEKU_CLI_EE_ENDPOINT"]
type = "string"
default = "$BASE_CONFIG_ENDPOINT_URL"
priority = "low"
summary = "URL for Execution Engine node."

[config."teku-testnet.conf".ivars."TEKU_CLI_EE_JWT_SECRET_FILE"]
type = "string"
default = "$BASE_CONFIG_SECRETS_FILE"
priority = "low"
summary = "Location of the file specifying the hex-encoded 256-bit secret key to be used for verifying/generating JWT tokens."

[config."teku-testnet.conf".ivars."TEKU_CLI_CHECKPOINT_SYNC_URL"]
type = "string"
default = ""
priority = "low"
summary = "The Checkpointz server that will be used to bootstrap this node."

[config."teku-testnet.conf".ivars."TEKU_CLI_DATA_BASE_PATH"]
type = "string"
default = "$BASE_CONFIG_DATA_DIR/teku"
priority = "low"
summary = "Path to the base directory for storage. Default: $HOME/.local/share/teku."

[config."teku-testnet.conf".ivars."TEKU_CLI_NETWORK"]
type = "string"
default = "$BASE_CONFIG_CUSTOM_NETWORK_TESTNET_DIR/config.yaml"
priority = "low"
summary = "Represents which network to use. Default: mainnet."

[config."teku-testnet.conf".ivars."TEKU_CLI_P2P_DISCOVERY_BOOTNODES"]
type = "string"
default = "$BASE_CONFIG_CUSTOM_NETWORK_BOOTNODES_ENR"
priority = "low"
summary = "List of ENRs of the bootnodes."

[config."teku-testnet.conf".ivars."TEKU_CLI_GENESIS_STATE"]
type = "string"
default = "$BASE_CONFIG_CUSTOM_NETWORK_GENESIS_STATE"
priority = "low"
summary = "The genesis state. This value should be a file or URL pointing to an SSZ-encoded finalized checkpoint state."

[config."teku-testnet.conf".ivars."TEKU_CLI_IGNORE_WEAK_SUBJECTIVITY_PERIOD_ENABLED"]
type = "string"
default = "true"
priority = "low"
summary = "Allows syncing outside of the weak subjectivity period. Default: false."

[config."teku-testnet.conf".ivars."TEKU_CLI_REST_API_CORS_ORIGINS"]
type = "string"
default = ""
priority = "low"
summary = "Comma-separated list of origins to allow, or * to allow any origin. Default: []."

[config."teku-testnet.conf".ivars."TEKU_CLI_REST_API_DOCS_ENABLED"]
type = "string"
default = ""
priority = "low"
summary = "Enable swagger-docs and swagger-ui endpoints. Default: false."

[config."teku-testnet.conf".ivars."TEKU_CLI_REST_API_ENABLED"]
type = "string"
default = "true"
priority = "low"
summary = "Enables Beacon Rest API. Default: null."

[config."teku-testnet.conf".ivars."TEKU_CLI_REST_API_HOST_ALLOWLIST"]
type = "string"
default = ""
priority = "low"
summary = "Comma-separated list of hostnames to allow, or * to allow any host. Default: [127.0.0.1, localhost]."

[config."teku-testnet.conf".ivars."TEKU_CLI_REST_API_INTERFACE"]
type = "string"
default = ""
priority = "low"
summary = "Interface of Beacon Rest API. Default: 127.0.0.1."

[config."teku-testnet.conf".ivars."TEKU_CLI_REST_API_PORT"]
type = "string"
default = "$BASE_CONFIG_CL_RPC_PORT"
priority = "low"
summary = "Port number of Beacon Rest API."
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ package_hash=[
# { hash="228f338fa408c43acb1f08da4bb14062d38b7812", name= "eth-node-teku-testnet_0.0.1-1.dsc"},
{ hash="b35f46d5fb424aee57b5d666e61b2eff83543aad", name= "eth-node-teku-testnet_0.0.1.orig.tar.gz"},
# { hash="11da8cbe542c6445efd8d67fa5adfc00ecfd84cd", name= "eth-node-teku-testnet_0.0.1-1.debian.tar.xz"},
{ hash="27fac205423c95a4aa435fcea570c6eeee1bf2c0", name= "eth-node-teku-testnet_0.0.1-1_all.deb"},
{ hash="b8dd1f93ce968a47a453adf20dcf3db391da3245", name= "eth-node-teku-testnet_0.0.1-1_all.deb"},

]

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ export SOURCE_DATE_EPOCH=1720044000
dh $@

override_dh_dwz:

override_dh_prep:
mkdir debian/tmp
cp debian/eth-node-teku-testnet.eth-node-teku-testnet.service debian/tmp/eth-node-teku-testnet.service
chmod a+x debian/scripts/run-teku-service.sh
chmod a+x debian/scripts/run-teku.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash


exec /usr/lib/eth-node-teku-testnet/bin/run-teku.sh \
--conf-file /etc/eth-node-testnet/conf.d/testnet.conf \
--conf-file /etc/eth-node-teku-testnet/teku-testnet.conf
Loading

0 comments on commit 12ab9fc

Please sign in to comment.