8 Commits
4 changed files with 12 additions and 97 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v4
with: with:
go-version: '1.20.2' go-version: '1.20.2'
- name: Check out code - name: Check out code
-23
View File
@@ -1,23 +0,0 @@
# Changelog
## [1.3.2] - 08-12-2024
* Fix to Browser Dev feature:
* Checking browser dev url when internet_accessible was checking the incorrect path. This is now fixed.
## [1.3.1] - 08-12-2024
* Fixes to Browser Dev feature:
* Now edgeboxctl also fetches or generates the browser dev environment url and saves it into an option both when starting, and every time the browser dev status is fetched.
## [1.3.0] - 05-12-2024
* Added Edgebox Browser Development Environment Feature Support
* Added tasks for handling browser development environment into tasks.go
* Added executable tasks to ExecuteTask and scheduled ones to ExecuteSchedules
* Other bug fixes and improvements.
### Missing Past Releases
Release notes for past versions are not available in this file. Please refer to the [GitHub releases](https://hithub.com/edgebox-iot/edgeboxctl/releases) for more information. Feel free to contribute to this file by adding missing release notes.
+10 -63
View File
@@ -18,8 +18,6 @@ import (
"github.com/edgebox-iot/edgeboxctl/internal/system" "github.com/edgebox-iot/edgeboxctl/internal/system"
"github.com/edgebox-iot/edgeboxctl/internal/utils" "github.com/edgebox-iot/edgeboxctl/internal/utils"
"github.com/joho/godotenv"
_ "github.com/go-sql-driver/mysql" // Mysql Driver _ "github.com/go-sql-driver/mysql" // Mysql Driver
_ "github.com/mattn/go-sqlite3" // SQlite Driver _ "github.com/mattn/go-sqlite3" // SQlite Driver
) )
@@ -532,9 +530,6 @@ func ExecuteSchedules(tick int) {
log.Println("Fetching Browser Dev Environment Information") log.Println("Fetching Browser Dev Environment Information")
taskGetBrowserDevPassword() taskGetBrowserDevPassword()
taskGetBrowserDevStatus()
taskCheckSystemUpdates()
ip := taskGetSystemIP() ip := taskGetSystemIP()
log.Println("System IP is: " + ip) log.Println("System IP is: " + ip)
@@ -565,6 +560,8 @@ func ExecuteSchedules(tick int) {
log.Println(taskGetEdgeApps()) log.Println(taskGetEdgeApps())
taskUpdateSystemLoggerServices() taskUpdateSystemLoggerServices()
taskRecoverFromUpdate() taskRecoverFromUpdate()
taskCheckSystemUpdates()
} }
if tick%5 == 0 { if tick%5 == 0 {
@@ -573,10 +570,6 @@ func ExecuteSchedules(tick int) {
log.Println(taskGetStorageDevices()) log.Println(taskGetStorageDevices())
} }
if tick%15 == 0 {
taskGetBrowserDevStatus()
}
if tick%30 == 0 { if tick%30 == 0 {
// Executing every 30 ticks // Executing every 30 ticks
log.Println(taskGetEdgeApps()) log.Println(taskGetEdgeApps())
@@ -615,9 +608,7 @@ func ExecuteSchedules(tick int) {
if tick%3600 == 0 { if tick%3600 == 0 {
// Executing every 3600 ticks (1 hour) // Executing every 3600 ticks (1 hour)
taskGetBrowserDevStatus()
taskCheckSystemUpdates() taskCheckSystemUpdates()
} }
if tick%86400 == 0 { if tick%86400 == 0 {
@@ -1144,47 +1135,6 @@ func taskStopShell() string {
} }
func taskGetBrowserDevStatus() string {
fmt.Println("Executing taskGetBrowserDevStatus")
// Read status from systemctl status code-server@root
browserDevStatus := utils.Exec(
utils.GetPath(utils.WsPath),
"sh",
[]string{"-c", "systemctl --quiet is-active code-server@root && echo 'active' || echo 'inactive'"},
)
if browserDevStatus == "active" {
fmt.Println("Browser Dev Environment is running")
utils.WriteOption("BROWSERDEV_STATUS", "running")
taskGetBrowserDevUrl()
return "{\"status\": \"running\"}"
} else {
fmt.Println("Browser Dev Environment is not running")
utils.WriteOption("BROWSERDEV_STATUS", "not_running")
return "{\"status\": \"not_running\"}"
}
}
func taskGetBrowserDevUrl() string {
url := ""
myEdgeAppServiceEnv, err := godotenv.Read(utils.GetPath(utils.BrowserDevPath) + "myedgeapp.env")
if err != nil {
log.Println("No myedge.app environment file found. Status is Network-Only")
url = "http://dev." + system.GetHostname() + ".local"
} else {
if myEdgeAppServiceEnv["INTERNET_URL"] != "" {
url = "https://" + myEdgeAppServiceEnv["INTERNET_URL"]
}
}
fmt.Println("Browser Dev Url: " + url)
utils.WriteOption("BROWSERDEV_URL", url)
return url
}
func taskActivateBrowserDev() string { func taskActivateBrowserDev() string {
fmt.Println("Executing taskActivateBrowserDev") fmt.Println("Executing taskActivateBrowserDev")
wsPath := utils.GetPath(utils.WsPath) wsPath := utils.GetPath(utils.WsPath)
@@ -1197,10 +1147,6 @@ func taskActivateBrowserDev() string {
system.StartWs() system.StartWs()
// Write control option for API // Write control option for API
utils.WriteOption("BROWSERDEV_STATUS", "running") utils.WriteOption("BROWSERDEV_STATUS", "running")
// Write and refresh the dev environment password option
taskGetBrowserDevPassword()
return "{\"status\": \"ok\"}" return "{\"status\": \"ok\"}"
} }
@@ -1220,14 +1166,15 @@ func taskDeactivateBrowserDev() string {
func taskGetBrowserDevPassword() string { func taskGetBrowserDevPassword() string {
fmt.Println("Executing taskGetBrowserDevPassword") fmt.Println("Executing taskGetBrowserDevPassword")
password := utils.ReadOption("BROWSERDEV_PASSWORD")
password, err := system.FetchBrowserDevPasswordFromFile() if password == "" {
if err == nil { password, err := system.FetchBrowserDevPasswordFromFile()
utils.WriteOption("BROWSERDEV_PASSWORD", password) if err == nil {
} else { utils.WriteOption("BROWSERDEV_PASSWORD", password)
fmt.Println("Error fetching browser dev password from file: " + err.Error()) } else {
fmt.Println("Error fetching browser dev password from file: " + err.Error())
}
} }
return password return password
} }
-9
View File
@@ -111,7 +111,6 @@ const ApiPath string = "apiPath"
const EdgeAppsPath string = "edgeAppsPath" const EdgeAppsPath string = "edgeAppsPath"
const EdgeAppsBackupPath string = "edgeAppsBackupPath" const EdgeAppsBackupPath string = "edgeAppsBackupPath"
const WsPath string = "wsPath" const WsPath string = "wsPath"
const BrowserDevPath string = "browserDevPath"
const LoggerPath string = "loggerPath" const LoggerPath string = "loggerPath"
const BrowserDevPasswordFileLocation string = "browserDevPasswordFileLocation" const BrowserDevPasswordFileLocation string = "browserDevPasswordFileLocation"
const BrowserDevProxyPath string = "browserDevProxyPath" const BrowserDevProxyPath string = "browserDevProxyPath"
@@ -177,14 +176,6 @@ func GetPath(pathKey string) string {
targetPath = "/home/system/components/ws/" targetPath = "/home/system/components/ws/"
} }
case BrowserDevPath:
if env["BROWSERDEV_PATH"] != "" {
targetPath = env["BROWSERDEV_PATH"]
} else {
targetPath = "/home/system/components/dev/"
}
case LoggerPath: case LoggerPath:
if env["LOGGER_PATH"] != "" { if env["LOGGER_PATH"] != "" {
targetPath = env["LOGGER_PATH"] targetPath = env["LOGGER_PATH"]