Review estimates the memory and disk the setup needs, and checks the server

A 2 GB server passes the old fixed checks and then swaps itself to death
running Jitsi; the estimate grows with what's turned on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vvvomitandClaude Opus 5.5 committed 2026-10-29 04:59:51 +03:30
1 parent 9a75789ca1
commit 269a348515
8 files changed
+96 -13

No files matched your search

+4 -2
View File
@@ -176,8 +176,10 @@ or the [Telegram group](https://t.me/+6UwIu9F4gZQxNjM0).
# CentOS Stream, Fedora and Arch containers (needs Docker and Ansible)
INTERZONE_CONTAINER_TESTS=1 go test ./internal/deploy -run PlayContainers -v -timeout 30m
```
- **Checks before it touches anything.** The Review screen logs into the
server and checks root access, OS, CPU, Python, memory, disk and ports
- **Checks before it touches anything.** The Review screen estimates the
memory and disk what you've turned on needs (rough numbers for a small
server, before media), logs into the server and checks root access, OS,
CPU, Python, memory and disk against that estimate, and ports
80/443 (and 8448 for Synapse and Dendrite), then resolves every DNS record the setup needs and compares
it with the server's addresses; `z` shows the records to create as
zone-file lines to paste into your DNS provider. It also lists the ports a firewall in
+49
View File
@@ -0,0 +1,49 @@
package config
import "interzone/internal/catalog"
// Rough memory each part takes once running, in MB: what the services use
// on a small server with a handful of users, not their peaks.
var (
homeserverMB = map[string]int{"synapse": 1024, "dendrite": 512, "conduit": 256, "continuwuity": 256, "tuwunel": 256}
componentMB = map[string]int{
"jitsi": 1536, "monitoring": 768, "media-repo": 256, "element-call": 384, "matrix-rtc": 384,
"draupnir": 256, "mjolnir": 256, "meowlnir": 128, "hookshot": 192, "maubot": 160, "baibot": 128,
"etherpad": 192, "mas": 128, "coturn": 64, "exim": 32, "sygnal": 64, "ntfy": 32, "goofys": 64,
"corporal": 64, "pantalaimon": 128, "usage-exporter": 32, "auto-compressor": 64, "borg": 128,
// settings or files, not services of their own
"bridges-e2ee": 0, "bridges-relay": 0, "double-puppet": 0, "rest-auth": 0, "shared-secret-auth": 0,
"ldap-auth": 0, "simple-antispam": 0, "telemetry": 0, "base-domain": 0, "s3-provider": 0,
"cleanup": 0, "external-postgres": 0, "ddclient": 8, "uvs": 64, "ketesa": 16, "element-admin": 16,
}
categoryMB = map[string]int{"Bridges": 128, "Bots": 96, "Clients": 16}
)
// Estimate is about how much memory (MB) and disk (GB) the setup needs to
// run, before any media or messages: the homeserver, Postgres, Traefik and
// every enabled component, and the container images on disk.
func (c *Config) Estimate() (memMB, diskGB int) {
memMB = homeserverMB[c.Homeserver] + 64 // Traefik and the rest of the base
if !c.Components["external-postgres"] {
memMB += 256
}
images := 4
for _, comp := range catalog.Components {
if !c.Enabled(comp) {
continue
}
mb, ok := componentMB[comp.ID]
if !ok {
mb = categoryMB[comp.Category]
if mb == 0 {
mb = 64
}
}
memMB += mb
if mb > 0 {
images++
}
}
// About 300 MB of images each, and room for the database and logs to start.
return memMB, 5 + images*3/10
}
+20
View File
@@ -0,0 +1,20 @@
package config
import "testing"
func TestEstimate(t *testing.T) {
c := Default()
c.Homeserver, c.Components = "synapse", map[string]bool{}
base, baseDisk := c.Estimate()
if base != 1024+64+256 || baseDisk < 5 {
t.Errorf("bare Synapse: %d MB, %d GB", base, baseDisk)
}
c.Components = map[string]bool{"jitsi": true, "telegram": true, "element": true, "bridges-e2ee": true}
if mem, _ := c.Estimate(); mem != base+1536+128+16 {
t.Errorf("with Jitsi, a bridge and Element: %d MB", mem)
}
c.Components["external-postgres"] = true
if mem, _ := c.Estimate(); mem != base+1536+128+16-256 {
t.Errorf("external Postgres still counted: %d MB", mem)
}
}
+7 -2
View File
@@ -152,24 +152,29 @@ func ServerChecks(c *config.Config) []Finding {
add("Python", Pass, "%s", facts["python"])
}
needMem, needDisk := c.Estimate()
if mem, err := strconv.Atoi(facts["mem"]); err == nil {
switch {
case mem < 900:
add("Memory", Fail, "%d MB; at least 1 GB is needed, 2 GB recommended", mem)
case mem < needMem:
add("Memory", Warn, "%.1f GB; what you've turned on uses about %.1f GB, so add swap or memory, or turn something off", float64(mem)/1024, float64(needMem)/1024)
case mem < 1800:
add("Memory", Warn, "%d MB; 2 GB or more is recommended", mem)
default:
add("Memory", Pass, "%.1f GB", float64(mem)/1024)
add("Memory", Pass, "%.1f GB (about %.1f GB in use once deployed)", float64(mem)/1024, float64(needMem)/1024)
}
}
if disk, err := strconv.Atoi(facts["disk"]); err == nil {
switch {
case disk < 3000:
add("Disk space", Fail, "%.1f GB free on /; container images alone need several GB", float64(disk)/1024)
case disk < needDisk*1024:
add("Disk space", Warn, "%.1f GB free on /; the images and a start of data take about %d GB, and media grows from there", float64(disk)/1024, needDisk)
case disk < 10000:
add("Disk space", Warn, "%.1f GB free on /; 10 GB or more is recommended", float64(disk)/1024)
default:
add("Disk space", Pass, "%.0f GB free", float64(disk)/1024)
add("Disk space", Pass, "%.0f GB free (about %d GB taken once deployed, before media)", float64(disk)/1024, needDisk)
}
}
+7
View File
@@ -157,6 +157,12 @@ func (s *reviewScreen) previewTitle() string {
sGood.Render(fmt.Sprintf("+%d", a)) + " " + sBad.Render(fmt.Sprintf("-%d", r))
}
// estimate is "2.4 GB RAM, 8 GB disk".
func estimate(c *config.Config) string {
mem, disk := c.Estimate()
return fmt.Sprintf("%.1f GB RAM, %d GB disk", float64(mem)/1024, disk)
}
// zoneMsg carries the DNS records to show in the preview.
type zoneMsg []string
@@ -251,6 +257,7 @@ func (s *reviewScreen) view(w, h int) string {
kv("◆", "Homeserver", homeserverName(c.Homeserver)),
kv("⌂", "Install on", where),
kv("▦", "Components", fmt.Sprint(n)),
kv("≈", "Needs about", estimate(c)),
kv("◈", "Certificates", sslLabels[indexOf(sslModes, c.SSL.Mode)]),
kv("⇩", "Images from", map[bool]string{true: c.Sources.RegistryPrefix, false: "upstream registries"}[c.Sources.UseRegistry]),
}
+7 -7
View File
@@ -8,12 +8,13 @@
│ ▌ ◉ Review ││ │ ◆ Homeserver Synapse │ │
│ ○ Deploy ││ │ ⌂ Install on this machine │ │
│ ││ │ ▦ Components 4 │ │
│ ▸ Manage example.org ││ │ ◈ Certificates Let's Encrypt │ │
│ ││ │ ⇩ Images from mechatok.g0th.ir/ │ │
│ ▸ Mirrors ││ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ││ │
│ ▾ Servers ││ ╭──────────────────────────────────────────────────────────────────────╮ │
│ ● example.org ││ │ ✓ Ready to deploy. │ │
│ ▸ Manage example.org ││ │ ≈ Needs about 1.4 GB RAM, 7 GB disk │ │
│ ││ │ ◈ Certificates Let's Encrypt │ │
│ ▸ Mirrors ││ │ ⇩ Images from mechatok.g0th.ir/ │ │
│ ││ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ▾ Servers ││ │
│ ● example.org ││ ╭──────────────────────────────────────────────────────────────────────╮ │
│ ││ │ ✓ Ready to deploy. │ │
│ ││ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ││ │
│ ││ Pre-deploy checks ⠋ checking the server and DNS… │
@@ -28,7 +29,6 @@
│ ││ Coturn (TURN for calls) 3478, 5349/tcp; 3478, 5349, 49152-49172/udp │
│ ││ │
│ ││ │
│ ││ │
│ ◫ auto (wide) ctrl+l ││ │
│ ◐ interzone ctrl+y ││ │
│ ◂ fold ctrl+b menu ││ │
+1 -1
View File
@@ -6,6 +6,7 @@
│ ◆ Homeserver Synapse │
│ ⌂ Install on this machine │
│ ▦ Components 4 │
│ ≈ Needs about 1.4 GB RAM, 7 GB disk │
│ ◈ Certificates Let's Encrypt │
│ ⇩ Images from mechatok.g0th.ir/ │
╰──────────────────────────────────────────╯
@@ -36,5 +37,4 @@
‹ back ≡ menu deploy › ⋯
+1 -1
View File
@@ -5,6 +5,7 @@
│ ◆ Homeserver Synapse │
│ ⌂ Install on this machine │
│ ▦ Components 4 │
│ ≈ Needs about 1.4 GB RAM, 7 GB disk │
│ ◈ Certificates Let's Encrypt │
│ ⇩ Images from mechatok.g0th.ir/ │
╰────────────────────────────────────────────╯
@@ -16,5 +17,4 @@
Pre-deploy checks
⠋ checking the server and DNS…
○ Synapse
‹ back ≡ menu deploy › ⋯