feat: add go-process daemon wrapper for blockchain service
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:
parent
65baebba47
commit
35312476ac
1 changed files with 27 additions and 0 deletions
27
service_process.go
Normal file
27
service_process.go
Normal 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",
|
||||
},
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue