edge

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package edge generates the per-project artefacts the long-running containers read: a caddy site file and a pgweb bookmark.

Both are plain files in DRAGONRUN_HOME, mounted read-only into the containers. Registering a project therefore never restarts the stack -- caddy gets a reload, pgweb picks bookmarks up on next page load.

Index

Constants

This section is empty.

Variables

View Source
var ServiceHosts = map[string]string{
	"mail":  "mailpit:8025",
	"pgweb": "pgweb:8081",
}

ServiceHosts are the built-in UIs dragonrun serves under its own domain, so you never have to remember a port. They proxy to the CONTAINERS by service name -- caddy shares a network with them -- rather than back out through the host's published ports.

These are browser URLs, which is why a hostname is fine here while the database and SMTP DSNs deliberately stay on localhost: a browser URL failing off-network is a mild annoyance, an app failing to boot is not.

Functions

func DeleteCA

func DeleteCA(fp string) error

DeleteCA removes one certificate from the system keychain by fingerprint.

func Fingerprint

func Fingerprint(path string) (string, error)

Fingerprint returns the SHA-1 of a PEM certificate, formatted the way `security find-certificate -Z` prints it.

func KeychainCAs

func KeychainCAs() ([]string, error)

KeychainCAs lists every trusted caddy root, by fingerprint. Used to find roots left behind when the caddy volume was recreated.

func Reload

func Reload() error

Reload asks caddy to re-read its config in place. A restart would drop in-flight requests and, more annoyingly, re-issue certificates.

func RemoveBookmark

func RemoveBookmark(name string) error

func RemoveSite

func RemoveSite(name string) error

func RootCA

func RootCA() (string, error)

RootCA copies caddy's local CA out of the container so it can be trusted by the host. Until this is trusted, every https://*.test hit shows a warning.

func TrustCA

func TrustCA(path string) error

TrustCA installs caddy's root into the system keychain. Requires sudo, and deliberately shells out visibly so the password prompt is not a surprise.

func UntrustCA

func UntrustCA(rootCrt string) (bool, error)

UntrustCA removes dragonrun's caddy root from the system keychain.

It matches on the certificate's SHA-1 fingerprint, not its name: the label carries a year ("Caddy Local Authority - 2026 ECC Root") and any other Caddy on this machine -- one of the per-project Caddyfiles, say -- produces a root with the same name. Deleting by name could untrust someone else's CA.

func WriteBookmark

func WriteBookmark(c *registry.Config, p registry.Project) error

WriteBookmark points pgweb at the project's control database as the cluster superuser, so tenant databases created later are reachable from the UI's database switcher without any further registration.

It connects to postgres directly rather than through pgbouncer: browsing is a session-oriented workload and transaction pooling would only get in the way.

func WriteServiceSites

func WriteServiceSites(c *registry.Config) error

WriteServiceSites renders the built-in hostnames. One file, rewritten whenever the stack comes up, named with a leading underscore so it can never collide with a project's own site file.

func WriteSite

func WriteSite(p registry.Project) error

WriteSite renders the reverse proxy entry. The upstream is host.docker.internal because the app runs on the HOST under mprocs -- caddy is the only part of the request path that lives in docker.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL