mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-21 01:38:34 +02:00
Update installer to work with new domain split
This commit is contained in:
parent
82192fa180
commit
62ba797cd0
3 changed files with 30 additions and 9 deletions
|
@ -21,7 +21,7 @@ traefik:
|
||||||
|
|
||||||
gerbil:
|
gerbil:
|
||||||
start_port: 51820
|
start_port: 51820
|
||||||
base_endpoint: {{.Domain}}
|
base_endpoint: {{.DashboardDomain}}
|
||||||
use_subdomain: false
|
use_subdomain: false
|
||||||
block_size: 24
|
block_size: 24
|
||||||
site_block_size: 30
|
site_block_size: 30
|
||||||
|
|
|
@ -8,7 +8,7 @@ http:
|
||||||
routers:
|
routers:
|
||||||
# HTTP to HTTPS redirect router
|
# HTTP to HTTPS redirect router
|
||||||
main-app-router-redirect:
|
main-app-router-redirect:
|
||||||
rule: "Host(`{{.Domain}}`)"
|
rule: "Host(`{{.DashboardDomain}}`)"
|
||||||
service: next-service
|
service: next-service
|
||||||
entryPoints:
|
entryPoints:
|
||||||
- web
|
- web
|
||||||
|
@ -17,7 +17,7 @@ http:
|
||||||
|
|
||||||
# Next.js router (handles everything except API and WebSocket paths)
|
# Next.js router (handles everything except API and WebSocket paths)
|
||||||
next-router:
|
next-router:
|
||||||
rule: "Host(`{{.Domain}}`) && !PathPrefix(`/api/v1`)"
|
rule: "Host(`{{.DashboardDomain}}`) && !PathPrefix(`/api/v1`)"
|
||||||
service: next-service
|
service: next-service
|
||||||
entryPoints:
|
entryPoints:
|
||||||
- websecure
|
- websecure
|
||||||
|
@ -26,7 +26,7 @@ http:
|
||||||
|
|
||||||
# API router (handles /api/v1 paths)
|
# API router (handles /api/v1 paths)
|
||||||
api-router:
|
api-router:
|
||||||
rule: "Host(`{{.Domain}}`) && PathPrefix(`/api/v1`)"
|
rule: "Host(`{{.DashboardDomain}}`) && PathPrefix(`/api/v1`)"
|
||||||
service: api-service
|
service: api-service
|
||||||
entryPoints:
|
entryPoints:
|
||||||
- websecure
|
- websecure
|
||||||
|
@ -35,7 +35,7 @@ http:
|
||||||
|
|
||||||
# WebSocket router
|
# WebSocket router
|
||||||
ws-router:
|
ws-router:
|
||||||
rule: "Host(`{{.Domain}}`)"
|
rule: "Host(`{{.DashboardDomain}}`)"
|
||||||
service: api-service
|
service: api-service
|
||||||
entryPoints:
|
entryPoints:
|
||||||
- websecure
|
- websecure
|
||||||
|
|
|
@ -45,7 +45,10 @@ func main() {
|
||||||
// check if there is already a config file
|
// check if there is already a config file
|
||||||
if _, err := os.Stat("config/config.yml"); err != nil {
|
if _, err := os.Stat("config/config.yml"); err != nil {
|
||||||
config := collectUserInput(reader)
|
config := collectUserInput(reader)
|
||||||
createConfigFiles(config)
|
if err := createConfigFiles(config); err != nil {
|
||||||
|
fmt.Printf("Error creating config files: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
if !isDockerInstalled() && runtime.GOOS == "linux" {
|
if !isDockerInstalled() && runtime.GOOS == "linux" {
|
||||||
if shouldInstallDocker() {
|
if shouldInstallDocker() {
|
||||||
|
@ -104,7 +107,7 @@ func collectUserInput(reader *bufio.Reader) Config {
|
||||||
// Basic configuration
|
// Basic configuration
|
||||||
fmt.Println("\n=== Basic Configuration ===")
|
fmt.Println("\n=== Basic Configuration ===")
|
||||||
config.BaseDomain = readString(reader, "Enter your base domain (no subdomain e.g. example.com)", "")
|
config.BaseDomain = readString(reader, "Enter your base domain (no subdomain e.g. example.com)", "")
|
||||||
config.DashboardDomain = readString(reader, "Enter the domain for the Pangolin dashboard (e.g. example.com OR proxy.example.com)", config.BaseDomain)
|
config.DashboardDomain = readString(reader, "Enter the domain for the Pangolin dashboard", "pangolin."+config.BaseDomain)
|
||||||
config.LetsEncryptEmail = readString(reader, "Enter email for Let's Encrypt certificates", "")
|
config.LetsEncryptEmail = readString(reader, "Enter email for Let's Encrypt certificates", "")
|
||||||
|
|
||||||
// Admin user configuration
|
// Admin user configuration
|
||||||
|
@ -275,8 +278,26 @@ func createConfigFiles(config Config) error {
|
||||||
return fmt.Errorf("error walking config files: %v", err)
|
return fmt.Errorf("error walking config files: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the docker-compose.yml file to the root directory
|
// get the current directory
|
||||||
os.Rename("config/docker-compose.yml", "docker-compose.yml")
|
dir, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to get current directory: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
sourcePath := filepath.Join(dir, "config/docker-compose.yml")
|
||||||
|
destPath := filepath.Join(dir, "docker-compose.yml")
|
||||||
|
|
||||||
|
// Check if source file exists
|
||||||
|
if _, err := os.Stat(sourcePath); err != nil {
|
||||||
|
return fmt.Errorf("source docker-compose.yml not found: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to move the file
|
||||||
|
err = os.Rename(sourcePath, destPath)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to move docker-compose.yml from %s to %s: %v",
|
||||||
|
sourcePath, destPath, err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue