Give Hammerhead its own edge with a built-in dashboard route; setup.sh installs it with Blacktip instead of Caddy
HAMMERHEAD_SELF_DOMAIN creates an edge for this machine, writes its token to <data>/self-edge.env and adds an https route for the dashboard to that edge's config, so no reverse proxy is needed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9ad690def0
commit
536284ec75
8 files changed
+342
-74
No files matched your search
@@ -111,6 +111,8 @@ type Settings struct {
|
||||
AcmeEmail string `json:"acmeEmail"`
|
||||
AcmeStaging bool `json:"acmeStaging"`
|
||||
SMTP SMTP `json:"smtp"`
|
||||
// SelfEdgeID is this server's own edge (see HAMMERHEAD_SELF_DOMAIN).
|
||||
SelfEdgeID string `json:"selfEdgeId,omitempty"`
|
||||
}
|
||||
|
||||
type Secret struct {
|
||||
@@ -170,6 +172,14 @@ type Options struct {
|
||||
AlertInterval time.Duration // how often alerts are evaluated; 0 = 15s
|
||||
AlertDebounce time.Duration // overrides the per-organization delay before alerting (tests)
|
||||
OfflineAfter time.Duration // how long an edge or site may stay silent before it counts as down; 0 = 90s
|
||||
|
||||
// SelfDomain (HAMMERHEAD_SELF_DOMAIN) gives this server an edge of its own, with a built-in
|
||||
// https route for the dashboard at that name, so no reverse proxy is needed in front of it.
|
||||
// SelfTarget is the address Hammerhead listens on (e.g. 127.0.0.1:8080); SelfTunnel is the
|
||||
// edge's public WireGuard endpoint (default <SelfDomain>:51820).
|
||||
SelfDomain string
|
||||
SelfTarget string
|
||||
SelfTunnel string
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
@@ -258,6 +268,13 @@ func New(dir string, opts Options) (*Server, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if opts.SelfDomain != "" && opts.SelfTunnel == "" {
|
||||
s.opts.SelfTunnel = opts.SelfDomain + ":51820"
|
||||
}
|
||||
if err := s.ensureSelfEdge(); err != nil {
|
||||
db.Close()
|
||||
return nil, err
|
||||
}
|
||||
if err := s.save(); err != nil {
|
||||
db.Close()
|
||||
return nil, err
|
||||
|
||||
Reference in new issue
Block a user