Phase 10, part 9: the server package
compose.server.yaml runs Supermarket behind Caddy (HTTPS from Let's Encrypt, Caddy's own CA or the team's), with Postgres on an internal network and a nightly pg_dump kept two weeks. install-server.sh asks for the domain, certificate and mail server, makes the secret key and database password, starts it all and prints the setup link. Settings → Backups lists the dumps on a server, and how the operator restores one. Checked end to end in Docker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+18
-8
@@ -252,9 +252,12 @@ func run(log *slog.Logger) error {
|
||||
// Hermes' Anthropic key and model, if the user chose to share them
|
||||
ai.SharedFile = filepath.Join(dataDir, "hermes-ai.json")
|
||||
// What Hermes' CRM job checks before it runs; see internal/crm.
|
||||
crm.StateFile = filepath.Join(dataDir, "crm-state")
|
||||
if err := crm.WriteState(database, time.Now()); err != nil {
|
||||
log.Error("writing the CRM state file", "err", err)
|
||||
local := cfg.Edition == config.Local
|
||||
if local {
|
||||
crm.StateFile = filepath.Join(dataDir, "crm-state")
|
||||
if err := crm.WriteState(database, time.Now()); err != nil {
|
||||
log.Error("writing the CRM state file", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
// The local edition keeps its keys and tokens in a file beside the
|
||||
@@ -352,11 +355,15 @@ func run(log *slog.Logger) error {
|
||||
srv.Restart = stop
|
||||
|
||||
errCh := make(chan error, 2)
|
||||
go func() {
|
||||
if err := mcpserver.ServeSocket(ctx, database, version, mcpSocket, log); err != nil {
|
||||
errCh <- fmt.Errorf("MCP socket %s: %w", mcpSocket, err)
|
||||
}
|
||||
}()
|
||||
// Hermes on this computer reaches the app through a socket in the data
|
||||
// folder; on a server, agents use /mcp (Phase 11).
|
||||
if local {
|
||||
go func() {
|
||||
if err := mcpserver.ServeSocket(ctx, database, version, mcpSocket, log); err != nil {
|
||||
errCh <- fmt.Errorf("MCP socket %s: %w", mcpSocket, err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
go runner.CheckIns(ctx)
|
||||
go srv.RunScheduler(ctx)
|
||||
go srv.RunImports(ctx)
|
||||
@@ -370,6 +377,9 @@ func run(log *slog.Logger) error {
|
||||
// A sync falls due, and a claim times out, without anything being
|
||||
// written: refresh the state file each minute.
|
||||
go func() {
|
||||
if !local {
|
||||
return
|
||||
}
|
||||
t := time.NewTicker(time.Minute)
|
||||
defer t.Stop()
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user