Fixes to install make command, fixes to local network app url definition, run ws build on start and every 24 hours

pull/30/head
Paulo Truta 2023-10-28 18:43:18 +02:00
parent 8bf26a334c
commit 445bc41d0e
4 changed files with 23 additions and 2 deletions

View File

@ -42,8 +42,9 @@ test-with-coverage:
install: install:
sudo systemctl stop edgeboxctl sudo systemctl stop edgeboxctl
sudo rm -rf /usr/local/bin/edgeboxctl /lib/systemd/system/edgeboxctl.service sudo rm -rf /usr/local/bin/edgeboxctl /usr/local/sbin/edgeboctl /lib/systemd/system/edgeboxctl.service
sudo cp ./bin/edgeboxctl /usr/local/bin/edgeboxctl sudo cp ./bin/edgeboxctl /usr/local/bin/edgeboxctl
sudo cp ./bin/edgeboxctl /usr/local/sbin/edgeboxctl
sudo cp ./edgeboxctl.service /lib/systemd/system/edgeboxctl.service sudo cp ./edgeboxctl.service /lib/systemd/system/edgeboxctl.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
@echo "Edgeboxctl installed successfully" @echo "Edgeboxctl installed successfully"

View File

@ -98,7 +98,7 @@ func GetEdgeApp(ID string) MaybeEdgeApp {
Status: GetEdgeAppStatus(ID), Status: GetEdgeAppStatus(ID),
Services: GetEdgeAppServices(ID), Services: GetEdgeAppServices(ID),
InternetAccessible: edgeAppInternetAccessible, InternetAccessible: edgeAppInternetAccessible,
NetworkURL: ID + system.GetHostname() + ".local", NetworkURL: ID + "." + system.GetHostname() + ".local",
InternetURL: edgeAppInternetURL, InternetURL: edgeAppInternetURL,
}, },
Valid: true, Valid: true,

View File

@ -100,6 +100,14 @@ func SetupCloudOptions() {
utils.Exec("/", "rm", []string{cloudEnvFileLocationPath}) utils.Exec("/", "rm", []string{cloudEnvFileLocationPath})
} }
// StartWs: Starts the webserver service for Edgeapps
func StartWs() {
wsPath := utils.GetPath(utils.WsPath)
fmt.Println("Starting WS")
cmdargs := []string{"-b"}
utils.Exec(wsPath, "./ws", cmdargs)
}
// StartService: Starts a service // StartService: Starts a service
func StartService(serviceID string) { func StartService(serviceID string) {
wsPath := utils.GetPath(utils.WsPath) wsPath := utils.GetPath(utils.WsPath)

View File

@ -374,6 +374,7 @@ func ExecuteSchedules(tick int) {
log.Println("Uptime is " + uptime + " seconds (" + system.GetUptimeFormatted() + ")") log.Println("Uptime is " + uptime + " seconds (" + system.GetUptimeFormatted() + ")")
log.Println(taskGetStorageDevices()) log.Println(taskGetStorageDevices())
taskStartWs()
log.Println(taskGetEdgeApps()) log.Println(taskGetEdgeApps())
} }
@ -423,6 +424,12 @@ func ExecuteSchedules(tick int) {
// Executing every 3600 ticks (1 hour) // Executing every 3600 ticks (1 hour)
} }
if tick%86400 == 0 {
// Executing every 86400 ticks (+/1 day)
// Ensuring we run a normal build, setting up avahi domain names fresh in the network
taskStartWs()
}
// Just add a schedule here if you need a custom one (every "tick hour", every "tick day", etc...) // Just add a schedule here if you need a custom one (every "tick hour", every "tick day", etc...)
} }
@ -1000,3 +1007,8 @@ func taskSetupCloudOptions() {
fmt.Println("Executing taskSetupCloudOptions") fmt.Println("Executing taskSetupCloudOptions")
system.SetupCloudOptions() system.SetupCloudOptions()
} }
func taskStartWs() {
fmt.Println("Executing taskStartWs")
system.StartWs()
}