From 2d78a4b628ef87755feff1868947a26b9ef528af Mon Sep 17 00:00:00 2001 From: Owen Date: Thu, 4 Jun 2026 11:21:40 -0700 Subject: [PATCH] Fix installer --- install/config/config.yml | 6 ++-- install/config/docker-compose.yml | 53 ++++++++++++------------------- install/config/privateConfig.yml | 6 ++-- install/main.go | 11 ++++--- 4 files changed, 31 insertions(+), 45 deletions(-) diff --git a/install/config/config.yml b/install/config/config.yml index 85dbc944f..f64190fec 100644 --- a/install/config/config.yml +++ b/install/config/config.yml @@ -38,7 +38,5 @@ flags: disable_user_create_org: false allow_raw_resources: true -{{if .IsPostgreSQL}} -postgres: - connection_string: postgresql://pangolin:{{.IsPostgreSQLPass}}@postgres:5432/pangolin -{{end}} +{{if .IsPostgreSQL}}postgres: + connection_string: postgresql://pangolin:{{.IsPostgreSQLPass}}@postgres:5432/pangolin{{end}} diff --git a/install/config/docker-compose.yml b/install/config/docker-compose.yml index fe6a41644..96b15ce47 100644 --- a/install/config/docker-compose.yml +++ b/install/config/docker-compose.yml @@ -7,23 +7,17 @@ services: deploy: resources: limits: - memory: 1g + memory: 2g reservations: - memory: 256m -{{if or .IsPostgreSQL .IsRedis}} - depends_on: - {{if .IsPostgreSQL}} - postgres: - condition: service_healthy - {{end}} - {{if .IsRedis}} - redis: - condition: service_healthy - {{end}} + memory: 512m + {{if or .IsPostgreSQL .IsRedis}}depends_on: + {{if .IsPostgreSQL}}postgres: + condition: service_healthy{{end}} + {{if .IsRedis}}redis: + condition: service_healthy{{end}} networks: - default - - backend -{{end}} + - backend{{end}} volumes: - ./config:/app/config healthcheck: @@ -31,8 +25,8 @@ services: interval: "10s" timeout: "10s" retries: 15 -{{if .InstallGerbil}} - gerbil: + + {{if .InstallGerbil}}gerbil: image: docker.io/fosrl/gerbil:{{.GerbilVersion}} container_name: gerbil restart: unless-stopped @@ -53,17 +47,16 @@ services: - 21820:21820/udp - 443:443 - 443:443/udp # For http3 QUIC if desired - - 80:80 -{{end}} + - 80:80{{end}} + traefik: image: docker.io/traefik:v3.6 container_name: traefik restart: unless-stopped -{{if .InstallGerbil}} network_mode: service:gerbil # Ports appear on the gerbil service{{end}}{{if not .InstallGerbil}} + {{if .InstallGerbil}}network_mode: service:gerbil # Ports appear on the gerbil service{{end}}{{if not .InstallGerbil}} ports: - 443:443 - - 80:80 -{{end}} + - 80:80{{end}} depends_on: pangolin: condition: service_healthy @@ -74,8 +67,7 @@ services: - ./config/letsencrypt:/letsencrypt # Volume to store the Let's Encrypt certificates - ./config/traefik/logs:/var/log/traefik # Volume to store Traefik logs -{{if .IsPostgreSQL}} - postgres: + {{if .IsPostgreSQL}}postgres: image: postgres:18 container_name: postgres restart: unless-stopped @@ -91,11 +83,9 @@ services: timeout: 5s retries: 5 networks: - - backend -{{end}} + - backend{{end}} -{{if .IsRedis}} - redis: + {{if .IsRedis}}redis: image: redis:8-trixie container_name: redis restart: unless-stopped @@ -113,17 +103,14 @@ services: retries: 3 start_period: 10s networks: - - backend -{{end}} + - backend{{end}} networks: default: driver: bridge name: pangolin_frontend {{if .EnableIPv6}} enable_ipv6: true{{end}} -{{if or .IsPostgreSQL .IsRedis}} - backend: +{{if or .IsPostgreSQL .IsRedis}} backend: driver: bridge name: pangolin_backend - internal: true -{{end}} + internal: true{{end}} diff --git a/install/config/privateConfig.yml b/install/config/privateConfig.yml index 58a4c9435..1afe55c1c 100644 --- a/install/config/privateConfig.yml +++ b/install/config/privateConfig.yml @@ -1,6 +1,4 @@ -{{if .IsRedis}} -redis: +{{if .IsRedis}}redis: host: "redis" port: 6379 - password: "{{.IsRedisPass}}" -{{end}} + password: "{{.IsRedisPass}}"{{end}} diff --git a/install/main.go b/install/main.go index 5687f6f5d..001f09a52 100644 --- a/install/main.go +++ b/install/main.go @@ -71,9 +71,12 @@ const ( Undefined SupportedContainer = "undefined" ) +var redisFlag *bool + func main() { crowdsecFlag := flag.Bool("crowdsec", false, "Enable the CrowdSec installation prompt") + redisFlag = flag.Bool("redis", false, "Install Redis as cacheing solution. Required for HA. Not required for the Enterprise version.") flag.Parse() // print a banner about prerequisites - opening port 80, 443, 51820, and 21820 on the VPS and firewall and pointing your domain to the VPS IP with a records. Docs are at http://localhost:3000/Getting%20Started/dns-networking @@ -491,13 +494,13 @@ func collectUserInput() Config { config.IsEnterprise = readBoolNoDefault("Do you want to install the Enterprise version of Pangolin? The EE is free for personal use or for businesses making less than 100k USD annually.") if config.IsEnterprise { - config.IsRedis = readBool("Do you want to run the Redis containers locally? Required for HA.") - if config.IsRedis { + if *redisFlag { + config.IsRedis = true config.IsRedisPass = readPassword("Enter a unique password for the Redis service.") } } - config.IsPostgreSQL = readBool("Do you want to run the PostgreSQL containers locally? Otherwise, default to the local SQLite database only.", false) + config.IsPostgreSQL = readBool("Do you want to use PostgreSQL (not recommended for most users)?", false) if config.IsPostgreSQL { config.IsPostgreSQLPass = readPassword("Enter a unique password for the PostgreSQL pangolin user.") } @@ -544,7 +547,7 @@ func collectUserInput() Config { fmt.Println("\n=== Advanced Configuration ===") config.EnableIPv6 = readBool("Is your server IPv6 capable?", true) - config.EnableMaxMind = readBool("Do you want to download the MaxMind GeoLite2 Country and ADN databases for blocking functionality?", true) + config.EnableMaxMind = readBool("Do you want to download the MaxMind GeoLite2 Country and ASN databases for blocking functionality?", true) if config.DashboardDomain == "" { fmt.Println("Error: Dashboard Domain name is required")