feat(install): build the Flutter web app in Docker, optional ./install --apk, chosen web password, startup report

This commit is contained in:
2026-10-23 21:45:14 +01:00
parent 3136132144
commit 7958d1830e
16 changed files with 776 additions and 29 deletions
+123
View File
@@ -0,0 +1,123 @@
package main
import (
"fmt"
"io"
"os"
"sort"
"strings"
"git.a-wan.net/alan/pipelines/internal/buildinfo"
"git.a-wan.net/alan/pipelines/internal/harness"
"git.a-wan.net/alan/pipelines/internal/protocol"
)
// startup is what the server reports about itself once it is configured.
type startup struct {
Build buildinfo.Info
Addr string
Database string
Artifacts string
Authoring bool
OpenCode protocol.ServiceStatus
Chat []string
Harnesses harness.ListView
HarnessErr error
WebURL string
}
// banner writes the server and backend summary. `pipelines start` prints the
// latest one from the server log, so its first and last lines are markers.
func banner(w io.Writer, s startup) {
version := s.Build.Version
if version == "" {
version = "dev"
}
commit := s.Build.Commit
if len(commit) > 12 {
commit = commit[:12]
}
if s.Build.Dirty != nil && *s.Build.Dirty {
commit += " (modified)"
}
row := func(label, value string) { fmt.Fprintf(w, " %-10s %s\n", label, value) }
fmt.Fprintf(w, "== Pipelines server %s\n", version)
if commit != "" {
row("Commit", commit)
}
row("API", "http://"+s.Addr+" (WebSocket /connect)")
if s.WebURL != "" {
row("Web", s.WebURL)
}
row("Database", s.Database)
row("Artifacts", s.Artifacts)
if s.Authoring {
row("Authoring", "enabled (pipelines can be published)")
} else {
row("Authoring", "disabled (execution only)")
}
fmt.Fprintln(w, "== Backends")
opencode := s.OpenCode.Health
switch s.OpenCode.Health {
case "endpoint":
opencode = "attached to " + s.OpenCode.URL
case "spawned":
opencode = "own instance at " + s.OpenCode.URL
case "fallback":
opencode = s.OpenCode.URL + " unreachable; using the server's own instance"
}
row("OpenCode", opencode)
if len(s.Chat) == 0 {
row("Chat", "unavailable")
} else {
row("Chat", strings.Join(s.Chat, ", "))
}
if s.HarnessErr != nil {
row("Harnesses", "unreadable: "+s.HarnessErr.Error())
} else if len(s.Harnesses.Profiles) == 0 {
row("Harnesses", "none configured")
} else {
names := make([]string, 0, len(s.Harnesses.Profiles))
for name := range s.Harnesses.Profiles {
names = append(names, name)
}
sort.Strings(names)
for _, name := range names {
profile := s.Harnesses.Profiles[name]
label := ""
if name == s.Harnesses.Default {
label = "Default"
}
detail := name
if model := firstNonEmpty(profile.PipelineModel, profile.Model); model != "" {
detail += " · " + model
}
if profile.Mode != "" {
detail += " · " + profile.Mode
}
if profile.Executable != "" {
detail += " · " + profile.Executable
}
if label == "" {
label = "Harness"
}
row(label, detail)
}
}
fmt.Fprintln(w, "==")
}
func firstNonEmpty(values ...string) string {
for _, value := range values {
if value != "" {
return value
}
}
return ""
}
func printBanner(s startup) {
s.Harnesses, s.HarnessErr = harness.List()
s.WebURL = os.Getenv("PIPELINES_WEB_PUBLIC_URL")
banner(os.Stdout, s)
}
+7
View File
@@ -12,6 +12,7 @@ import (
"syscall"
"time"
"git.a-wan.net/alan/pipelines/internal/buildinfo"
"git.a-wan.net/alan/pipelines/internal/opencode"
"git.a-wan.net/alan/pipelines/internal/paths"
"git.a-wan.net/alan/pipelines/internal/pipeline"
@@ -142,6 +143,12 @@ func main() {
log.Printf("shutdown: %v", err)
}
}()
var chatNames []string
if len(chats.Backends()) > 0 {
chatNames = chats.Backends()
}
printBanner(startup{Build: buildinfo.Current(), Addr: *addr, Database: *db, Artifacts: artifactsRoot,
Authoring: *allowAuthoring, OpenCode: openCodeStatus, Chat: chatNames})
log.Printf("listening on %s (WebSocket endpoint: /connect)", *addr)
if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
log.Fatal(err)