Browse Source

got ports 80 and 443 working for admin tenant tunnel

master
forest 5 months ago
parent
commit
e625e814ac
2 changed files with 20 additions and 10 deletions
  1. +17
    -9
      backend.go
  2. +3
    -1
      threshold/src_remote_install.sh

+ 17
- 9
backend.go View File

@ -980,20 +980,28 @@ func (app *BackendApp) ConfigureThresholdServer() error {
for _, row := range rows {
if row.TenantId == app.AdminTenantId {
vpsInstance, hasVpsInstance := vpsInstances[row.GetVPSInstanceId()]
_, hasTenant := tenants[row.TenantId]
tenant, hasTenant := tenants[row.TenantId]
if hasVpsInstance && hasTenant {
actions = append(actions, func() taskResult {
url := fmt.Sprintf("https://%s:%d/tunnels", vpsInstance.IPV4, app.ThresholdPort)
jsonBytes, err := json.Marshal([]ThresholdTunnel{ThresholdTunnel{
ClientId: fmt.Sprintf("%d.%s", app.AdminTenantId, app.AdminThresholdNodeId),
ListenPort: 10001, //TODO 80 and 443
ListenAddress: "0.0.0.0",
// TODO use hostname when switching to https
//ListenHostnameGlob: fmt.Sprintf("%s.%s", tenant.Subdomain, app.FreeSubdomainDomain),
BackEndService: app.GreenhouseThresholdServiceId,
}})
jsonBytes, err := json.Marshal([]ThresholdTunnel{
ThresholdTunnel{
ClientId: fmt.Sprintf("%d.%s", app.AdminTenantId, app.AdminThresholdNodeId),
ListenPort: 80,
ListenAddress: "0.0.0.0",
ListenHostnameGlob: fmt.Sprintf("%s.%s", tenant.Subdomain, app.FreeSubdomainDomain),
BackEndService: app.GreenhouseThresholdServiceId,
},
ThresholdTunnel{
ClientId: fmt.Sprintf("%d.%s", app.AdminTenantId, app.AdminThresholdNodeId),
ListenPort: 443,
ListenAddress: "0.0.0.0",
ListenHostnameGlob: fmt.Sprintf("%s.%s", tenant.Subdomain, app.FreeSubdomainDomain),
BackEndService: app.GreenhouseThresholdServiceId,
},
})
log.Println(string(jsonBytes))
if err != nil {
return taskResult{


+ 3
- 1
threshold/src_remote_install.sh View File

@ -9,7 +9,9 @@ curl -sS "https://f000.backblazeb2.com/file/server-garden-artifacts/threshold-am
tar -x -f "./threshold-amd64.tar.gz"
chmod +x ./threshold
chown threshold:threshold ./threshold
chmod 500 ./threshold
setcap cap_net_bind_service=+ep ./threshold
rm "./threshold-amd64.tar.gz"


Loading…
Cancel
Save