5 Commits
Author SHA1 Message Date
Paulo Truta 7996c552f8 Fix runs commands on docker compose (internal) 2025-10-05 20:24:02 +02:00
Paulo Truta dbc831e972 Added readme 2024-12-08 21:18:01 +01:00
Paulo Truta 19acbcbaad Hotfix: Add correct path for internet url option of browser dev environment 2024-12-08 21:16:33 +01:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 1e0a5df370 Bump actions/setup-go from 4 to 5 (#36)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-08 21:04:42 +01:00
Paulo Truta 7913be080d Release 1.3.1 (#41)
* Added password refresh to activate browser dev task

* Added http and https prefixes to broserdevurl

* Added changelog file
2024-12-08 21:03:18 +01:00
7 changed files with 84 additions and 20 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@v4 uses: actions/setup-go@v5
with: with:
go-version: '1.20.2' go-version: '1.20.2'
- name: Check out code - name: Check out code
+23
View File
@@ -0,0 +1,23 @@
# 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.
+1 -1
View File
@@ -67,7 +67,7 @@ run:
install: install:
@echo "📦 Installing edgeboxctl service (${RELEASE}) for ${GOOS} (${GOARCH})\n" @echo "📦 Installing edgeboxctl service (${RELEASE}) for ${GOOS} (${GOARCH})\n"
@echo "🚧 Stopping edgeboxctl service if it is running" @echo "🚧 Stopping edgeboxctl service if it is running"
sudo systemctl stop edgeboxctl || true sudo systemctl stop edgeboxctl || true
@echo "\n🗑️ Removing old edgeboxctl binary and service" @echo "\n🗑️ Removing old edgeboxctl binary and service"
+6 -4
View File
@@ -59,10 +59,12 @@ To get a local copy up and running follow these simple steps.
If you're running for development purposes, a docker container suffices, so make sure you have: If you're running for development purposes, a docker container suffices, so make sure you have:
* docker * docker
* docker compose * docker compose (docker-compose-v2 package)
Check the following links for more info on [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/). Check the following links for more info on [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/).
**Note:** If you don't have `docker compose` available, install it with: `sudo apt-get install docker-compose-v2`
Aditionally, `edgeboxctl` needs the following bash commands available wherever it runs: Aditionally, `edgeboxctl` needs the following bash commands available wherever it runs:
* `arm-linux-gnueabi-gcc` (`sudo apt-get install gcc-arm*`) * `arm-linux-gnueabi-gcc` (`sudo apt-get install gcc-arm*`)
@@ -79,10 +81,10 @@ Aditionally, `edgeboxctl` needs the following bash commands available wherever i
```sh ```sh
git clone https://github.com/edgebox-iot/edgeboxctl.git git clone https://github.com/edgebox-iot/edgeboxctl.git
``` ```
2. Run Docker-Compose 2. Run Docker Compose
```sh
docker-compose up
``` ```
docker compose up
+3 -3
View File
@@ -489,7 +489,7 @@ func GetEdgeAppServices(ID string) []EdgeAppService {
// Check if the service is actually running // Check if the service is actually running
if shouldBeRunning { if shouldBeRunning {
cmdArgs = []string{"-f", wsPath + "/docker-compose.yml", "exec", "-T", serviceID, "echo", "'Service Check'"} cmdArgs = []string{"-f", wsPath + "/docker-compose.yml", "exec", "-T", serviceID, "echo", "'Service Check'"}
cmdResult := utils.Exec(wsPath, "docker-compose", cmdArgs) cmdResult := utils.Exec(wsPath, "docker", append([]string{"compose"}, cmdArgs...))
if cmdResult != "" { if cmdResult != "" {
isRunning = true isRunning = true
} }
@@ -511,7 +511,7 @@ func RunEdgeApp(ID string) EdgeAppStatus {
for _, service := range services { for _, service := range services {
cmdArgs = []string{"-f", wsPath + "/docker-compose.yml", "start", service.ID} cmdArgs = []string{"-f", wsPath + "/docker-compose.yml", "start", service.ID}
utils.Exec(wsPath, "docker-compose", cmdArgs) utils.Exec(wsPath, "docker", append([]string{"compose"}, cmdArgs...))
} }
// Wait for it to settle up before continuing... // Wait for it to settle up before continuing...
@@ -529,7 +529,7 @@ func StopEdgeApp(ID string) EdgeAppStatus {
for _, service := range services { for _, service := range services {
cmdArgs = []string{"-f", wsPath + "/docker-compose.yml", "stop", service.ID} cmdArgs = []string{"-f", wsPath + "/docker-compose.yml", "stop", service.ID}
utils.Exec(wsPath, "docker-compose", cmdArgs) utils.Exec(wsPath, "docker", append([]string{"compose"}, cmdArgs...))
} }
// Wait for it to settle up before continuing... // Wait for it to settle up before continuing...
+35 -5
View File
@@ -18,6 +18,8 @@ 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,6 +534,8 @@ func ExecuteSchedules(tick int) {
taskGetBrowserDevPassword() taskGetBrowserDevPassword()
taskGetBrowserDevStatus() taskGetBrowserDevStatus()
taskCheckSystemUpdates()
ip := taskGetSystemIP() ip := taskGetSystemIP()
log.Println("System IP is: " + ip) log.Println("System IP is: " + ip)
@@ -561,8 +565,6 @@ func ExecuteSchedules(tick int) {
log.Println(taskGetEdgeApps()) log.Println(taskGetEdgeApps())
taskUpdateSystemLoggerServices() taskUpdateSystemLoggerServices()
taskRecoverFromUpdate() taskRecoverFromUpdate()
taskCheckSystemUpdates()
} }
if tick%5 == 0 { if tick%5 == 0 {
@@ -571,6 +573,10 @@ 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())
@@ -1150,7 +1156,10 @@ func taskGetBrowserDevStatus() string {
if browserDevStatus == "active" { if browserDevStatus == "active" {
fmt.Println("Browser Dev Environment is running") fmt.Println("Browser Dev Environment is running")
utils.WriteOption("BROWSERDEV_STATUS", "running") utils.WriteOption("BROWSERDEV_STATUS", "running")
taskGetBrowserDevUrl()
return "{\"status\": \"running\"}" return "{\"status\": \"running\"}"
} else { } else {
fmt.Println("Browser Dev Environment is not running") fmt.Println("Browser Dev Environment is not running")
utils.WriteOption("BROWSERDEV_STATUS", "not_running") utils.WriteOption("BROWSERDEV_STATUS", "not_running")
@@ -1158,6 +1167,24 @@ func taskGetBrowserDevStatus() string {
} }
} }
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)
@@ -1170,6 +1197,10 @@ 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\"}"
} }
@@ -1189,15 +1220,14 @@ func taskDeactivateBrowserDev() string {
func taskGetBrowserDevPassword() string { func taskGetBrowserDevPassword() string {
fmt.Println("Executing taskGetBrowserDevPassword") fmt.Println("Executing taskGetBrowserDevPassword")
password := utils.ReadOption("BROWSERDEV_PASSWORD")
if password == "" {
password, err := system.FetchBrowserDevPasswordFromFile() password, err := system.FetchBrowserDevPasswordFromFile()
if err == nil { if err == nil {
utils.WriteOption("BROWSERDEV_PASSWORD", password) utils.WriteOption("BROWSERDEV_PASSWORD", password)
} else { } else {
fmt.Println("Error fetching browser dev password from file: " + err.Error()) fmt.Println("Error fetching browser dev password from file: " + err.Error())
} }
}
return password return password
} }
+9
View File
@@ -111,6 +111,7 @@ 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"
@@ -176,6 +177,14 @@ 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"]