Eliminate Python dependency: embed frontend assets in odoo-go

- Copy all OWL frontend assets (JS/CSS/XML/fonts/images) into frontend/
  directory (2925 files, 43MB) — no more runtime reads from Python Odoo
- Replace OdooAddonsPath config with FrontendDir pointing to local frontend/
- Rewire bundle.go, static.go, templates.go, webclient.go to read from
  frontend/ instead of external Python Odoo addons directory
- Auto-detect frontend/ and build/ dirs relative to binary in main.go
- Delete obsolete Python helper scripts (tools/*.py)

The Go server is now fully self-contained: single binary + frontend/ folder.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc
2026-03-31 23:09:12 +02:00
parent 0ed29fe2fd
commit 8741282322
2933 changed files with 280644 additions and 264 deletions

View File

@@ -12,6 +12,7 @@ import (
"log"
"os"
"os/signal"
"path/filepath"
"syscall"
"github.com/jackc/pgx/v5/pgxpool"
@@ -47,6 +48,26 @@ func main() {
cfg := tools.DefaultConfig()
cfg.LoadFromEnv()
// Auto-detect frontend/ directory relative to the binary if not set
if cfg.FrontendDir == "" {
exe, _ := os.Executable()
candidate := filepath.Join(filepath.Dir(exe), "frontend")
if _, err := os.Stat(candidate); err != nil {
// Try relative to working directory
candidate = "frontend"
}
cfg.FrontendDir = candidate
}
// Auto-detect build/ directory
if cfg.BuildDir == "" {
exe, _ := os.Executable()
candidate := filepath.Join(filepath.Dir(exe), "build")
if _, err := os.Stat(candidate); err != nil {
candidate = "build"
}
cfg.BuildDir = candidate
}
log.Printf("odoo: Odoo Go Server 19.0")
log.Printf("odoo: database: %s@%s:%d/%s", cfg.DBUser, cfg.DBHost, cfg.DBPort, cfg.DBName)
@@ -87,6 +108,12 @@ func main() {
log.Fatalf("odoo: schema init failed: %v", err)
}
// Migrate schema: add any missing columns for newly registered fields
log.Println("odoo: running schema migration...")
if err := service.MigrateSchema(ctx, pool); err != nil {
log.Printf("odoo: schema migration warning: %v", err)
}
// Check if setup is needed (first boot)
if service.NeedsSetup(ctx, pool) {
log.Println("odoo: database is empty — setup wizard will be shown at /web/setup")