mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-09 12:24:40 +02:00
Local sites working
This commit is contained in:
parent
4c7581df4f
commit
161e87dbda
4 changed files with 109 additions and 83 deletions
|
@ -11,6 +11,7 @@ services:
|
|||
timeout: "3s"
|
||||
retries: 5
|
||||
|
||||
{{if .InstallGerbil}}
|
||||
gerbil:
|
||||
image: fosrl/gerbil:{{.GerbilVersion}}
|
||||
container_name: gerbil
|
||||
|
@ -32,12 +33,20 @@ services:
|
|||
- 51820:51820/udp
|
||||
- 443:443 # Port for traefik because of the network_mode
|
||||
- 80:80 # Port for traefik because of the network_mode
|
||||
{{end}}
|
||||
|
||||
traefik:
|
||||
image: traefik:v3.1
|
||||
container_name: traefik
|
||||
restart: unless-stopped
|
||||
{{if .InstallGerbil}}
|
||||
network_mode: service:gerbil # Ports appear on the gerbil service
|
||||
{{end}}
|
||||
{{if not .InstallGerbil}}
|
||||
ports:
|
||||
- 443:443
|
||||
- 80:80
|
||||
{{end}}
|
||||
depends_on:
|
||||
pangolin:
|
||||
condition: service_healthy
|
||||
|
|
|
@ -41,6 +41,7 @@ type Config struct {
|
|||
EmailSMTPUser string
|
||||
EmailSMTPPass string
|
||||
EmailNoReply string
|
||||
InstallGerbil bool
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -64,7 +65,7 @@ func main() {
|
|||
}
|
||||
|
||||
if !isDockerInstalled() && runtime.GOOS == "linux" {
|
||||
if shouldInstallDocker() {
|
||||
if readBool(reader, "Docker is not installed. Would you like to install it?", true) {
|
||||
installDocker()
|
||||
}
|
||||
}
|
||||
|
@ -140,6 +141,7 @@ func collectUserInput(reader *bufio.Reader) Config {
|
|||
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", "pangolin."+config.BaseDomain)
|
||||
config.LetsEncryptEmail = readString(reader, "Enter email for Let's Encrypt certificates", "")
|
||||
config.InstallGerbil = readBool(reader, "Do you want to use Gerbil to allow tunned connections", true)
|
||||
|
||||
// Admin user configuration
|
||||
fmt.Println("\n=== Admin User Configuration ===")
|
||||
|
@ -340,13 +342,6 @@ func createConfigFiles(config Config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func shouldInstallDocker() bool {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
fmt.Print("Would you like to install Docker? (yes/no): ")
|
||||
response, _ := reader.ReadString('\n')
|
||||
return strings.ToLower(strings.TrimSpace(response)) == "yes"
|
||||
}
|
||||
|
||||
func installDocker() error {
|
||||
// Detect Linux distribution
|
||||
cmd := exec.Command("cat", "/etc/os-release")
|
||||
|
|
|
@ -123,6 +123,17 @@ export async function createTarget(
|
|||
);
|
||||
}
|
||||
|
||||
let newTarget: Target[] = [];
|
||||
if (site.type == "local") {
|
||||
newTarget = await db
|
||||
.insert(targets)
|
||||
.values({
|
||||
resourceId,
|
||||
protocol: "tcp", // hard code for now
|
||||
...targetData
|
||||
})
|
||||
.returning();
|
||||
} else {
|
||||
// make sure the target is within the site subnet
|
||||
if (
|
||||
site.type == "wireguard" &&
|
||||
|
@ -177,7 +188,7 @@ export async function createTarget(
|
|||
);
|
||||
}
|
||||
|
||||
const newTarget = await db
|
||||
newTarget = await db
|
||||
.insert(targets)
|
||||
.values({
|
||||
resourceId,
|
||||
|
@ -207,6 +218,7 @@ export async function createTarget(
|
|||
addTargets(newt.newtId, newTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return response<CreateTargetResponse>(res, {
|
||||
data: newTarget[0],
|
||||
|
|
|
@ -151,6 +151,16 @@ export async function traefikConfigProvider(
|
|||
],
|
||||
},
|
||||
};
|
||||
} else if (site.type === "local") {
|
||||
http.services![serviceName] = {
|
||||
loadBalancer: {
|
||||
servers: [
|
||||
{
|
||||
url: `${target.method}://${target.ip}:${target.port}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue