rename daemon surfaces to beosd
This commit is contained in:
@@ -109,9 +109,9 @@ To get started with Olares on your own device, follow the [Getting Started Guide
|
||||
## Project navigation
|
||||
This section lists the main directories in the Olares repository:
|
||||
|
||||
* **[`apps`](./apps)**: Contains the code for system applications, primarily for `larepass`.
|
||||
* **[`cli`](./cli)**: Contains the code for `olares-cli`, the command-line interface tool for Olares.
|
||||
* **[`daemon`](./daemon)**: Contains the code for `olaresd`, the system daemon process.
|
||||
* **[`apps`](./apps)**: Contains the code for the built-in applications and user shell.
|
||||
* **[`cli`](./cli)**: Contains the code for `beos-cli`, the command-line interface tool.
|
||||
* **[`daemon`](./daemon)**: Contains the code for `beosd`, the system daemon process.
|
||||
* **[`docs`](./docs)**: Contains documentation for the project.
|
||||
* **[`framework`](./framework)**: Contains the Olares system services.
|
||||
* **[`infrastructure`](./infrastructure)**: Contains code related to infrastructure components such as computing, storage, networking, and GPUs.
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
# Olares CLI
|
||||
# beOS Pro CLI
|
||||
|
||||
This directory contains the code for **olares-cli**, the official command-line interface for administering an **Olares** cluster. It provides a modular, pipeline-based architecture for orchestrating complex system operations. See the full [Olares CLI Documentation](https://docs.olares.com/developer/install/cli-1.12/olares-cli.html) for command reference and tutorials.
|
||||
This directory contains the code for **beos-cli**, the command-line interface for administering a **beOS Pro** installation. It provides a modular, pipeline-based architecture for orchestrating complex system operations.
|
||||
|
||||
Key responsibilities include:
|
||||
- **Cluster management**: Installing, upgrading, restarting, and maintaining an Olares cluster.
|
||||
- **Node management**: Adding to or removing nodes from an Olares cluster.
|
||||
- **Cluster management**: Installing, upgrading, restarting, and maintaining a beOS Pro cluster.
|
||||
- **Node management**: Adding to or removing nodes from a beOS Pro cluster.
|
||||
|
||||
|
||||
## Execution Model
|
||||
|
||||
For most of the commands, `olares-cli` is executed through a four-tier hierarchy:
|
||||
For most commands, `beos-cli` is executed through a four-tier hierarchy:
|
||||
|
||||
```
|
||||
Pipeline ➜ Module ➜ Task ➜ Action
|
||||
````
|
||||
|
||||
### Example: `install-olares` Pipeline
|
||||
### Example: `install` pipeline
|
||||
|
||||
```text
|
||||
Pipeline: Install Olares
|
||||
Pipeline: Install beOS Pro
|
||||
├── ...other modules
|
||||
└── Module: Bootstrap OS
|
||||
├── ...other tasks
|
||||
@@ -65,10 +65,10 @@ cli/
|
||||
cd cli
|
||||
|
||||
# 1) Build for the host OS/ARCH
|
||||
go build -o olares-cli ./cmd/main.go
|
||||
go build -o beos-cli ./cmd/main.go
|
||||
|
||||
# 2) Cross-compile for Linux amd64 (from macOS, for example)
|
||||
GOOS=linux GOARCH=amd64 go build -o olares-cli ./cmd/main.go
|
||||
GOOS=linux GOARCH=amd64 go build -o beos-cli ./cmd/main.go
|
||||
|
||||
# 3) Produce multi-platform artifacts (tar.gz, checksums, etc.)
|
||||
goreleaser release --snapshot --clean
|
||||
@@ -87,6 +87,6 @@ goreleaser release --snapshot --clean
|
||||
|
||||
### Test your build
|
||||
|
||||
1. Upload the self-built `olares-cli` binary to a machine that's running Olares.
|
||||
2. Replace the existing `olares-cli` binary on the machine using `sudo cp -f olares-cli /usr/local/bin`.
|
||||
3. Execute arbitrary commands using `olares-cli`
|
||||
1. Upload the self-built `beos-cli` binary to a machine that's running beOS Pro.
|
||||
2. Replace the existing CLI binary on the machine using `sudo cp -f beos-cli /usr/local/bin`.
|
||||
3. Execute arbitrary commands using `beos-cli`
|
||||
|
||||
@@ -12,12 +12,12 @@ type UninstallTerminusdModule struct {
|
||||
}
|
||||
|
||||
func (u *UninstallTerminusdModule) Init() {
|
||||
u.Name = "UninstallOlaresdModule"
|
||||
u.Desc = "Uninstall olaresd"
|
||||
u.Name = "UninstallBeOSdModule"
|
||||
u.Desc = "Uninstall beOS daemon"
|
||||
|
||||
disableService := &task.RemoteTask{
|
||||
Name: "DisableOlaresdService",
|
||||
Desc: "disable olaresd service",
|
||||
Name: "DisableBeOSdService",
|
||||
Desc: "disable beosd service",
|
||||
Hosts: u.Runtime.GetHostsByRole(common.K8s),
|
||||
Action: new(DisableTerminusdService),
|
||||
Parallel: false,
|
||||
@@ -25,8 +25,8 @@ func (u *UninstallTerminusdModule) Init() {
|
||||
}
|
||||
|
||||
uninstall := &task.RemoteTask{
|
||||
Name: "UninstallOlaresd",
|
||||
Desc: "Uninstall olaresd",
|
||||
Name: "UninstallBeOSd",
|
||||
Desc: "Uninstall beosd",
|
||||
Hosts: u.Runtime.GetHostsByRole(common.K8s),
|
||||
Action: &UninstallTerminusd{},
|
||||
Parallel: false,
|
||||
@@ -45,12 +45,12 @@ type ReplaceOlaresdBinaryModule struct {
|
||||
}
|
||||
|
||||
func (m *ReplaceOlaresdBinaryModule) Init() {
|
||||
m.Name = "ReplaceOlaresdBinaryModule"
|
||||
m.Desc = "Replace olaresd"
|
||||
m.Name = "ReplaceBeOSdBinaryModule"
|
||||
m.Desc = "Replace beosd"
|
||||
|
||||
replace := &task.LocalTask{
|
||||
Name: "ReplaceOlaresdBinary",
|
||||
Desc: "Replace olaresd binary",
|
||||
Name: "ReplaceBeOSdBinary",
|
||||
Desc: "Replace beosd binary",
|
||||
Action: &InstallTerminusdBinary{
|
||||
ManifestAction: manifest.ManifestAction{
|
||||
BaseDir: m.BaseDir,
|
||||
@@ -61,17 +61,17 @@ func (m *ReplaceOlaresdBinaryModule) Init() {
|
||||
}
|
||||
|
||||
updateEnv := &task.LocalTask{
|
||||
Name: "UpdateOlaresdEnv",
|
||||
Desc: "Update olaresd env",
|
||||
Name: "UpdateBeOSdEnv",
|
||||
Desc: "Update beosd env",
|
||||
Action: new(UpdateOlaresdServiceEnv),
|
||||
}
|
||||
|
||||
restart := &task.LocalTask{
|
||||
Name: "RestartOlaresd",
|
||||
Desc: "Restart olaresd",
|
||||
Name: "RestartBeOSd",
|
||||
Desc: "Restart beosd",
|
||||
Action: &terminus.SystemctlCommand{
|
||||
Command: "restart",
|
||||
UnitNames: []string{"olaresd"},
|
||||
UnitNames: []string{"beosd"},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ type InstallTerminusdBinaryModule struct {
|
||||
}
|
||||
|
||||
func (i *InstallTerminusdBinaryModule) Init() {
|
||||
i.Name = "InstallOlaresdBinaryModule"
|
||||
i.Desc = "Install olaresd"
|
||||
i.Name = "InstallBeOSdBinaryModule"
|
||||
i.Desc = "Install beosd"
|
||||
|
||||
updateHost := &task.LocalTask{
|
||||
Name: "UpdateHosts",
|
||||
@@ -99,8 +99,8 @@ func (i *InstallTerminusdBinaryModule) Init() {
|
||||
}
|
||||
|
||||
install := &task.RemoteTask{
|
||||
Name: "InstallOlaresdBinary",
|
||||
Desc: "Install olaresd using binary",
|
||||
Name: "InstallBeOSdBinary",
|
||||
Desc: "Install beosd using binary",
|
||||
Hosts: i.Runtime.GetHostsByRole(common.K8s),
|
||||
Action: &InstallTerminusdBinary{
|
||||
ManifestAction: manifest.ManifestAction{
|
||||
@@ -113,8 +113,8 @@ func (i *InstallTerminusdBinaryModule) Init() {
|
||||
}
|
||||
|
||||
generateEnv := &task.RemoteTask{
|
||||
Name: "GenerateOlaresdEnv",
|
||||
Desc: "Generate olaresd service env",
|
||||
Name: "GenerateBeOSdEnv",
|
||||
Desc: "Generate beosd service env",
|
||||
Hosts: i.Runtime.GetHostsByRole(common.K8s),
|
||||
Action: new(GenerateTerminusdServiceEnv),
|
||||
Parallel: false,
|
||||
@@ -122,8 +122,8 @@ func (i *InstallTerminusdBinaryModule) Init() {
|
||||
}
|
||||
|
||||
generateService := &task.RemoteTask{
|
||||
Name: "GenerateOlaresdService",
|
||||
Desc: "Generate olaresd service",
|
||||
Name: "GenerateBeOSdService",
|
||||
Desc: "Generate beosd service",
|
||||
Hosts: i.Runtime.GetHostsByRole(common.K8s),
|
||||
Action: new(GenerateTerminusdService),
|
||||
Parallel: false,
|
||||
@@ -131,8 +131,8 @@ func (i *InstallTerminusdBinaryModule) Init() {
|
||||
}
|
||||
|
||||
enableService := &task.RemoteTask{
|
||||
Name: "EnableOlaresdService",
|
||||
Desc: "enable olaresd service",
|
||||
Name: "EnableBeOSdService",
|
||||
Desc: "enable beosd service",
|
||||
Hosts: i.Runtime.GetHostsByRole(common.K8s),
|
||||
Action: new(EnableTerminusdService),
|
||||
Parallel: false,
|
||||
|
||||
@@ -37,9 +37,9 @@ func (g *InstallTerminusdBinary) Execute(runtime connector.Runtime) error {
|
||||
return errors.Wrap(errors.WithStack(err), "sync olaresd tar.gz failed")
|
||||
}
|
||||
|
||||
installCmd := fmt.Sprintf("tar -zxf %s && cp -f olaresd /usr/local/bin/ && chmod +x /usr/local/bin/olaresd && rm -rf olaresd*", dst)
|
||||
installCmd := fmt.Sprintf("tar -zxf %s && cp -f olaresd /usr/local/bin/beosd && cp -f olaresd /usr/local/bin/olaresd && chmod +x /usr/local/bin/beosd /usr/local/bin/olaresd && rm -rf olaresd*", dst)
|
||||
if _, err := runtime.GetRunner().SudoCmd(installCmd, false, false); err != nil {
|
||||
return errors.Wrap(errors.WithStack(err), "install olaresd binaries failed")
|
||||
return errors.Wrap(errors.WithStack(err), "install beosd binaries failed")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -53,7 +53,7 @@ func (a *UpdateOlaresdServiceEnv) Execute(runtime connector.Runtime) error {
|
||||
versionKey := "INSTALLED_VERSION"
|
||||
updateVersionCMD := fmt.Sprintf("sed -i '/%s/c\\%s=%s' %s ", versionKey, versionKey, a.KubeConf.Arg.OlaresVersion, envFilePath)
|
||||
if _, err := runtime.GetRunner().SudoCmd(updateVersionCMD, false, false); err != nil {
|
||||
return fmt.Errorf("update olaresd env failed: %v", err)
|
||||
return fmt.Errorf("update beosd env failed: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -110,10 +110,11 @@ type EnableTerminusdService struct {
|
||||
}
|
||||
|
||||
func (e *EnableTerminusdService) Execute(runtime connector.Runtime) error {
|
||||
if _, err := runtime.GetRunner().SudoCmd("systemctl enable --now olaresd",
|
||||
if _, err := runtime.GetRunner().SudoCmd("systemctl enable --now beosd",
|
||||
false, false); err != nil {
|
||||
return errors.Wrap(errors.WithStack(err), "enable olaresd failed")
|
||||
return errors.Wrap(errors.WithStack(err), "enable beosd failed")
|
||||
}
|
||||
_, _ = runtime.GetRunner().SudoCmd("systemctl disable --now olaresd", false, true)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -122,12 +123,13 @@ type DisableTerminusdService struct {
|
||||
}
|
||||
|
||||
func (s *DisableTerminusdService) Execute(runtime connector.Runtime) error {
|
||||
stdout, _ := runtime.GetRunner().SudoCmd("systemctl is-active olaresd", false, false)
|
||||
stdout, _ := runtime.GetRunner().SudoCmd("systemctl is-active beosd", false, false)
|
||||
if stdout == "active" {
|
||||
if _, err := runtime.GetRunner().SudoCmd("systemctl disable --now olaresd", false, true); err != nil {
|
||||
return errors.Wrap(errors.WithStack(err), "disable olaresd failed")
|
||||
if _, err := runtime.GetRunner().SudoCmd("systemctl disable --now beosd", false, true); err != nil {
|
||||
return errors.Wrap(errors.WithStack(err), "disable beosd failed")
|
||||
}
|
||||
}
|
||||
_, _ = runtime.GetRunner().SudoCmd("systemctl disable --now olaresd", false, true)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -136,17 +138,20 @@ type UninstallTerminusd struct {
|
||||
}
|
||||
|
||||
func (r *UninstallTerminusd) Execute(runtime connector.Runtime) error {
|
||||
var olaresdFiles []string
|
||||
var daemonFiles []string
|
||||
svcpath := filepath.Join("/etc/systemd/system", templates.TerminusdService.Name())
|
||||
svcenvpath := filepath.Join("/etc/systemd/system", templates.TerminusdEnv.Name())
|
||||
binPath := "/usr/local/bin/olaresd"
|
||||
olaresdFiles = append(olaresdFiles, svcpath, svcenvpath, binPath)
|
||||
legacySvcpath := filepath.Join("/etc/systemd/system", "olaresd.service")
|
||||
legacySvcenvpath := filepath.Join("/etc/systemd/system", "olaresd.service.env")
|
||||
binPath := "/usr/local/bin/beosd"
|
||||
legacyBinPath := "/usr/local/bin/olaresd"
|
||||
daemonFiles = append(daemonFiles, svcpath, svcenvpath, legacySvcpath, legacySvcenvpath, binPath, legacyBinPath)
|
||||
for _, pidFile := range []string{"installing.pid", "changingip.pid"} {
|
||||
olaresdFiles = append(olaresdFiles, filepath.Join(runtime.GetBaseDir(), pidFile))
|
||||
daemonFiles = append(daemonFiles, filepath.Join(runtime.GetBaseDir(), pidFile))
|
||||
}
|
||||
for _, f := range olaresdFiles {
|
||||
for _, f := range daemonFiles {
|
||||
if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("rm -rf %s", f), false, false); err != nil {
|
||||
return errors.Wrap(errors.WithStack(err), "remove olaresd failed")
|
||||
return errors.Wrap(errors.WithStack(err), "remove beosd failed")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -156,7 +161,7 @@ type CheckTerminusdService struct {
|
||||
}
|
||||
|
||||
func (c *CheckTerminusdService) Execute() error {
|
||||
cmd := exec.Command("/bin/sh", "-c", "systemctl list-unit-files --no-legend --no-pager -l | grep olaresd")
|
||||
cmd := exec.Command("/bin/sh", "-c", "systemctl list-unit-files --no-legend --no-pager -l | grep -E 'beosd|olaresd'")
|
||||
_, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
)
|
||||
|
||||
// TerminusdEnv defines the template of terminusd's env.
|
||||
var TerminusdEnv = template.Must(template.New("olaresd.service.env").Parse(
|
||||
dedent.Dedent(`# Environment file for olaresd
|
||||
var TerminusdEnv = template.Must(template.New("beosd.service.env").Parse(
|
||||
dedent.Dedent(`# Environment file for beosd
|
||||
INSTALLED_VERSION={{ .Version }}
|
||||
KUBE_TYPE={{ .KubeType }}
|
||||
REGISTRY_MIRRORS={{ .RegistryMirrors }}
|
||||
|
||||
@@ -8,19 +8,19 @@ import (
|
||||
|
||||
var (
|
||||
// TerminusdService defines the template of terminusd's service for systemd.
|
||||
TerminusdService = template.Must(template.New("olaresd.service").Parse(
|
||||
TerminusdService = template.Must(template.New("beosd.service").Parse(
|
||||
dedent.Dedent(`[Unit]
|
||||
Description=olaresd
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
Description=beOS Pro system daemon
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
EnvironmentFile=/etc/systemd/system/olaresd.service.env
|
||||
ExecStart=/usr/local/bin/olaresd
|
||||
RestartSec=10s
|
||||
LimitNOFILE=40000
|
||||
Restart=always
|
||||
User=root
|
||||
EnvironmentFile=/etc/systemd/system/beosd.service.env
|
||||
ExecStart=/usr/local/bin/beosd
|
||||
RestartSec=10s
|
||||
LimitNOFILE=40000
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -74,9 +74,9 @@ func PrepareSystemPipeline(components []string) error {
|
||||
if err := p.Start(); err != nil {
|
||||
return fmt.Errorf("error preparing images: %w", err)
|
||||
}
|
||||
case "olaresd":
|
||||
case "olaresd", "beosd":
|
||||
p := &pipeline.Pipeline{
|
||||
Name: "Prepare Olaresd daemon",
|
||||
Name: "Prepare beOS daemon",
|
||||
Modules: []module.Module{
|
||||
&daemon.ReplaceOlaresdBinaryModule{
|
||||
ManifestModule: manifest.ManifestModule{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
# Olares System Daemon (`olaresd`)
|
||||
# beOS Pro System Daemon (`beosd`)
|
||||
|
||||
`olaresd` is the foundational process that boots on every Olares node. It runs as a `systemd` service on port `18088`, exposing a secure REST API for hardware abstraction, network orchestration, storage management, and turnkey cluster operations—all before Kubernetes starts.
|
||||
`beosd` is the foundational process that boots on every beOS Pro node. It runs as a `systemd` service on port `18088`, exposing a secure REST API for hardware abstraction, network orchestration, storage management, and turnkey cluster operations before Kubernetes starts.
|
||||
|
||||
Olaresd is installed as a systemd service in `/etc/systemd/system/olaresd.service`.
|
||||
The daemon is installed as a systemd service in `/etc/systemd/system/beosd.service`.
|
||||
|
||||
## Key features
|
||||
|
||||
@@ -24,9 +24,9 @@ The daemon provides an authenticated REST API (using signature-based auth):
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|-----------------------------|------------------------------|
|
||||
| POST | `/command/install` | Install Olares |
|
||||
| POST | `/command/uninstall` | Uninstall Olares |
|
||||
| POST | `/command/upgrade` | Upgrade Olares |
|
||||
| POST | `/command/install` | Install beOS Pro |
|
||||
| POST | `/command/uninstall` | Uninstall beOS Pro |
|
||||
| POST | `/command/upgrade` | Upgrade beOS Pro |
|
||||
| DELETE | `/command/upgrade` | Cancel upgrade |
|
||||
| POST | `/command/reboot` | Reboot node |
|
||||
| POST | `/command/shutdown` | Shutdown node |
|
||||
@@ -36,7 +36,7 @@ The daemon provides an authenticated REST API (using signature-based auth):
|
||||
| Method | Endpoint | Description |
|
||||
|--------|-----------------------------|------------------------------|
|
||||
| POST | `/command/connect-wifi` | Connect to WiFi |
|
||||
| POST | `/command/change-host` | Change Olares IP binding |
|
||||
| POST | `/command/change-host` | Change beOS Pro IP binding |
|
||||
|
||||
**Storage management**
|
||||
|
||||
@@ -167,4 +167,4 @@ To add a new command API:
|
||||
|
||||
```
|
||||
sudo systemctl restart olaresd
|
||||
```
|
||||
```
|
||||
|
||||
@@ -39,8 +39,8 @@ func main() {
|
||||
|
||||
klog.InitFlags(nil)
|
||||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
||||
pflag.CommandLine.BoolVar(&showVersion, "version", false, "show olaresd version")
|
||||
pflag.CommandLine.BoolVar(&showVendor, "vendor", false, "show the vendor type of olaresd")
|
||||
pflag.CommandLine.BoolVar(&showVersion, "version", false, "show beosd version")
|
||||
pflag.CommandLine.BoolVar(&showVendor, "vendor", false, "show the vendor type of beosd")
|
||||
|
||||
pflag.Parse()
|
||||
|
||||
@@ -113,7 +113,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// try to restart ble service, if ble not enabled when olaresd was started
|
||||
// try to restart ble service, if ble not enabled when beosd was started
|
||||
if bleService == nil {
|
||||
var err error
|
||||
bleService, err = ble.NewBleService(mainCtx)
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
var version = "debug"
|
||||
|
||||
func Version() string {
|
||||
return fmt.Sprintf("olaresd version: %s", version)
|
||||
return fmt.Sprintf("beosd version: %s", version)
|
||||
}
|
||||
|
||||
func RawVersion() *string {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
[Unit]
|
||||
Description=olareas
|
||||
Description=beOS Pro system daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
EnvironmentFile=/etc/systemd/system/olaresd.service.env
|
||||
ExecStart=/usr/local/bin/olaresd
|
||||
EnvironmentFile=/etc/systemd/system/beosd.service.env
|
||||
ExecStart=/usr/local/bin/beosd
|
||||
RestartSec=10s
|
||||
LimitNOFILE=40000
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Reference in New Issue
Block a user