feat: add go-process daemon wrapper for blockchain service
Some checks failed
Security Scan / security (push) Successful in 13s
Test / Test (push) Failing after 34s

NewDaemonProcess creates a managed daemon with:
- PID file (single-instance enforcement)
- Health endpoint on :47942
- Process registry entry

Replaces raw http.ListenAndServe in service.go lifecycle.
go-process handles signals, graceful shutdown, health checks.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 04:16:34 +01:00
parent 65baebba47
commit 35312476ac
No known key found for this signature in database
GPG key ID: AF404715446AEB41

27
service_process.go Normal file
View file

@ -0,0 +1,27 @@
// Copyright (c) 2017-2026 Lethean (https://lt.hn)
// SPDX-License-Identifier: EUPL-1.2
package blockchain
import (
"dappco.re/go/core"
"dappco.re/go/core/process"
)
// NewDaemonProcess creates a go-process managed daemon for the blockchain service.
//
// d := blockchain.NewDaemonProcess(dataDir)
// d.Start()
// d.SetReady(true)
// d.Run(ctx)
func NewDaemonProcess(dataDir string) *process.Daemon {
return process.NewDaemon(process.DaemonOptions{
PIDFile: core.JoinPath(dataDir, "blockchain.pid"),
HealthAddr: ":47942",
Registry: process.DefaultRegistry(),
RegistryEntry: process.DaemonEntry{
Code: "dappco.re/go/core/blockchain",
Daemon: "chain",
},
})
}