Skip to content

About

Server-run scripts for the CoNET CL daemon (cloned and pinned by commit on the target host)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

conet-cl-deploy

Runtime script for the CoNET CL fresh-daemon cutover (tool r6.3.8): stage P (read-only preflight) and stage B (first start).

Layout

  • cl_fresh_cutover/remote_cl_fresh_cutover.py: the script. Python 3.8+, standard library only.

The script references only public endpoints (GitHub, rpc1, publicrpc). It contains no private host, path, account or key location. The on-chain contract address it checks is a public value.

Prerequisites on the target host

  • Linux with systemd (/usr/bin/systemctl), /usr/bin/git, /usr/bin/npm and /usr/bin/python3.
  • A local CoNET L1 execution node answering JSON-RPC on a loopback address (URL given in the parameters).
  • A local beacon node answering the REST API on a loopback address (URL given in the parameters).
  • Outbound HTTPS to the GitHub repositories named in the pinned commit, for the clone and the head checks.
  • The operator's credential files and the signer socket at the paths named in the parameters.

How it runs

The target host clones this repository into a new directory made by mktemp (mode 0700), checks out the pinned commit, checks the sha256 of the script, and runs:

/usr/bin/python3 -I -S -B cl_fresh_cutover/remote_cl_fresh_cutover.py '<params JSON>'

No script is fed on stdin. The command-line argument holds the parameters only. On exit the clone directory is removed, and the script reports CLONE_DIR_REMOVED=yes on stderr when the directory is gone.

Parameters (JSON keys)

stage (P or B), release_name, releases_root, state_dir, state_file, lease_file, projection_file, projection_gid, challenge_socket, signer_socket, excluded_release_names, v1_unit_file_states_allowed, vdr_code_sha256_expected, vdr_impl_expected, approval_ref, p_receipt_sha256, local_rpc_url, local_beacon_url, key_array_expected, v1_unit, daemon_branch.

  • approval_ref must be CL-R6-P-<UTC> for stage P or CL-R6-B-<UTC> for stage B, where UTC is YYYYMMDDTHHMMZ.
  • local_rpc_url and local_beacon_url must be loopback URLs (IPv4 or IPv6 loopback host with an explicit port).
  • lease_file and challenge_socket must sit in the same directory as projection_file. That directory is the stop directory: it must not exist at stage P, and stage B creates it.
  • key_array_expected is the key-array name the daemon environment must carry exactly.
  • v1_unit is the systemd unit name of the v1 daemon on the host: characters A-Z a-z 0-9 @ . _ -, ending in .service.
  • daemon_branch is the branch of the daemon repository at the pinned commit, read by the head check.

Values are supplied by the operator outside this repository.

Public endpoints and the read-only policy

Chain queries use the local node first. A valid local answer is accepted without a second query. The public endpoints are tried only when the local query fails or does not verify, in this order:

  1. https://rpc1.conet.network
  2. https://publicrpc.conet.network

The public endpoints are read-only and are used for chain reads only. The daemon itself reads one RPC endpoint from its environment, so a daemon-side fallback is not provided by this script.

The beacon probe is one GET of /eth/v1/node/version at the local beacon. The output is a boolean and the elapsed time; the response body is not printed.

Output and exit codes

One JSON line on stdout. The output never contains environment values, credential paths, or the argument.

  • 0: PASS
  • 1: FAIL (nothing changed in stage P; in stage B, the failure happened before the unit was installed)
  • 3: HALTED_IN_PLACE (stage B stopped after a step; evidence is kept and nothing is rolled back)

Stage P (read-only)

Checks the v1 unit and its processes, the effective v1 Environment= names (read from the unit, not from a file; the v1 unit must have no EnvironmentFile) and credential files, the deposit RPC address (must equal local_rpc_url), the key-array name, the optional beacon address (must be loopback), the GitHub heads of this repository and of the daemon repository, the target paths, the runtime tools, the chain state (local node first, see above), and the local beacon probe. Any uncertain result is a FAIL.

Stage B

Re-runs stage P, then clones the daemon repository at the frozen commit, builds it twice, creates the stop directory and the state directory, installs the unit (Restart=no, not enabled; the whitelisted values are written as explicit Environment= lines, with no EnvironmentFile), makes one start, reads back the first-start receipt, and removes the one-shot drop-in. The drop-in removal is always attempted after a start or a halt. Service-user steps (git clone/checkout, npm ci, archive extract, frozen-source check, build) run under runuser with HOME set to the release directory via /usr/bin/env; npm ci also uses --cache under that directory so cache and logs stay inside the release tree. After the package is promoted, B5 recursively lchowns the package tree to the service user (without following symlinks) and re-checks MANIFEST.expected.sha256 as that user so WorkingDirectory and ExecStartPre remain readable.

About

Server-run scripts for the CoNET CL daemon (cloned and pinned by commit on the target host)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages