diff --git a/apps/.olares/config/user/helm-charts/system-apps/templates/olares-app.yaml b/apps/.olares/config/user/helm-charts/system-apps/templates/olares-app.yaml index 307ff81ed..89f4decab 100644 --- a/apps/.olares/config/user/helm-charts/system-apps/templates/olares-app.yaml +++ b/apps/.olares/config/user/helm-charts/system-apps/templates/olares-app.yaml @@ -317,7 +317,7 @@ spec: chown -R 1000:1000 /uploadstemp && \ chown -R 1000:1000 /appdata - name: olares-app-init - image: beclab/system-frontend:v1.7.1 + image: beclab/system-frontend:v1.7.4 imagePullPolicy: IfNotPresent command: - /bin/sh @@ -439,7 +439,7 @@ spec: - name: NATS_SUBJECT_VAULT value: os.vault.{{ .Values.bfl.username}} - name: user-service - image: beclab/user-service:v0.0.81 + image: beclab/user-service:v0.0.82 imagePullPolicy: IfNotPresent ports: - containerPort: 3000 diff --git a/cli/pkg/k3s/module.go b/cli/pkg/k3s/module.go index 76768663f..8e86029bb 100644 --- a/cli/pkg/k3s/module.go +++ b/cli/pkg/k3s/module.go @@ -36,6 +36,7 @@ import ( "github.com/beclab/Olares/cli/pkg/k3s/templates" "github.com/beclab/Olares/cli/pkg/manifest" "github.com/beclab/Olares/cli/pkg/registry" + "github.com/beclab/Olares/cli/pkg/storage" ) type InstallContainerModule struct { @@ -470,6 +471,18 @@ func (j *JoinNodesModule) Init() { Parallel: true, } + createSharedLibDirForWorker := &task.RemoteTask{ + Name: "CreateSharedLibDir(k3s)", + Desc: "Create shared lib directory on worker", + Hosts: j.Runtime.GetHostsByRole(common.Worker), + Prepare: &prepare.PrepareCollection{ + &kubernetes.NodeInCluster{Not: true}, + new(common.OnlyWorker), + }, + Action: new(storage.CreateSharedLibDir), + Parallel: true, + } + enableK3s := &task.RemoteTask{ Name: "EnableK3sService", Desc: "Enable k3s service", @@ -536,6 +549,7 @@ func (j *JoinNodesModule) Init() { k3sService, k3sEnv, k3sRegistryConfig, + createSharedLibDirForWorker, enableK3s, copyKubeConfigForMaster, syncKubeConfigToWorker, diff --git a/cli/pkg/k3s/tasks.go b/cli/pkg/k3s/tasks.go index ffab6314d..6c25987e4 100644 --- a/cli/pkg/k3s/tasks.go +++ b/cli/pkg/k3s/tasks.go @@ -397,53 +397,23 @@ type CopyK3sKubeConfig struct { } func (c *CopyK3sKubeConfig) Execute(runtime connector.Runtime) error { - createConfigDirCmd := "mkdir -p /root/.kube && mkdir -p $HOME/.kube" - getKubeConfigCmd := "cp -f /etc/rancher/k3s/k3s.yaml /root/.kube/config" - chmodKubeConfigCmd := "chmod 0600 /root/.kube/config" + targetHome, targetUID, targetGID, err := utils.ResolveSudoUserHomeAndIDs(runtime) + if err != nil { + return err + } - cmd := strings.Join([]string{createConfigDirCmd, getKubeConfigCmd, chmodKubeConfigCmd}, " && ") - if _, err := runtime.GetRunner().SudoCmd(cmd, false, false); err != nil { + cmds := []string{ + "mkdir -p /root/.kube", + "cp -f /etc/rancher/k3s/k3s.yaml /root/.kube/config", + "chmod 0600 /root/.kube/config", + fmt.Sprintf("mkdir -p %s", filepath.Join(targetHome, ".kube")), + fmt.Sprintf("cp -f /etc/rancher/k3s/k3s.yaml %s", filepath.Join(targetHome, ".kube", "config")), + fmt.Sprintf("chmod 0600 %s", filepath.Join(targetHome, ".kube", "config")), + fmt.Sprintf("chown -R %s:%s %s", targetUID, targetGID, filepath.Join(targetHome, ".kube")), + } + if _, err := runtime.GetRunner().SudoCmd(strings.Join(cmds, " && "), false, false); err != nil { return errors.Wrap(errors.WithStack(err), "copy k3s kube config failed") } - - userMkdir := "mkdir -p $HOME/.kube" - if _, err := runtime.GetRunner().Cmd(userMkdir, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "user mkdir $HOME/.kube failed") - } - - userCopyKubeConfig := "cp -f /etc/rancher/k3s/k3s.yaml $HOME/.kube/config" - if _, err := runtime.GetRunner().SudoCmd(userCopyKubeConfig, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "user copy /etc/rancher/k3s/k3s.yaml to $HOME/.kube/config failed") - } - - if _, err := runtime.GetRunner().SudoCmd("chmod 0600 $HOME/.kube/config", false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "chmod k3s $HOME/.kube/config 0600 failed") - } - - // userId, err := runtime.GetRunner().Cmd("echo $(id -u)", false, false) - // if err != nil { - // return errors.Wrap(errors.WithStack(err), "get user id failed") - // } - - // userGroupId, err := runtime.GetRunner().Cmd("echo $(id -g)", false, false) - // if err != nil { - // return errors.Wrap(errors.WithStack(err), "get user group id failed") - // } - - userId, err := runtime.GetRunner().Cmd("echo $SUDO_UID", false, false) - if err != nil { - return errors.Wrap(errors.WithStack(err), "get user id failed") - } - - userGroupId, err := runtime.GetRunner().Cmd("echo $SUDO_GID", false, false) - if err != nil { - return errors.Wrap(errors.WithStack(err), "get user group id failed") - } - - chownKubeConfig := fmt.Sprintf("chown -R %s:%s $HOME/.kube", userId, userGroupId) - if _, err := runtime.GetRunner().SudoCmd(chownKubeConfig, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "chown user kube config failed") - } return nil } @@ -493,59 +463,29 @@ func (s *SyncKubeConfigToWorker) Execute(runtime connector.Runtime) error { if v, ok := s.PipelineCache.Get(common.ClusterStatus); ok { cluster := v.(*K3sStatus) - createConfigDirCmd := "mkdir -p /root/.kube" - if _, err := runtime.GetRunner().SudoCmd(createConfigDirCmd, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "create .kube dir failed") - } - oldServer := "server: https://127.0.0.1:6443" newServer := fmt.Sprintf("server: https://%s:%d", s.KubeConf.Cluster.ControlPlaneEndpoint.Domain, s.KubeConf.Cluster.ControlPlaneEndpoint.Port) newKubeConfig := strings.Replace(cluster.KubeConfig, oldServer, newServer, -1) - syncKubeConfigForRootCmd := fmt.Sprintf("echo '%s' > %s", newKubeConfig, "/root/.kube/config") - if _, err := runtime.GetRunner().SudoCmd(syncKubeConfigForRootCmd, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "sync kube config for root failed") - } - - if _, err := runtime.GetRunner().SudoCmd("chmod 0600 /root/.kube/config", false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "chmod k3s $HOME/.kube/config failed") - } - - userConfigDirCmd := "mkdir -p $HOME/.kube" - if _, err := runtime.GetRunner().Cmd(userConfigDirCmd, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "user mkdir $HOME/.kube failed") - } - - syncKubeConfigForUserCmd := fmt.Sprintf("echo '%s' > %s", newKubeConfig, "$HOME/.kube/config") - if _, err := runtime.GetRunner().Cmd(syncKubeConfigForUserCmd, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "sync kube config for normal user failed") - } - - // userId, err := runtime.GetRunner().Cmd("echo $(id -u)", false, false) - // if err != nil { - // return errors.Wrap(errors.WithStack(err), "get user id failed") - // } - - // userGroupId, err := runtime.GetRunner().Cmd("echo $(id -g)", false, false) - // if err != nil { - // return errors.Wrap(errors.WithStack(err), "get user group id failed") - // } - - userId, err := runtime.GetRunner().Cmd("echo $SUDO_UID", false, false) + targetHome, targetUID, targetGID, err := utils.ResolveSudoUserHomeAndIDs(runtime) if err != nil { - return errors.Wrap(errors.WithStack(err), "get user id failed") + return err } + targetKubeConfigPath := filepath.Join(targetHome, ".kube", "config") - userGroupId, err := runtime.GetRunner().Cmd("echo $SUDO_GID", false, false) - if err != nil { - return errors.Wrap(errors.WithStack(err), "get user group id failed") + cmds := []string{ + "mkdir -p /root/.kube", + fmt.Sprintf("echo '%s' > %s", newKubeConfig, "/root/.kube/config"), + "chmod 0600 /root/.kube/config", + fmt.Sprintf("mkdir -p %s", filepath.Join(targetHome, ".kube")), + fmt.Sprintf("echo '%s' > %s", newKubeConfig, targetKubeConfigPath), + fmt.Sprintf("chmod 0600 %s", targetKubeConfigPath), + fmt.Sprintf("chown -R %s:%s %s", targetUID, targetGID, filepath.Join(targetHome, ".kube")), } - - chownKubeConfig := fmt.Sprintf("chown -R %s:%s -R $HOME/.kube", userId, userGroupId) - if _, err := runtime.GetRunner().SudoCmd(chownKubeConfig, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "chown user kube config failed") + if _, err := runtime.GetRunner().SudoCmd(strings.Join(cmds, " && "), false, false); err != nil { + return errors.Wrap(errors.WithStack(err), "sync kube config failed") } } return nil diff --git a/cli/pkg/kubernetes/module.go b/cli/pkg/kubernetes/module.go index 6bddfe0c0..8e21a952b 100644 --- a/cli/pkg/kubernetes/module.go +++ b/cli/pkg/kubernetes/module.go @@ -23,6 +23,7 @@ import ( "github.com/beclab/Olares/cli/pkg/core/prepare" "github.com/beclab/Olares/cli/pkg/core/task" "github.com/beclab/Olares/cli/pkg/manifest" + "github.com/beclab/Olares/cli/pkg/storage" ) type StatusModule struct { @@ -243,6 +244,18 @@ func (j *JoinNodesModule) Init() { Retry: 5, } + createSharedLibDirForWorker := &task.RemoteTask{ + Name: "CreateSharedLibDir(k8s)", + Desc: "Create shared lib directory on worker", + Hosts: j.Runtime.GetHostsByRole(common.Worker), + Prepare: &prepare.PrepareCollection{ + &NodeInCluster{Not: true}, + new(common.OnlyWorker), + }, + Action: new(storage.CreateSharedLibDir), + Parallel: true, + } + joinWorkerNode := &task.RemoteTask{ Name: "JoinWorkerNode(k8s)", Desc: "Join worker node", @@ -323,6 +336,7 @@ func (j *JoinNodesModule) Init() { j.Tasks = []task.Interface{ generateKubeadmConfig, joinMasterNode, + createSharedLibDirForWorker, joinWorkerNode, copyKubeConfig, removeMasterTaint, diff --git a/cli/pkg/kubernetes/tasks.go b/cli/pkg/kubernetes/tasks.go index c84876eb3..cddd28329 100644 --- a/cli/pkg/kubernetes/tasks.go +++ b/cli/pkg/kubernetes/tasks.go @@ -417,51 +417,23 @@ type CopyKubeConfigForControlPlane struct { } func (c *CopyKubeConfigForControlPlane) Execute(runtime connector.Runtime) error { - createConfigDirCmd := "mkdir -p /root/.kube" - getKubeConfigCmd := "cp -f /etc/kubernetes/admin.conf /root/.kube/config" - cmd := strings.Join([]string{createConfigDirCmd, getKubeConfigCmd}, " && ") - if _, err := runtime.GetRunner().SudoCmd(cmd, false, false); err != nil { + targetHome, targetUID, targetGID, err := utils.ResolveSudoUserHomeAndIDs(runtime) + if err != nil { + return err + } + + cmds := []string{ + "mkdir -p /root/.kube", + "cp -f /etc/kubernetes/admin.conf /root/.kube/config", + "chmod 0600 /root/.kube/config", + fmt.Sprintf("mkdir -p %s", filepath.Join(targetHome, ".kube")), + fmt.Sprintf("cp -f /etc/kubernetes/admin.conf %s", filepath.Join(targetHome, ".kube", "config")), + fmt.Sprintf("chmod 0600 %s", filepath.Join(targetHome, ".kube", "config")), + fmt.Sprintf("chown -R %s:%s %s", targetUID, targetGID, filepath.Join(targetHome, ".kube")), + } + if _, err := runtime.GetRunner().SudoCmd(strings.Join(cmds, " && "), false, false); err != nil { return errors.Wrap(errors.WithStack(err), "copy kube config failed") } - - userMkdir := "mkdir -p $HOME/.kube" - if _, err := runtime.GetRunner().Cmd(userMkdir, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "user mkdir $HOME/.kube failed") - } - - userCopyKubeConfig := "cp -f /etc/kubernetes/admin.conf $HOME/.kube/config" - if _, err := runtime.GetRunner().SudoCmd(userCopyKubeConfig, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "user copy /etc/kubernetes/admin.conf to $HOME/.kube/config failed") - } - - if _, err := runtime.GetRunner().SudoCmd("chmod 0600 $HOME/.kube/config", false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "chmod $HOME/.kube/config failed") - } - - // userId, err := runtime.GetRunner().Cmd("echo $(id -u)", false, false) - // if err != nil { - // return errors.Wrap(errors.WithStack(err), "get user id failed") - // } - - // userGroupId, err := runtime.GetRunner().Cmd("echo $(id -g)", false, false) - // if err != nil { - // return errors.Wrap(errors.WithStack(err), "get user group id failed") - // } - - userId, err := runtime.GetRunner().Cmd("echo $SUDO_UID", false, false) - if err != nil { - return errors.Wrap(errors.WithStack(err), "get user id failed") - } - - userGroupId, err := runtime.GetRunner().Cmd("echo $SUDO_GID", false, false) - if err != nil { - return errors.Wrap(errors.WithStack(err), "get user group id failed") - } - - chownKubeConfig := fmt.Sprintf("chown -R %s:%s $HOME/.kube", userId, userGroupId) - if _, err := runtime.GetRunner().SudoCmd(chownKubeConfig, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "chown user kube config failed") - } return nil } @@ -521,53 +493,23 @@ func (s *SyncKubeConfigToWorker) Execute(runtime connector.Runtime) error { if v, ok := s.PipelineCache.Get(common.ClusterStatus); ok { cluster := v.(*KubernetesStatus) - createConfigDirCmd := "mkdir -p /root/.kube" - if _, err := runtime.GetRunner().SudoCmd(createConfigDirCmd, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "create .kube dir failed") - } - - syncKubeConfigForRootCmd := fmt.Sprintf("echo '%s' > %s", cluster.KubeConfig, "/root/.kube/config") - if _, err := runtime.GetRunner().SudoCmd(syncKubeConfigForRootCmd, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "sync kube config for root failed") - } - - if _, err := runtime.GetRunner().SudoCmd("chmod 0600 /root/.kube/config", false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "chmod $HOME/.kube/config failed") - } - - userConfigDirCmd := "mkdir -p $HOME/.kube" - if _, err := runtime.GetRunner().Cmd(userConfigDirCmd, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "user mkdir $HOME/.kube failed") - } - - syncKubeConfigForUserCmd := fmt.Sprintf("echo '%s' > %s", cluster.KubeConfig, "$HOME/.kube/config") - if _, err := runtime.GetRunner().Cmd(syncKubeConfigForUserCmd, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "sync kube config for normal user failed") - } - - // userId, err := runtime.GetRunner().Cmd("echo $(id -u)", false, false) - // if err != nil { - // return errors.Wrap(errors.WithStack(err), "get user id failed") - // } - - // userGroupId, err := runtime.GetRunner().Cmd("echo $(id -g)", false, false) - // if err != nil { - // return errors.Wrap(errors.WithStack(err), "get user group id failed") - // } - - userId, err := runtime.GetRunner().Cmd("echo $SUDO_UID", false, false) + targetHome, targetUID, targetGID, err := utils.ResolveSudoUserHomeAndIDs(runtime) if err != nil { - return errors.Wrap(errors.WithStack(err), "get user id failed") + return err } + targetKubeConfigPath := filepath.Join(targetHome, ".kube", "config") - userGroupId, err := runtime.GetRunner().Cmd("echo $SUDO_GID", false, false) - if err != nil { - return errors.Wrap(errors.WithStack(err), "get user group id failed") + cmds := []string{ + "mkdir -p /root/.kube", + fmt.Sprintf("echo '%s' > %s", cluster.KubeConfig, "/root/.kube/config"), + "chmod 0600 /root/.kube/config", + fmt.Sprintf("mkdir -p %s", filepath.Join(targetHome, ".kube")), + fmt.Sprintf("echo '%s' > %s", cluster.KubeConfig, targetKubeConfigPath), + fmt.Sprintf("chmod 0600 %s", targetKubeConfigPath), + fmt.Sprintf("chown -R %s:%s %s", targetUID, targetGID, filepath.Join(targetHome, ".kube")), } - - chownKubeConfig := fmt.Sprintf("chown -R %s:%s -R $HOME/.kube", userId, userGroupId) - if _, err := runtime.GetRunner().SudoCmd(chownKubeConfig, false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "chown user kube config failed") + if _, err := runtime.GetRunner().SudoCmd(strings.Join(cmds, " && "), false, false); err != nil { + return errors.Wrap(errors.WithStack(err), "sync kube config failed") } } return nil diff --git a/cli/pkg/storage/tasks.go b/cli/pkg/storage/tasks.go index 9add1f647..d115da101 100644 --- a/cli/pkg/storage/tasks.go +++ b/cli/pkg/storage/tasks.go @@ -396,3 +396,17 @@ func (t *DeleteTerminusData) Execute(runtime connector.Runtime) error { return nil } + +type CreateSharedLibDir struct { + common.KubeAction +} + +func (t *CreateSharedLibDir) Execute(runtime connector.Runtime) error { + if runtime.GetSystemInfo().IsDarwin() { + return nil + } + if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("mkdir -p %s && chown 1000:1000 %s", OlaresSharedLibDir, OlaresSharedLibDir), false, false); err != nil { + return errors.Wrap(errors.WithStack(err), "failed to create shared lib dir") + } + return nil +} diff --git a/cli/pkg/terminus/ossystem.go b/cli/pkg/terminus/ossystem.go index d6b36ab0a..1fc58f817 100644 --- a/cli/pkg/terminus/ossystem.go +++ b/cli/pkg/terminus/ossystem.go @@ -38,12 +38,6 @@ type InstallOsSystem struct { } func (t *InstallOsSystem) Execute(runtime connector.Runtime) error { - if !runtime.GetSystemInfo().IsDarwin() { - if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("mkdir -p %s && chown 1000:1000 %s", storage.OlaresSharedLibDir, storage.OlaresSharedLibDir), false, false); err != nil { - return errors.Wrap(errors.WithStack(err), "failed to create shared lib dir") - } - } - config, err := ctrl.GetConfig() if err != nil { return err @@ -367,6 +361,11 @@ func (m *InstallOsSystemModule) Init() { Action: &CreateUserEnvConfigMap{}, } + createSharedLibDir := &task.LocalTask{ + Name: "CreateSharedLibDir", + Action: &storage.CreateSharedLibDir{}, + } + installOsSystem := &task.LocalTask{ Name: "InstallOsSystem", Action: &InstallOsSystem{}, @@ -399,6 +398,7 @@ func (m *InstallOsSystemModule) Init() { m.Tasks = []task.Interface{ applySystemEnv, createUserEnvConfigMap, + createSharedLibDir, installOsSystem, createBackupConfigMap, checkSystemService, diff --git a/cli/pkg/utils/utils.go b/cli/pkg/utils/utils.go index 8b5dbbb57..eedb1fc69 100755 --- a/cli/pkg/utils/utils.go +++ b/cli/pkg/utils/utils.go @@ -321,3 +321,54 @@ func GetBufIOReaderOfTerminalInput() (*bufio.Reader, error) { } return bufio.NewReader(tty), nil } + +// ResolveSudoUserHomeAndIDs resolves the home directory, uid, and gid for the user +// who invoked sudo. If not running under sudo, it falls back to the current user. +// This is useful for commands that need to operate on the invoking user's home +// directory rather than /root when running with sudo. +func ResolveSudoUserHomeAndIDs(runtime connector.Runtime) (home, uid, gid string, err error) { + uid, err = runtime.GetRunner().Cmd("echo ${SUDO_UID:-}", false, false) + if err != nil { + return "", "", "", errors.Wrap(errors.WithStack(err), "get SUDO_UID failed") + } + gid, err = runtime.GetRunner().Cmd("echo ${SUDO_GID:-}", false, false) + if err != nil { + return "", "", "", errors.Wrap(errors.WithStack(err), "get SUDO_GID failed") + } + uid = strings.TrimSpace(uid) + gid = strings.TrimSpace(gid) + + if uid == "" { + uid, err = runtime.GetRunner().Cmd("id -u", false, false) + if err != nil { + return "", "", "", errors.Wrap(errors.WithStack(err), "get current uid failed") + } + gid, err = runtime.GetRunner().Cmd("id -g", false, false) + if err != nil { + return "", "", "", errors.Wrap(errors.WithStack(err), "get current gid failed") + } + uid = strings.TrimSpace(uid) + gid = strings.TrimSpace(gid) + } + + home, err = runtime.GetRunner().Cmd(fmt.Sprintf(`getent passwd %s | awk -F: 'NR==1{print $6; exit}'`, uid), false, false) + if err != nil { + home = "" + } + home = strings.TrimSpace(home) + if home == "" { + home, _ = runtime.GetRunner().Cmd(fmt.Sprintf(`awk -F: -v uid=%s '$3==uid {print $6; exit}' /etc/passwd 2>/dev/null`, uid), false, false) + home = strings.TrimSpace(home) + } + if home == "" { + home, err = runtime.GetRunner().Cmd("echo $HOME", false, false) + if err != nil { + return "", "", "", errors.Wrap(errors.WithStack(err), "get HOME failed") + } + home = strings.TrimSpace(home) + } + if home == "" { + return "", "", "", errors.New("resolve user home failed") + } + return home, uid, gid, nil +} diff --git a/daemon/internel/intranet/proxy.go b/daemon/internel/intranet/proxy.go index 91332905b..6e4c4e99b 100644 --- a/daemon/internel/intranet/proxy.go +++ b/daemon/internel/intranet/proxy.go @@ -84,8 +84,15 @@ func (p *proxyServer) Start() error { clientIp = h } } + if c.IsWebSocket() { ctx = context.WithValue(ctx, WSKey, true) + swp := c.Request().Header.Get("Sec-WebSocket-Protocol") + authToken := c.Request().Header.Get("X-Authorization") + if len(authToken) == 0 && len(swp) > 0 { + // handle missing auth token for websocket + c.Request().Header.Set("X-Authorization", swp) + } } r := c.Request().WithContext(ctx) if clientIp != "" { @@ -243,7 +250,7 @@ func (p *proxyServer) customDialContext(d *net.Dialer) func(ctx context.Context, } if isWs { - klog.Info("WebSocket connection detected, using upgraded dialer") + klog.Info("WebSocket connection detected, using upgraded dialer, ", addr) return tlsDial(ctx, d, func(ctx context.Context, network, addr string) (net.Conn, error) { return proxyDial(ctx, d, network, newAddr) }, network, addr, &tls.Config{InsecureSkipVerify: true}) diff --git a/docs/.vitepress/en.ts b/docs/.vitepress/en.ts index 882ba3fff..9787a620a 100644 --- a/docs/.vitepress/en.ts +++ b/docs/.vitepress/en.ts @@ -557,6 +557,8 @@ const side = { { text: "Stirling PDF", link: "/use-cases/stirling-pdf", + text: "PDFMathTranslate", + link: "/use-cases/pdfmathtranslate", }, ], }, @@ -630,65 +632,46 @@ const side = { link: "/developer/install/cli/olares-cli", collapsed: true, items: [ - { text: "gpu", link: "/developer/install/cli/gpu" }, - { text: "osinfo", link: "/developer/install/cli/osinfo" }, - { text: "node", link: "/developer/install/cli/node" }, { text: "backups", link: "/developer/install/cli/backups", collapsed: true, items: [ + { text: "backup", link: "/developer/install/cli/backups-backup" }, { text: "download", link: "/developer/install/cli/backups-download" }, { text: "region", link: "/developer/install/cli/backups-region" }, - { text: "backup", link: "/developer/install/cli/backups-backup" }, { text: "restore", link: "/developer/install/cli/backups-restore" }, { text: "snapshots", link: "/developer/install/cli/backups-snapshots" }, ], - }, + }, + { text: "change-ip", link: "/developer/install/cli/change-ip" }, + { text: "disk", link: "/developer/install/cli/disk" }, + { text: "download", link: "/developer/install/cli/download" }, + { text: "gpu", link: "/developer/install/cli/gpu" }, + { text: "info", link: "/developer/install/cli/info" }, + { text: "install", link: "/developer/install/cli/install" }, + { text: "logs", link: "/developer/install/cli/logs" }, + { text: "node", link: "/developer/install/cli/node" }, + { text: "osinfo", link: "/developer/install/cli/osinfo" }, + { text: "precheck", link: "/developer/install/cli/precheck" }, + { text: "prepare", link: "/developer/install/cli/prepare" }, + { text: "release", link: "/developer/install/cli/release" }, + { text: "start", link: "/developer/install/cli/start" }, + { text: "stop", link: "/developer/install/cli/stop" }, + { text: "uninstall", link: "/developer/install/cli/uninstall" }, + { text: "upgrade", link: "/developer/install/cli/upgrade" }, { - text: "change-ip", - link: "/developer/install/cli/change-ip", - }, - { - text: "download", - link: "/developer/install/cli/download", - }, - { text: "info", link: "/developer/install/cli/info" }, - { - text: "install", - link: "/developer/install/cli/install", - }, - { - text: "user activate", - link: "/developer/install/cli/user-activate", - }, - { - text: "logs", - link: "/developer/install/cli/logs", - }, - { - text: "precheck", - link: "/developer/install/cli/precheck", - }, - { - text: "prepare", - link: "/developer/install/cli/prepare", - }, - { - text: "release", - link: "/developer/install/cli/release", - }, - { - text: "start", - link: "/developer/install/cli/start", - }, - { - text: "stop", - link: "/developer/install/cli/stop", - }, - { - text: "uninstall", - link: "/developer/install/cli/uninstall", + text: "user", + link: "/developer/install/cli/user", + collapsed: true, + items: [ + { text: "activate", link: "/developer/install/cli/user-activate" }, + { text: "create", link: "/developer/install/cli/user-create" }, + { text: "delete", link: "/developer/install/cli/user-delete" }, + { text: "get", link: "/developer/install/cli/user-get" }, + { text: "list", link: "/developer/install/cli/user-list" }, + { text: "reset-password", link: "/developer/install/cli/user-reset-password" }, + ], }, ], }, diff --git a/docs/.vitepress/zh.ts b/docs/.vitepress/zh.ts index b25116fa8..7ec0f2e35 100644 --- a/docs/.vitepress/zh.ts +++ b/docs/.vitepress/zh.ts @@ -608,72 +608,52 @@ const side = { }, { text: "Olares CLI", - collapsed: true, link: "/zh/developer/install/cli/olares-cli", + collapsed: true, items: [ - { text: "gpu", link: "/zh/developer/install/cli/gpu" }, - { text: "osinfo", link: "/zh/developer/install/cli/osinfo" }, - { text: "node", link: "/zh/developer/install/cli/node" }, { text: "backups", link: "/zh/developer/install/cli/backups", collapsed: true, items: [ + { text: "backup", link: "/zh/developer/install/cli/backups-backup" }, { text: "download", link: "/zh/developer/install/cli/backups-download" }, { text: "region", link: "/zh/developer/install/cli/backups-region" }, - { text: "backup", link: "/zh/developer/install/cli/backups-backup" }, { text: "restore", link: "/zh/developer/install/cli/backups-restore" }, { text: "snapshots", link: "/zh/developer/install/cli/backups-snapshots" }, ], - }, + }, + { text: "change-ip", link: "/zh/developer/install/cli/change-ip" }, + { text: "disk", link: "/zh/developer/install/cli/disk" }, + { text: "download", link: "/zh/developer/install/cli/download" }, + { text: "gpu", link: "/zh/developer/install/cli/gpu" }, + { text: "info", link: "/zh/developer/install/cli/info" }, + { text: "install", link: "/zh/developer/install/cli/install" }, + { text: "logs", link: "/zh/developer/install/cli/logs" }, + { text: "node", link: "/zh/developer/install/cli/node" }, + { text: "osinfo", link: "/zh/developer/install/cli/osinfo" }, + { text: "precheck", link: "/zh/developer/install/cli/precheck" }, + { text: "prepare", link: "/zh/developer/install/cli/prepare" }, + { text: "release", link: "/zh/developer/install/cli/release" }, + { text: "start", link: "/zh/developer/install/cli/start" }, + { text: "stop", link: "/zh/developer/install/cli/stop" }, + { text: "uninstall", link: "/zh/developer/install/cli/uninstall" }, + { text: "upgrade", link: "/zh/developer/install/cli/upgrade" }, { - text: "change-ip", - link: "/zh/developer/install/cli/change-ip", - }, - { - text: "download", - link: "/zh/developer/install/cli/download", - }, - { text: "info", link: "/zh/developer/install/cli/info" }, - { - text: "install", - link: "/zh/developer/install/cli/install", - }, - { - text: "user activate", - link: "/zh/developer/install/cli/user-activate", - }, - { - text: "logs", - link: "/zh/developer/install/cli/logs", - }, - { - text: "precheck", - link: "/zh/developer/install/cli/precheck", - }, - { - text: "prepare", - link: "/zh/developer/install/cli/prepare", - }, - { - text: "release", - link: "/zh/developer/install/cli/release", - }, - { - text: "start", - link: "/zh/developer/install/cli/start", - }, - { - text: "stop", - link: "/zh/developer/install/cli/stop", - }, - { - text: "uninstall", - link: "/zh/developer/install/cli/uninstall", + text: "user", + link: "/zh/developer/install/cli/user", + collapsed: true, + items: [ + { text: "activate", link: "/zh/developer/install/cli/user-activate" }, + { text: "create", link: "/zh/developer/install/cli/user-create" }, + { text: "delete", link: "/zh/developer/install/cli/user-delete" }, + { text: "get", link: "/zh/developer/install/cli/user-get" }, + { text: "list", link: "/zh/developer/install/cli/user-list" }, + { text: "reset-password", link: "/zh/developer/install/cli/user-reset-password" }, + ], }, ], }, - { text: "版本说明", link: "/zh/developer/install/versioning", @@ -719,7 +699,7 @@ const side = { text: "OlaresManifest", link: "/zh/developer/develop/package/manifest", }, - /*/{ + /*{ text: "推荐算法", link: "/zh/developer/develop/package/recommend", },*/ diff --git a/docs/developer/install/cli/backups-backup.md b/docs/developer/install/cli/backups-backup.md index c4622776d..b49b2700c 100644 --- a/docs/developer/install/cli/backups-backup.md +++ b/docs/developer/install/cli/backups-backup.md @@ -65,7 +65,7 @@ These options apply to all backends: kubectl get terminus -o jsonpath='{.items[*].metadata.labels.bytetrade\.io/cluster-id}' ``` -## Example +## Examples ```bash # Backup to Tencent COS olares-cli backups backup cos --path /data --repo-name my_repo \ diff --git a/docs/developer/install/cli/backups-download.md b/docs/developer/install/cli/backups-download.md index 8fe715843..eb8875910 100644 --- a/docs/developer/install/cli/backups-download.md +++ b/docs/developer/install/cli/backups-download.md @@ -12,7 +12,7 @@ olares-cli backups download [options] |--------------------|-----------|--------------------------------------------------------|-------------------------|--------------------| | `--download-cdn-url`| | Specifies the CDN URL for downloading the Restic tool. | No | System default URL | | `--help` | `-h` | Displays help information. | No | N/A | -## Example +## Examples ```bash d # Download Restic using a custom CDN URL olares-cli backups download --download-cdn-url https://custom-cdn.example.com/restic diff --git a/docs/developer/install/cli/backups-region.md b/docs/developer/install/cli/backups-region.md index d2ce03a28..e62ef171e 100644 --- a/docs/developer/install/cli/backups-region.md +++ b/docs/developer/install/cli/backups-region.md @@ -17,7 +17,7 @@ olares-cli backups region space [options] 1. To retrieve the access token and Olares DID, inspect the payload of the network requests made by the Olares Space web interface after logging in. The `token` field corresponds to the access token, and the `userid` field corresponds to the Olares DID. -## Example +## Examples ```bash # Query cloud name and region ID olares-cli backups region space \ diff --git a/docs/developer/install/cli/backups-restore.md b/docs/developer/install/cli/backups-restore.md index 9ec145edd..eaab6fb9d 100644 --- a/docs/developer/install/cli/backups-restore.md +++ b/docs/developer/install/cli/backups-restore.md @@ -69,7 +69,7 @@ These options apply to all backends: kubectl get terminus -o jsonpath='{.items[*].metadata.labels.bytetrade\.io/cluster-id}' ``` -## Example +## Examples ```bash # Restore the data from Tencent COS olares-cli backups restore cos --path /data_restore --repo-name my_repo \ diff --git a/docs/developer/install/cli/backups-snapshots.md b/docs/developer/install/cli/backups-snapshots.md index 383aa5fa1..db9465e8a 100644 --- a/docs/developer/install/cli/backups-snapshots.md +++ b/docs/developer/install/cli/backups-snapshots.md @@ -61,7 +61,7 @@ These options apply to all backends: kubectl get terminus -o jsonpath='{.items[*].metadata.labels.bytetrade\.io/cluster-id}' ``` -## Example +## Examples ```bash # List snapshots for Tencent COS olares-cli backups snapshots cos --repo-name my_repo \ diff --git a/docs/developer/install/cli/disk.md b/docs/developer/install/cli/disk.md new file mode 100644 index 000000000..48791de35 --- /dev/null +++ b/docs/developer/install/cli/disk.md @@ -0,0 +1,33 @@ +# `disk` + +## Synopsis + +The `disk` command provides a set of tools to manage storage resources in the Olares system. It is specifically used for managing LVM-based storage configurations. + + +```bash +olares-cli disk +``` + +## Subcommands + +| Subcommand | Description | +|--|--| +| `extend` | Extends Olares storage capacity on LVM-based installations. | +| `list-unmounted` | Lists unmounted disks. | + +## Options + +| Name | Shorthand | Usage | +|--|--|--| +| `--help` | `-h` | Displays help information.| + +## Examples + +```bash +# List all disks that are connected but not mounted +olares-cli disk list-unmounted + +# Extend Olares storage by adding newly detected unmounted disks +olares-cli disk extend +``` \ No newline at end of file diff --git a/docs/developer/install/cli/gpu.md b/docs/developer/install/cli/gpu.md index 245a2fc59..b322071a0 100644 --- a/docs/developer/install/cli/gpu.md +++ b/docs/developer/install/cli/gpu.md @@ -32,7 +32,7 @@ olares-cli gpu [options] | `--version`| `-v` | Specifies the Olares version for GPU drivers and components.
Version values follow the format `x.y.z` (e.g., `1.10.0`) or include a build date (e.g., `1.10.0-20241109`).
Refer to the [GitHub Releases page](https://github.com/beclab/Olares/releases) for available versions. | No | Current version | | `--help` | `-h` | Displays help information. | No | N/A | -## Example +## Examples ```bash # Install GPU drivers and dependencies to a specific directory diff --git a/docs/developer/install/cli/info.md b/docs/developer/install/cli/info.md index 0c56b90f2..384ad2c58 100644 --- a/docs/developer/install/cli/info.md +++ b/docs/developer/install/cli/info.md @@ -7,7 +7,7 @@ The `info` command displays general information about the installed Olares versi olares-cli info ``` -## Flag +## Options | Name | Shorthand | Usage | |----------|-----------|---------------------------| diff --git a/docs/developer/install/cli/logs.md b/docs/developer/install/cli/logs.md index d4979a509..dff9d7a2c 100644 --- a/docs/developer/install/cli/logs.md +++ b/docs/developer/install/cli/logs.md @@ -28,7 +28,7 @@ olares-cli logs [option] | `--output-dir` | | Saves logs to the specified directory. Creates the directory if it does not exist. | No | `./olares-logs` | | `--since` | | Fetches logs newer than a specified relative duration (e.g., `5s`, `2m`, `3h`). | No | `7d` | -## Example +## Examples ```bash # Collect all logs with default settings olares-cli logs diff --git a/docs/developer/install/cli/node.md b/docs/developer/install/cli/node.md index 45ca3f639..d1c46b17b 100644 --- a/docs/developer/install/cli/node.md +++ b/docs/developer/install/cli/node.md @@ -29,7 +29,7 @@ olares-cli node [options] | `--version` | `-v` | Specifies the Olares version.
Version values follow the format `x.y.z` (e.g., `1.10.0`) or include a build date (e.g., `1.10.0-20241109`).
Refer to the [GitHub Releases page](https://github.com/beclab/Olares/releases) for available versions. | No | Current version | | `--help` | `-h` | Displays help information. | No | N/A | | -## Example +## Examples ```bash # Retrieve system information from a master node at IP 192.168.1.15 diff --git a/docs/developer/install/cli/olares-cli.md b/docs/developer/install/cli/olares-cli.md index 77cf4b3fe..2f92ede65 100644 --- a/docs/developer/install/cli/olares-cli.md +++ b/docs/developer/install/cli/olares-cli.md @@ -28,12 +28,13 @@ wsl -d Ubuntu ## Syntax The Olares CLI uses the following syntax: -> `olares-cli command [subcommand] [option]` +> `olares-cli command [subcommand] [argument] [options] ` where - `command`: Specifies the main operation you want to perform. For example, `olares-cli install`. - `subcommand`: Further specifies the task for commands that support additional operations. For example, `wizard` or `component`. -- `option`: Optional arguments that modify the behavior of the `command`. Options include flags and options with arguments. +- `argument`: Specifies the target resource or input data for the command, typically an ID, name, or file path. For example, in `olares-cli user activate [options]`, `` is the argument. +- `options`: Optional arguments that modify the behavior of the `command`. Options include flags and options with arguments. Olares CLI allows you to temporarily override certain Olares default settings. Each option applies only to the command in which it is used. @@ -43,21 +44,23 @@ To get detailed help for any command, run `olares-cli help`. ## Available CLI commands -| Operation | Syntax | Description | -|--------------------|----------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------| -| `gpu` | `olares-cli gpu [option]` | Manages GPU-related operations. | -| `info` | `olares-cli info [option]` | Displays general information about the operating system of the current device. | -| `node` | `olares-cli node [option]` | Manages node-related operations. | -| `backups` | `olares-cli backups [option]` | Manages backup-related operations. | -| `change-ip` | `olares-cli change-ip [option]` | Changes the IP address of the Olares OS. | -| `download` | `olares-cli download [option]` | Downloads specific resources. | -| `info` | `olares-cli info [option]` | Displays general information about the downloaded Olares OS. | -| `install` | `olares-cli install [option]` | Deploys system-level and user-level components of Olares. | -| `logs` | `olares-cli logs [option]` | Collects logs from Olares system components for debugging and troubleshooting. | -| `precheck` | `olares-cli precheck [option]` | Verifies whether the system environment meets all requirements for Olares installation. | -| `prepare` | `olares-cli prepare [option]` | Prepares the environment for the installation process, including setting up essential services and configurations of Olares. | -| `release` | `olares-cli release [option]` | Packages Olares installation resources for distribution or deployment. | -| `start` | `olares-cli start [option]` | Starts Olares services and components. | -| `stop` | `olares-cli stop [option]` | Stops Olares services and components. | -| `uninstall` | `olares-cli uninstall [option]` | Uninstalls Olares completely, or roll back the installation to a specific phase. | - +| Operation | Syntax | Description | +|--|--|--| +| `backups` | `olares-cli backups [options]` | Manages backup-related operations. | +| `change-ip` | `olares-cli change-ip [options]` | Changes the IP address of the Olares OS. | +| `disk` | `olares-cli disk ` | Manages storage resources in the Olares system. | +| `download` | `olares-cli download [options]` | Downloads specific resources. | +| `gpu` | `olares-cli gpu [options]` | Manages GPU-related operations. | +| `info` | `olares-cli info [options]` | Displays general information about the downloaded Olares OS. | +| `install` | `olares-cli install [options]` | Deploys system-level and user-level components of Olares. | +| `logs` | `olares-cli logs [options]` | Collects logs from Olares system components for debugging and troubleshooting. | +| `node` | `olares-cli node [options]` | Manages node-related operations. | +| `osinfo` | `olares-cli osinfo [options]` | Displays general information about the operating system of the current device. | +| `precheck` | `olares-cli precheck [options]` | Verifies whether the system environment meets all requirements for Olares installation. | +| `prepare` | `olares-cli prepare [options]` | Prepares the environment for the installation process, including setting up essential services and configurations of Olares. | +| `release` | `olares-cli release [options]` | Packages Olares installation resources for distribution or deployment. | +| `start` | `olares-cli start [options]` | Starts Olares services and components. | +| `stop` | `olares-cli stop [options]` | Stops Olares services and components. | +| `uninstall` | `olares-cli uninstall [options]` | Uninstalls Olares completely, or roll back the installation to a specific phase. | +| `upgrade` | `olares-cli upgrade [options]` | Upgrades Olares and checks upgrade readiness and compatibility.| +| `user` | `olares-cli user [options]`| Manages users in the Olares system | \ No newline at end of file diff --git a/docs/developer/install/cli/osinfo.md b/docs/developer/install/cli/osinfo.md index a986d4a0b..e4fedc781 100644 --- a/docs/developer/install/cli/osinfo.md +++ b/docs/developer/install/cli/osinfo.md @@ -8,13 +8,13 @@ The `osinfo` command provides detailed information about the operating system of olares-cli osinfo [options] ``` -## Subcommand +## Subcommands | Subcommand | Description | |------------|----------------------------------------------------------------------| | `show` | Prints information about the operating system of the current device. | -## Flag +## Options | Name | Short | Description | |--------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| diff --git a/docs/developer/install/cli/prepare.md b/docs/developer/install/cli/prepare.md index 2c15b1390..d65fea921 100644 --- a/docs/developer/install/cli/prepare.md +++ b/docs/developer/install/cli/prepare.md @@ -18,7 +18,7 @@ olares-cli prepare [option] | `--version` | `-v` | Specifies the Olares version.
Version values follow the format `x.y.z` (e.g., `1.10.0`) or include a build date (e.g., `1.10.0-20241109`).
Refer to the [GitHub Releases page](https://github.com/beclab/Olares/releases) for available versions. | No | Current version | -## Example +## Examples ```bash # Uses JuiceFS as the root filesystem olares-cli prepare --with-juicefs=true diff --git a/docs/developer/install/cli/start.md b/docs/developer/install/cli/start.md index 3354a14a9..a7bf6aa1f 100644 --- a/docs/developer/install/cli/start.md +++ b/docs/developer/install/cli/start.md @@ -12,7 +12,7 @@ olares-cli start [option] After executing this command, allow 5-8 minutes for all Olares components to restart. You can verify the status of all pods by running `kubectl get pods -A` or by simply trying to access your Olares desktop. ::: -## Option +## Options | Name | Shorthand | Usage | |------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| diff --git a/docs/developer/install/cli/stop.md b/docs/developer/install/cli/stop.md index 6480d848c..7cf21e001 100644 --- a/docs/developer/install/cli/stop.md +++ b/docs/developer/install/cli/stop.md @@ -15,7 +15,7 @@ olares-cli stop [option] | `--help` | `-h` | Displays help information. | No | N/A | | `--timeout` | | Sets the maximum time to wait for a graceful shutdown before using SIGKILL (e.g., `5s`, `2m`, `3h`). | No | `1m` | -## Example +## Examples ```bash # Stop the Olares system olares-cli stop diff --git a/docs/developer/install/cli/upgrade.md b/docs/developer/install/cli/upgrade.md new file mode 100644 index 000000000..5a59cf410 --- /dev/null +++ b/docs/developer/install/cli/upgrade.md @@ -0,0 +1,53 @@ +# `upgrade` + +## Synopsis + +The `upgrade` command provides a set of tools for upgrading Olares and checking upgrade readiness and compatibility. + +```bash +olares-cli upgrade [options] +``` + +## Subcommands + +| Subcommand | Aliases | Description | +|--|--|--| +| `precheck` | | Prechecks Olares for upgrade. | +| `spec` | `current-spec` | Gets the upgrade spec of the current CLI version. | +| `viable` | | Determines whether upgrade can be directly performed upon a base version. | + +## Global options + +These options apply to the main `upgrade` command and are inherited by its subcommands where applicable. + +| Option | Shorthand | Usage | Required | Default | +|--|--|--|--|--| +| `--base-dir` | `-b` | Sets the base directory for Olares packages. | No | `$HOME/.olares` | +| `--help` | `-h` | Displays help information. | No | N/A | +| `--version` | `-v` | Sets the target Olares version to upgrade to. For example, `1.10.0`, `1.10.0-20241109`. | No | N/A | + +## Options for `viable` + +| Option | Shorthand | Usage | Required | Default | +|--|--|--|--|--| +| `--base` | `-b` | Base version to check. | No | Current Olares system version | + +:::warning Option conflict +The `-b` shorthand is used by the parent command for `--base-dir`. However, when running `upgrade viable`, `-b` specifically refers to `--base`. +::: + +## Examples + +```bash +# Check whether the current system can be upgraded directly +olares-cli upgrade viable + +# Check upgrade viability from a specific base version +olares-cli upgrade viable --base 1.9.0 + +# Run pre-upgrade checks +olares-cli upgrade precheck + +# View the upgrade spec of the current CLI +olares-cli upgrade spec +``` \ No newline at end of file diff --git a/docs/developer/install/cli/user-activate.md b/docs/developer/install/cli/user-activate.md index 1c6bf9a86..0202518ed 100644 --- a/docs/developer/install/cli/user-activate.md +++ b/docs/developer/install/cli/user-activate.md @@ -1,8 +1,9 @@ -# `user activate` +# `activate` ## Synopsis -The `user activate` command activates an existing Olares account. It requires the user's Olares ID, password, and 12-word mnemonic phrase to complete the activation. This command typically requires administrator privileges (`sudo`). +The `activate` subcommand activates an existing Olares account. It requires the user's Olares ID, password, and 12-word mnemonic phrase to complete the activation. + ```bash olares-cli user activate [options] @@ -12,31 +13,32 @@ olares-cli user activate [options] | Argument | Description | Required| |--|--|--| -| `` | Specifies the unique identifier for the Olares user account to be activated.
Similar to an email address(e.g., `alice123@olares.com`).| **Yes** | +| `` | Specifies the unique identifier for the Olares user account
to be activated.
Similar to an email address like `alice123@olares.com`.| Yes | ## Options -| Option | Shorthand | Usage | Required | Default | +| Option | Short| Usage | Required | Default | |--|--|--|--|--| -| `--bfl` | | Specifies the Backend For Launcher (BFL) service URL (e.g., `https://example.com`). | No | `http://127.0.0.1:30180` | +| `--bfl` | | Specifies the Backend For Launcher (BFL) service URL, such as `https://example.com`. | No | `http://127.0.0.1:30180` | | `--enable-tunnel` | | Enables or disables tunnel mode for activation. | No | `false` | | `--help` | `-h` | Displays help information. | No | N/A | -| `--host` | | Specifies the Fast Reverse Proxy (FRP) host.
Only used when the `--enable-tunnel` option is set to `true`. | No | N/A | -| `--jws` | | Specifies the FRP JWS token.
Only used when the `--enable-tunnel` option is set to `true`.| No | N/A | +| `--host` | | Specifies the Fast Reverse Proxy (FRP) host. Only used when `--enable-tunnel` option is set to `true`. | No | N/A | +| `--jws` | | Specifies the FRP JWS token. Only used when `--enable-tunnel` option is set to `true`.| No | N/A | | `--language` | | Sets the system language. | No | `en-US` | | `--location` | | Sets the timezone location. | No | `Asia/Shanghai` | -| `--mnemonic` | | Specifies the 12-word mnemonic phrase required for activation. | **Yes** | N/A | -| `--password` | `-p` | Specifies the Olares login password for authentication. | **Yes** | N/A | -| `--vault` | | Specifies the Vault service URL (e.g., `https://example.com`). | No | `http://127.0.0.1:30181` | +| `--mnemonic` | | Specifies the 12-word mnemonic phrase required for activation. | Yes | N/A | +| `--password` | `-p` | Specifies the Olares login password for authentication. | Yes | N/A | +| `--reset-password` | | Specifies the new password to set during password reset. This option is required only when performing a password reset. | No | N/A | +| `--vault` | | Specifies the Vault service URL, such as `https://example.com`. | No | `http://127.0.0.1:30180` | -## Example +## Examples ```bash # Activate an Olares user account -sudo olares-cli user activate alice@olares.com -p "HerPassWord" --mnemonic "apple banana cherry door eagle forest grape house island jacket kite lemon" +olares-cli user activate alic123e@olares.com -p "HerPassWord" --mnemonic "apple banana cherry door eagle forest grape house island jacket kite lemon" # Activate an Olares user account with tunnel mode enabled -sudo olares-cli user activate david@olares.com -p "HisPassWord" --enable-tunnel --host "frp-gateway.olares.com" --jws "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.demo.signature" --bfl http://127.0.0.1:30180 --vault http://127.0.0.1:30180/server --mnemonic "apple banana cherry door eagle forest grape house island jacket kite lemon" +olares-cli user activate david456@olares.com -p "HisPassWord" --enable-tunnel --host "frp-gateway.olares.com" --jws "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.demo.signature" --bfl http://127.0.0.1:30180 --vault http://127.0.0.1:30180/server --mnemonic "apple banana cherry door eagle forest grape house island jacket kite lemon" # Activate an Olares user account with specific language and timezone settings -sudo olares-cli user activate carol@olares.com -p "AnotherPassWord" --mnemonic "alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu" --language "en-US" --location "America/New_York" +olares-cli user activate carol789@olares.com -p "AnotherPassWord" --mnemonic "alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu" --language "en-US" --location "America/New_York" ``` \ No newline at end of file diff --git a/docs/developer/install/cli/user-create.md b/docs/developer/install/cli/user-create.md new file mode 100644 index 000000000..1efc2ddea --- /dev/null +++ b/docs/developer/install/cli/user-create.md @@ -0,0 +1,46 @@ +# `create` + +## Synopsis + +The `create` subcommand creates a new user account in the Olares system. It allows administrators to define initial settings such as the username, password, role permissions, and resource limits. + +**Aliases**: `create`, `add`, `new` + +```bash +olares-cli user create [options] +``` + +## Arguments + +| Argument | Description | Required| +|--|--|--| +| `` | Specifies the username for the new account.
It is typically the part before the `@` symbol in an Olares ID.
For example, `alice123` for `alice123@olares.com`.| Yes | + +## Options +| Option | Shorthand | Usage | Required | Default | +|--|--|--|--|--| +| `--cpu-limit` | `-c` | Sets the CPU limit for the user environment. | No | `1` | +| `--description` | | Adds a description for the user account. | No | N/A | +| `--display-name` | | Sets the display name for the user. | No | N/A | +| `--domain` | | Specifies the domain for the Olares ID. | No | Olares system's domain | +| `--help` | `-h` | Displays help information. | No | N/A | +| `--kubeconfig` | | Specifies the path to a kubeconfig file. | No | N/A | +| `--memory-limit` | `-m` | Sets the memory limit for the user environment. | No | `3G` | +| `--password` | `-p` | Sets the initial login password for the user. | No | N/A | +| `--role` | `-r` | Sets the user role.
Valid values: `owner`, `admin`, `normal`. | No | `normal` | + +## Examples + +```bash +# Create a basic user with default settings +olares-cli user create alice123 + +# Create a user with a specified password and role +olares-cli user create blake123 -p "StrongPassword123" -r admin + +# Create a user with custom resource limits (2 CPU cores, 4 GB memory) +olares-cli user create carol123 --cpu-limit 2 --memory-limit 4G + +# Create a user with display name and description +olares-cli user create david123 --display-name "David Smith" --description "Data platform administrator" +``` \ No newline at end of file diff --git a/docs/developer/install/cli/user-delete.md b/docs/developer/install/cli/user-delete.md new file mode 100644 index 000000000..e8cc0883d --- /dev/null +++ b/docs/developer/install/cli/user-delete.md @@ -0,0 +1,30 @@ +# `delete` + +## Synopsis + +The `delete` subcommand permanently removes an existing user account from the Olares system. + +**Aliases**: `delete`, `d`, `del`, `rm`, `remove` + +```bash +olares-cli user delete [options] +``` + +## Arguments + +| Argument | Description | Required| +|--|--|--| +| `` | Specifies the username of the account to be deleted.
It is typically the part before the `@` symbol in an Olares ID.
For example, `alice123` for `alice123@olares.com`.| Yes | + +## Options +| Option | Shorthand | Usage | Required | Default | +|--|--|--|--|--| +| `--help` | `-h` | Displays help information. | No | N/A | +| `--kubeconfig` | | Specifies the path to a kubeconfig file. | No | N/A | + +## Examples + +```bash +# Delete a user named alice123 +olares-cli user delete alice123 +``` \ No newline at end of file diff --git a/docs/developer/install/cli/user-get.md b/docs/developer/install/cli/user-get.md new file mode 100644 index 000000000..5254b69ac --- /dev/null +++ b/docs/developer/install/cli/user-get.md @@ -0,0 +1,33 @@ +# `get` + +## Synopsis + +The `get` subcommand retrieves detailed information about a specific Olares user account. The output can be formatted as a table or JSON. + +```bash +olares-cli user get [options] +``` + +## Arguments + +| Argument | Description | Required| +|--|--|--| +| `` | Specifies the username of the account to retrieve.
It is typically the part before the `@` symbol in an Olares ID.
For example, `alice123` for `alice123@olares.com`.| Yes | + +## Options +| Option | Shorthand | Usage | Required | Default | +|--|--|--|--|--| +| `--help` | `-h` | Displays help information. | No | N/A | +| `--kubeconfig` | | Specifies the path to a kubeconfig file. | No | N/A | +| `--no-headers` | | Disables the header row in the output. | No | N/A | +| `--output` | `-o` | Specifies the output format. Valid values: `table`, `json`. | No | `table` | + +## Examples + +```bash +# Get details for user named alice123 in default table format +olares-cli user get alice123 + +# Get details for user named blake123 in JSON format +olares-cli user get blake123 -o json +``` \ No newline at end of file diff --git a/docs/developer/install/cli/user-list.md b/docs/developer/install/cli/user-list.md new file mode 100644 index 000000000..bf5f9363f --- /dev/null +++ b/docs/developer/install/cli/user-list.md @@ -0,0 +1,34 @@ +# `list` + +## Synopsis + +The `list` subcommand displays a list of all registered users in the Olares system. You can sort, filter, and format the output to suit your needs. + +**Aliases**: `list`, `ls`, `l` + +```bash +olares-cli user list [options] +``` + +## Options +| Option | Shorthand | Usage | Required | Default | +|--|--|--|--|--| +| `--help` | `-h` | Displays help information. | No | N/A | +| `--kubeconfig` | | Specifies the path to a kubeconfig file. | No | N/A | +| `--no-headers` | | Disables the header row in the output. | No | N/A | +| `--output` | `-o`| Specifies the output format. Valid values: `table`, `json`.| No | `table` | +| `--reverse` | `-r` | Reverses the sort order of the output. | No | N/A | +| `--sort` | | Sorts the output by a specific field.
Valid values: `name`, `role`, `create-time`, `memory`, `cpu` | No | N/A | + +## Examples + +```bash +# List all users in a table format +olares-cli user list + +# List all users in JSON format +olares-cli user list -o json + +# List users sorted by role +olares-cli user list --sort role +``` \ No newline at end of file diff --git a/docs/developer/install/cli/user-reset-password.md b/docs/developer/install/cli/user-reset-password.md new file mode 100644 index 000000000..e7b1c5ca5 --- /dev/null +++ b/docs/developer/install/cli/user-reset-password.md @@ -0,0 +1,29 @@ +# `reset-password` + +## Synopsis + +The `reset-password` subcommand forcefully resets the login password for a specific user via the authentication provider. + +```bash +olares-cli user reset-password [options] +``` + +## Arguments + +| Argument | Description | Required| +|--|--|--| +| `` | Specifies the username of the account to reset.
It is typically the part before the `@` symbol in an Olares ID.
For example, `alice123` for `alice123@olares.com`.| Yes | + +## Options +| Option | Shorthand | Usage | Required | Default | +|--|--|--|--|--| + `--help` | `-h` | Displays help information. | No | N/A | +| `--kubeconfig` | | Specifies the path to a kubeconfig file. | No | N/A | +| `--password` | `-p` | Specifies the new password for the user. | Yes | N/A | + +## Examples + +```bash +# Reset password for user named alice123 +olares-cli user reset-password alice123 -p "NewSecurePassword456!" +``` \ No newline at end of file diff --git a/docs/developer/install/cli/user.md b/docs/developer/install/cli/user.md new file mode 100644 index 000000000..ada1c4529 --- /dev/null +++ b/docs/developer/install/cli/user.md @@ -0,0 +1,13 @@ +# `user` +The `user` command provides a set of tools to manage users in the Olares system. It allows administrators to create, activate, query, and remove users, as well as reset user passwords. + +## Subcommands + +| Subcommand | Description | +|--|--| +| `activate` | Activates an existing Olares account. | +| `create` | Creates a new user. | +| `delete` | Deletes an existing user. | +| `get` | Retrieves details of a specific user. | +| `list` | Lists all users within the Olares cluster. | +| `reset-password` | Forcefully resets a user's password via the authentication provider. | \ No newline at end of file diff --git a/docs/public/images/manual/use-cases/access-translated-files.png b/docs/public/images/manual/use-cases/access-translated-files.png new file mode 100644 index 000000000..a87586226 Binary files /dev/null and b/docs/public/images/manual/use-cases/access-translated-files.png differ diff --git a/docs/public/images/manual/use-cases/copy-localhost-address.png b/docs/public/images/manual/use-cases/copy-localhost-address.png new file mode 100644 index 000000000..d6d32868c Binary files /dev/null and b/docs/public/images/manual/use-cases/copy-localhost-address.png differ diff --git a/docs/public/images/manual/use-cases/download-in-files.png b/docs/public/images/manual/use-cases/download-in-files.png new file mode 100644 index 000000000..0436dde45 Binary files /dev/null and b/docs/public/images/manual/use-cases/download-in-files.png differ diff --git a/docs/public/images/manual/use-cases/download-translated-files.png b/docs/public/images/manual/use-cases/download-translated-files.png new file mode 100644 index 000000000..ec574126b Binary files /dev/null and b/docs/public/images/manual/use-cases/download-translated-files.png differ diff --git a/docs/public/images/manual/use-cases/install-pdfmathtranslate.png b/docs/public/images/manual/use-cases/install-pdfmathtranslate.png new file mode 100644 index 000000000..6b148b2f3 Binary files /dev/null and b/docs/public/images/manual/use-cases/install-pdfmathtranslate.png differ diff --git a/docs/public/images/manual/use-cases/local-model-setup.png b/docs/public/images/manual/use-cases/local-model-setup.png new file mode 100644 index 000000000..89acd06c9 Binary files /dev/null and b/docs/public/images/manual/use-cases/local-model-setup.png differ diff --git a/docs/public/images/manual/use-cases/open-pdfmathtranslate.png b/docs/public/images/manual/use-cases/open-pdfmathtranslate.png new file mode 100644 index 000000000..6f1e3820d Binary files /dev/null and b/docs/public/images/manual/use-cases/open-pdfmathtranslate.png differ diff --git a/docs/public/images/manual/use-cases/set-translation-scope.png b/docs/public/images/manual/use-cases/set-translation-scope.png new file mode 100644 index 000000000..a0f89d68e Binary files /dev/null and b/docs/public/images/manual/use-cases/set-translation-scope.png differ diff --git a/docs/public/images/manual/use-cases/translation-progress-normal.png b/docs/public/images/manual/use-cases/translation-progress-normal.png new file mode 100644 index 000000000..72e5e1be7 Binary files /dev/null and b/docs/public/images/manual/use-cases/translation-progress-normal.png differ diff --git a/docs/use-cases/index.md b/docs/use-cases/index.md index db9182190..80ac2a40e 100644 --- a/docs/use-cases/index.md +++ b/docs/use-cases/index.md @@ -23,5 +23,6 @@ From running AI models to building seamless workflows across your self-hosted se { title: 'ACE-Step', link: './ace-step.html', tags: ['AI']}, { title: 'Duix.Avatar', link: './duix-avatar.html', tags: ['AI']}, { title: 'Stirling PDF', link: './stirling-pdf.html', tags: ['Productivity']}, + { title: 'PDFMathTranslate', link: './pdfmathtranslate.html', tags: ['AI']}, ]" /> \ No newline at end of file diff --git a/docs/use-cases/pdfmathtranslate.md b/docs/use-cases/pdfmathtranslate.md new file mode 100644 index 000000000..f3901b88e --- /dev/null +++ b/docs/use-cases/pdfmathtranslate.md @@ -0,0 +1,144 @@ +--- +outline: [2, 4] +description: Learn how to install and configure PDFMathTranslate on Olares. This tutorial guides you through using the local AI model Ollama to translate scientific PDFs, preserving original layouts and mathematical formulas. +--- + +# Translate scientific PDFs while preserving layout + +PDFMathTranslate is an application designed to translate scientific PDF documents while retaining the original layout and mathematical formulas. + +This tutorial provides instructions on how to install and use PDFMathTranslate on Olares, using the local AI model Ollama for translation. + +## Learning objectives + +By the end of this tutorial, you are able to: +- Configure the local AI model for PDF translation. +- Translate a scientific PDF and manage the output files. + +## Prerequisites + +Before you begin, make sure: +- Ollama is installed and running in your Olares environment. +- At least one model is installed using Ollama. For more information, see [Ollama](ollama.md). + +## Install PDFMathTranslate + +1. Open the Olares Market and search for "PDFMathTranslate". +2. Click **Get**, and then click **Install**. + + ![Install PDFMathTranslate](/images/manual/use-cases/install-pdfmathtranslate.png#bordered) + +3. When the installation finishes, click **Open**. The PDFMathTranslate workspace is displayed. + + ![Open PDFMathTranslate](/images/manual/use-cases/open-pdfmathtranslate.png#bordered) + +## Translate + +### Upload your PDF document + +:::warning PDF format requirements +Ensure that the PDF file is a standard PDF document that is not password-protected or corrupted. The application cannot process invalid PDF files. +::: + +In the **File** area, select your input **Type**: +- If you select **File**, drag and drop your PDF document into the upload area, or click the area to browse your local storage. + + When the document is uploaded, a preview of it appears in the **Preview** pane on the right. + +- If you select **Link**, enter the link address of the PDF document. + + The **Preview** pane remains blank during this step. The document content only appears in this area after the translation is completed. + +### Configure the translation service + +To use the local AI service Ollama for translation, configure the following settings: + +1. From the **Service** list, select **Ollama**. +2. (Optional) To obtain the Ollama host address: + + a. Go to Olares **Settings** > **Application** > **Ollama**. + + b. In the **Entrances** section, click **Ollama API**. + + c. Click **Set up endpoint**, and then click content_copy to copy the endpoint address. + + ![Obtain Ollama host address](/images/manual/use-cases/copy-localhost-address.png#bordered){width=60%} + +3. In the **OLLAMA_HOST** field, enter the Ollama host address. +4. In the **OLLAMA_MODEL** field, enter the exact identifier of the Ollama model you have downloaded. For example, `gemma3:4b`. + + ![Open PDFMathTranslate](/images/manual/use-cases/local-model-setup.png#bordered) + +### Select languages and scope + +1. Select the source and target languages: + + a. **Translate from** indicates the original document's language. + + b. **Translate to** indicates the language you want to read. + + :::info + PDFMathTranslate does not auto-detect the languages. You must select them manually. Supported languages include English, Simplified Chinese, Traditional Chinese, French, German, Japanese, Korean, Russian, Spanish, and Italian. + ::: + +2. Specify which pages to translate: + * **All**: Translates the entire document. + * **First**: Translates only the first page. + * **First 5 pages**: Translates the first five pages. + * **Others**: Translates a custom range of pages. + + ![Set translation scope in PDFMathTranslate](/images/manual/use-cases/set-translation-scope.png#bordered) + +3. Click **Translate**. The translation starts immediately. + + :::warning + Do not click the **Cancel** button during translation. This might cause the process to report an error. + ::: + +### Download your files + +When the translation is completed, the translated file is displayed in the **Preview** pane, and the application generates three files: + +- Original source file +- Translated file +- Bilingual version + +You can find these files in the Files app. To download them to your local computer, download them directly from the PDFMathTranslate workspace, or use the Files app. + +#### In PDFMathTranslate workspace + +On the left side of the pdfmathtranslate workspace, in the **Translated** section, click the download button next to the file. + +![Download files translated in PDFMathTranslate](/images/manual/use-cases/download-translated-files.png#bordered) + +#### From Olares Files app + +1. Open the Files app, and then go to **Data** > **pdfmathtranslate** > **pdfmathtranslate**. + + ![Access files translated by PDFMathTranslate](/images/manual/use-cases/access-translated-files.png#bordered) + +2. Double-click a file, and then click the download icon in the upper-right corner. + + ![Download files translated from Olares Files](/images/manual/use-cases/download-in-files.png#bordered) + +## FAQ + +### Why did the translation progress bar disappear? + +If you refresh the page while a translation is running, the progress bar might disappear from the screen. This is a display issue only, and the translation is still processing in the background. + +Wait for it to finish or check the output folder. + +### Will the app keep multiple versions of the same file? + +If you translate the same file name multiple times, the system replaces the previous version with the new one. It does not create numbered copies such as `file_1.pdf`. To keep multiple versions, rename your source file before translating it again. + +### What should I do if the app becomes unresponsive or takes unusually long? + +If the translation takes significantly longer than usual or the application stops responding, the background process might have stalled. To resolve this issue, uninstall and then re-install pdfmathtranslate. + +### How do I perform a clean uninstallation of PDFMathTranslate? + +To completely remove the application and its data: +1. Uninstall the app from Market or Desktop. For more information, see [Uninstall applications](../manual/olares/market/market.md#uninstall-applications). +2. Open the Files app, go to **Application** > **Data**, and then delete the `pdfmathtranslate` folder. diff --git a/docs/zh/developer/install/cli/disk.md b/docs/zh/developer/install/cli/disk.md new file mode 100644 index 000000000..5671cf56f --- /dev/null +++ b/docs/zh/developer/install/cli/disk.md @@ -0,0 +1,32 @@ +# `disk` + +## 命令说明 + +`disk`命令提供了一组用于管理 Olares 系统存储资源的工具,主要用于基于 LVM 的存储配置管理。 + +```bash +olares-cli disk +``` + +## 子命令 + +| 子命令 | 描述 | +|--|--| +| `extend` | 在基于 LVM 的安装环境中扩展 Olares 的存储容量。 | +| `list-unmounted` | 列出未挂载的磁盘。 | + +## 参数标记 + +| 名称 | 简写 | 说明 | +|--|--|--| +| `--help` | `-h` | 显示帮助信息。 | + +## 使用示例 + +```bash +# 列出未挂载的磁盘 +olares-cli disk list-unmounted + +# 添加新检测到的未挂载磁盘来扩展 Olares 存储 +olares-cli disk extend +``` \ No newline at end of file diff --git a/docs/zh/developer/install/cli/olares-cli.md b/docs/zh/developer/install/cli/olares-cli.md index b460a6306..025a92173 100644 --- a/docs/zh/developer/install/cli/olares-cli.md +++ b/docs/zh/developer/install/cli/olares-cli.md @@ -28,11 +28,12 @@ wsl -d Ubuntu ## 语法 Olares 命令行工具使用如下语法: -> `olares-cli 命令 [子命令] [选项]` +> `olares-cli 命令 [子命令] [参数] [选项]` 其中: - `命令`:指定要执行的主要操作,例如 `olares-cli install`。 - `子命令`:进一步指定命令的具体任务,适用于支持子操作的命令。例如 `wizard` 或 `component`。 +- `参数`:指定命令的目标资源或输入数据,通常是 ID、名称或文件路径。例如,在 `olares-cli user activate [选项]` 中,`` 就是该命令的参数。 - `选项`:可选参数,用于修改命令的行为。包括标志(flags)和带参数的选项。 通过 Olares 命令行工具,你可以临时覆盖某些 Olares 默认设置。每个选项仅对当前执行的命令生效。 @@ -43,21 +44,23 @@ Olares 命令行工具使用如下语法: ## 可用命令列表 -| 操作 | 语法 | 说明 | -|--------------------|-----------------------------------------|--------------------------------| -| `gpu` | `olares-cli gpu <子命令> [选项]` | 管理 GPU 相关的操作。 | -| `info` | `olares-cli info <子命令> [选项]` | 显示当前设备的操作系统信息。 | -| `node` | `olares-cli node <子命令> [选项]` | 管理节点相关的操作。 | -| `backups` | `olares-cli backups <子命令> [选项]` | 管理备份相关操作。 | -| `change-ip` | `olares-cli change-ip [选项]` | 修改 Olares OS 的 IP 地址。 | -| `download` | `olares-cli download <子命令> [选项]` | 下载指定资源。 | -| `info` | `olares-cli info [选项]` | 显示已下载的 Olares OS 的常规信息。 | -| `install` | `olares-cli install [选项]` | 部署 Olares 的系统级和用户级组件。 | -| `logs` | `olares-cli logs [选项]` | 收集 Olares 系统组件的日志,用于调试和故障排查。 | -| `precheck` | `olares-cli precheck [选项]` | 检查系统环境是否满足 Olares 安装要求。 | -| `prepare` | `olares-cli prepare [选项]` | 为安装过程准备环境,包括设置 Olares 的基础服务和配置 | -| `release` | `olares-cli release [选项]` | 打包 Olares 安装资源以供分发或部署。 | -| `start` | `olares-cli start [选项]` | 启动 Olares 服务和组件。 | -| `stop` | `olares-cli stop [选项]` | 停止 Olares 服务和组件。 | -| `uninstall` | `olares-cli uninstall [选项]` | 完全卸载 Olares,或将安装回滚到特定阶段。 | - +| 操作 | 语法 | 说明 | +|--|--|--| +| `backups` | `olares-cli backups <子命令> [选项]` | 管理备份相关操作。 | +| `change-ip` | `olares-cli change-ip [选项]` | 修改 Olares OS 的 IP 地址。 | +| `disk` | `olares-cli disk <子命令>` | 管理 Olares 系统存储资源。 | +| `download` | `olares-cli download <子命令> [选项]` | 下载指定资源。 | +| `gpu` | `olares-cli gpu <子命令> [选项]` | 管理 GPU 相关的操作。 | +| `info` | `olares-cli info [选项]` | 显示已下载的 Olares OS 的常规信息。| +| `install` | `olares-cli install [选项]` | 部署 Olares 的系统级和用户级组件。| +| `logs` | `olares-cli logs [选项]` | 收集 Olares 系统组件的日志,用于调试和故障排查。 | +| `node` | `olares-cli node <子命令> [选项]` | 管理节点相关的操作。 | +| `osinfo` | `olares-cli osinfo <子命令> [选项]` | 显示当前设备的操作系统信息。 | +| `precheck`| `olares-cli precheck [选项]` | 检查系统环境是否满足 Olares 安装要求。| +| `prepare` | `olares-cli prepare [选项]` | 为安装过程准备环境,包括设置 Olares 的基础服务和配置。 | +| `release` | `olares-cli release [选项]` | 打包 Olares 安装资源以供分发或部署。| +| `start` | `olares-cli start [选项]` | 启动 Olares 服务和组件。 | +| `stop` | `olares-cli stop [选项]` | 停止 Olares 服务和组件。 | +| `uninstall` | `olares-cli uninstall [选项]` | 完全卸载 Olares,或将安装回滚到特定阶段。 | +| `upgrade` | `olares-cli upgrade <子命令> [选项]` | 升级 Olares,检查升级准备情况与兼容性。 | +| `user` | `olares-cli user <子命令> [选项]`| 管理 Olares 用户。 | \ No newline at end of file diff --git a/docs/zh/developer/install/cli/upgrade.md b/docs/zh/developer/install/cli/upgrade.md new file mode 100644 index 000000000..115e2f22f --- /dev/null +++ b/docs/zh/developer/install/cli/upgrade.md @@ -0,0 +1,53 @@ +# `upgrade` + +## 命令说明 + +`upgrade`命令提供一组用于升级 Olares,检查升级准备情况与兼容性的工具。 + +```bash +olares-cli upgrade <子命令> [选项] +``` + +## 子命令 + +| 子命令 | 描述 | +|--|--| +| `precheck` | 对 Olares 执行升级前检查。 | +| `spec` | 获取当前 CLI 版本对应的升级规格。 | +| `viable` | 判断是否可以基于指定基础版本直接执行升级。 | + +## 全局选项 + +以下选项适用于`upgrade`主命令,需要时可被子命令继承。 + +| 选项 | 简写 | 用途 | 是否必需 | 默认值 | +|--|--|--|--|--| +| `--base-dir` | `-b` | 设置 Olares 安装包的基本目录。 | 否 | `$HOME/.olares` | +| `--help` | `-h` | 显示帮助信息。 | 否 | 无 | +| `--version` | `-v` | 设置要升级到的目标 Olares 版本,例如`1.10.0`、`1.10.0-20241109`。 | 否 | 无 | + +## `viable` 专属选项 + +| 选项 | 简写 | 用途 | 是否必需 | 默认值 | +|--|--|--|--|--| +| `--base` | `-b` | 要检查的基础版本。 | 否 | 当前 Olares 系统版本 | + +:::warning 选项冲突 +主命令使用`-b`作为`--base-dir`的简写。但在执行`upgrade viable`时,`-b`指代的是`--base`。 +::: + +## 使用示例 + +```bash +# 检查当前系统是否可以直接升级 +sudo olares-cli upgrade viable + +# 检查从指定基础版本开始是否可直接升级 +sudo olares-cli upgrade viable --base 1.9.0 + +# 执行升级前检查 +sudo olares-cli upgrade precheck + +# 查看当前 CLI 对应的升级规格 +sudo olares-cli upgrade spec +``` \ No newline at end of file diff --git a/docs/zh/developer/install/cli/user-activate.md b/docs/zh/developer/install/cli/user-activate.md index c4d180b86..12d9666d8 100644 --- a/docs/zh/developer/install/cli/user-activate.md +++ b/docs/zh/developer/install/cli/user-activate.md @@ -1,8 +1,8 @@ -# `user activate` +# `activate` ## 命令说明 -`user activate`命令用于激活已有的 Olares 账户,你需要至少提供 Olares ID、登录密码和助记词短语才能完成激活。该命令通常需要使用管理员权限(`sudo`)执行。 +`activate`子命令用于激活已有的 Olares 账户,你需要至少提供 Olares ID、登录密码和助记词短语才能完成激活。 ```bash olares-cli user activate [选项] @@ -11,7 +11,7 @@ olares-cli user activate [选项] | 参数 | 描述 | 是否必需 | |--|--|--| -| `` | 指定待激活的 Olares 用户账户的唯一标识符。
格式类似电子邮件地址(例如:`alice123@olares.com`)| **是** | +| `` | 指定待激活的 Olares 用户账户的唯一标识符。
格式类似电子邮件地址。例如:`alice123@olares.com`| 是 | ## 选项 @@ -24,19 +24,20 @@ olares-cli user activate [选项] | `--jws` | | 指定指定 FRP 的 JWS(JSON Web Signature)令牌。
仅当`--enable-tunnel`设置为`true`时使用。| 否 | 无 | | `--language` | | 设置系统语言。| 否 | `en-US` | | `--location` | | 设置系统时区位置。 | 否 | `Asia/Shanghai` | -| `--mnemonic` | | 指定用于激活的 12 词助记词短语。 | **是** | 无 | -| `--password` | `-p` | 指定待激活 Olares 账户的登录密码。 | **是** | 无 | +| `--mnemonic` | | 指定用于激活的 12 词助记词短语。 | 是 | 无 | +| `--password` | `-p` | 指定待激活 Olares 账户的登录密码。 | 是 | 无 | +| `--reset-password` | | 指定用于密码重置的新密码。
仅在执行密码重置时需要。| 否 | 无 | | `--vault` | | 指定 Vault 服务的 URL。
例如:`https://example.com` | 否 | `http://127.0.0.1:30181` | ## 使用示例 ```bash # 激活 Olares 账户 -sudo olares-cli user activate alice@olares.cn -p "HerPassWord" --mnemonic "apple banana cherry door eagle forest grape house island jacket kite lemon" +olares-cli user activate alice123@olares.cn -p "HerPassWord" --mnemonic "apple banana cherry door eagle forest grape house island jacket kite lemon" # 启用隧道模式激活 Olares 账户 -sudo olares-cli user activate david@olares.cn -p "HisPassWord" --enable-tunnel --host "frp-gateway.olares.com" --jws "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.demo.signature" --bfl http://127.0.0.1:30180 --vault http://127.0.0.1:30180/server --mnemonic "apple banana cherry door eagle forest grape house island jacket kite lemon" +olares-cli user activate david456@olares.cn -p "HisPassWord" --enable-tunnel --host "frp-gateway.olares.com" --jws "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.demo.signature" --bfl http://127.0.0.1:30180 --vault http://127.0.0.1:30180/server --mnemonic "apple banana cherry door eagle forest grape house island jacket kite lemon" # 使用指定的语言和时区设置,激活 Olares 账户 -sudo olares-cli user activate carol@olares.cn -p "AnotherPassWord" --mnemonic "alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu" --language "cn-ZH" --location "Asia/Shanghai" +olares-cli user activate carol789@olares.cn -p "AnotherPassWord" --mnemonic "alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu" --language "cn-ZH" --location "Asia/Shanghai" ``` \ No newline at end of file diff --git a/docs/zh/developer/install/cli/user-create.md b/docs/zh/developer/install/cli/user-create.md new file mode 100644 index 000000000..3c7c6d8d6 --- /dev/null +++ b/docs/zh/developer/install/cli/user-create.md @@ -0,0 +1,46 @@ +# `create` + +## 命令说明 + +`create`子命令用于在 Olares 中创建一个新的用户。管理员可以在创建时设置用户名、初始密码、角色权限以及资源限制等初始配置。 + +**别名**:`create`、`add`、`new` + +```bash +olares-cli user create <用户名> [选项] +``` + +## 参数 + +| 参数 | 说明 | 是否必需| +|--|--|--| +| `<用户名>` | 指定新用户的用户名。通常为 Olares ID 中`@`符号之前的部分。
例如`alice123@olares.com`中的`alice123`。| 是 | + +## 选项 +| 选项 | 简写 | 用途 | 是否必需 | 默认值 | +|--|--|--|--|--| +| `--cpu-limit` | `-c` | 设置用户环境的 CPU 限制。 | 否 | `1` | +| `--description` | | 为用户账号添加描述信息。 | 否 | 无 | +| `--display-name` | | 设置用户的显示名称。 | 否 | 无 | +| `--domain` | | 指定 Olares ID 使用的域名。 | 否 | 系统默认域名 | +| `--help` | `-h` | 显示帮助信息。 | 否 | 无 | +| `--kubeconfig` | | 指定 kubeconfig 文件路径。 | 否 | 无 | +| `--memory-limit` | `-m` | 设置用户环境的内存限制。 | 否 | `3G` | +| `--password` | `-p` | 设置用户的初始登录密码。 | 否 | 无 | +| `--role` | `-r` | 设置用户角色。
可选值:`owner`、`admin`、`normal`。 | 否 | `normal` | + +## 使用示例 + +```bash +# 使用默认设置创建用户 +olares-cli user create alice123 + +# 创建用户并指定密码和角色 +olares-cli user create blake123 -p "StrongPassword123" -r admin + +# 创建用户并设置资源限制(2 个 CPU 核心,4 GB 内存) +olares-cli user create carol123 --cpu-limit 2 --memory-limit 4G + +# 创建用户并设置显示名称和描述 +olares-cli user create david123 --display-name "David Smith" --description "Data platform administrator" +``` \ No newline at end of file diff --git a/docs/zh/developer/install/cli/user-delete.md b/docs/zh/developer/install/cli/user-delete.md new file mode 100644 index 000000000..e965c76c6 --- /dev/null +++ b/docs/zh/developer/install/cli/user-delete.md @@ -0,0 +1,30 @@ +# `delete` + +## 命令说明 + +`delete`子命令用于从 Olares 系统中永久删除一个已有的用户账号。 + +**别名**:`delete`、`d`、`del`、`rm`、`remove` + +```bash +olares-cli user delete <用户名> [选项] +``` + +## 参数 + +| 参数 | 说明 | 是否必需| +|--|--|--| +| `<用户名>` | 指定要删除的用户名。通常为 Olares ID 中`@`符号之前的部分。
例如 `alice123@olares.com`中的`alice123`。| 是 | + +## 选项 +| 选项 | 简写 | 用途 | 是否必需 | 默认值 | +|--|--|--|--|--| +| `--help` | `-h` | 显示帮助信息。 | 否 | 无 | +| `--kubeconfig` | | 指定 kubeconfig 文件路径。 | 否 | 无 | + +## 使用示例 + +```bash +# 删除名为 alice123 的用户 +olares-cli user delete alice123 +``` \ No newline at end of file diff --git a/docs/zh/developer/install/cli/user-get.md b/docs/zh/developer/install/cli/user-get.md new file mode 100644 index 000000000..ee193d21e --- /dev/null +++ b/docs/zh/developer/install/cli/user-get.md @@ -0,0 +1,33 @@ +# `get` + +## 命令说明 + +`get`子命令用于获取 Olares 指定用户的详细信息。输出结果以表格或 JSON 格式显示。 + +```bash +olares-cli user get <用户名> [选项] +``` + +## 参数 + +| 参数 | 说明 | 是否必需| +|--|--|--| +| `<用户名>` | 指定要查询的用户名。通常为 Olares ID 中`@`符号之前的部分。
例如 `alice123@olares.com`中的`alice123`。| 是 | + +## 选项 +| 选项 | 简写 | 用途 | 是否必需 | 默认值 | +|--|--|--|--|--| +| `--help` | `-h` | 显示帮助信息。 | 否 | 无 | +| `--kubeconfig` | | 指定 kubeconfig 文件路径。 | 否 | 无 | +| `--no-headers` | | 输出结果不显示表头。 | 否 | 无 | +| `--output` | `-o` | 指定输出格式。
可选值:`table`、`json`。 | 否 | `table` | + +## 使用示例 + +```bash +# 以默认表格格式查看用户 alice123 的信息 +olares-cli user get alice123 + +# 以 JSON 格式查看用户 blake123 的信息 +olares-cli user get blake123 -o json +``` \ No newline at end of file diff --git a/docs/zh/developer/install/cli/user-list.md b/docs/zh/developer/install/cli/user-list.md new file mode 100644 index 000000000..a947e02f5 --- /dev/null +++ b/docs/zh/developer/install/cli/user-list.md @@ -0,0 +1,34 @@ +# `list` + +## 命令说明 + +`list`子命令用于显示 Olares 系统中所有注册用户列表。你可以根据需要筛选用户并排序,以表格或 JSON 格式显示结果。 + +**别名**:`list`、`ls`、`l` + +```bash +olares-cli user list [选项] +``` + +## 选项 +| 选项 | 简写 | 用途 | 是否必需 | 默认值 | +|--|--|--|--|--| +| `--help` | `-h` | 显示帮助信息。 | 否 | 无 | +| `--kubeconfig` | | 指定 kubeconfig 文件路径。 | 否 | 无 | +| `--no-headers` | | 输出结果不显示表头。 | 否 | 无 | +| `--output` | `-o`| 指定输出格式。
可选值:`table`、`json`。| 否 | `table` | +| `--reverse` | `-r` | 倒序排列输出结果。 | 否 | 无 | +| `--sort` | | 按指定字段对结果进行排序。
可选值:`name`、`role`、`create-time`、`memory`、`cpu`。 | 否 | 无 | + +## 使用示例 + +```bash +# 以表格格式列出所有用户 +olares-cli user list + +# 以 JSON 格式列出所有用户 +olares-cli user list -o json + +# 按角色排序列出用户 +olares-cli user list --sort role +``` \ No newline at end of file diff --git a/docs/zh/developer/install/cli/user-reset-password.md b/docs/zh/developer/install/cli/user-reset-password.md new file mode 100644 index 000000000..f729e1e5f --- /dev/null +++ b/docs/zh/developer/install/cli/user-reset-password.md @@ -0,0 +1,29 @@ +# `reset-password` + +## 命令说明 + +`reset-password`子命令用于通过认证服务强制重置指定用户的登录密码。 + +```bash +olares-cli user reset-password <用户名> [选项] +``` + +## 参数 + +| 参数 | 说明 | 是否必需 | +|--|--|--| +| `<用户名>` | 指定要重置密码的用户名。通常为 Olares ID 中`@`符号之前的
部分。例如`alice123@olares.com`中的`alice123`。| 是 | + +## 选项 +| 选项 | 简写 | 用途 | 是否必需 | 默认值 | +|--|--|--|--|--| + `--help` | `-h` | 显示帮助信息。 | 否 | 无 | +| `--kubeconfig` | | 指定 kubeconfig 文件路径。 | 否 | 无 | +| `--password` | `-p` | 指定为该用户设置的新密码。 | 是 | 无 | + +## 使用示例 + +```bash +# 重置用户 alice123 的密码 +olares-cli user reset-password alice123 -p "NewSecurePassword456!" +``` \ No newline at end of file diff --git a/docs/zh/developer/install/cli/user.md b/docs/zh/developer/install/cli/user.md new file mode 100644 index 000000000..0d2f4bf48 --- /dev/null +++ b/docs/zh/developer/install/cli/user.md @@ -0,0 +1,13 @@ +# `user` +`user`命令提供了一组用户管理工具,可用于创建、激活、查询和删除 Olares 用户,并支持通过已配置的认证提供方重置用户密码。 + +## 子命令 + +| 子命令 | 描述 | +|--|--| +| `activate` | 激活已有的 Olares 账户。 | +| `create` | 创建新用户。 | +| `delete` | 删除已有用户。 | +| `get` | 获取指定用户的详细信息。 | +| `list` | 列出 Olares 中的所有用户。 | +| `reset-password` | 通过认证提供方强制重置指定用户的密码。| \ No newline at end of file diff --git a/framework/authelia/.olares/config/user/helm-charts/auth/templates/auth_deploy.yaml b/framework/authelia/.olares/config/user/helm-charts/auth/templates/auth_deploy.yaml index c48b423a9..383829134 100644 --- a/framework/authelia/.olares/config/user/helm-charts/auth/templates/auth_deploy.yaml +++ b/framework/authelia/.olares/config/user/helm-charts/auth/templates/auth_deploy.yaml @@ -29,7 +29,7 @@ spec: name: check-auth containers: - name: auth-front - image: beclab/login:v1.6.38 + image: beclab/login:v1.7.4 imagePullPolicy: IfNotPresent ports: - containerPort: 80 diff --git a/framework/files/.olares/config/cluster/deploy/files_deploy.yaml b/framework/files/.olares/config/cluster/deploy/files_deploy.yaml index 037512947..5e2d4f28c 100644 --- a/framework/files/.olares/config/cluster/deploy/files_deploy.yaml +++ b/framework/files/.olares/config/cluster/deploy/files_deploy.yaml @@ -210,7 +210,7 @@ spec: command: - /samba_share - name: files - image: beclab/files-server:v0.2.146 + image: beclab/files-server:v0.2.148 imagePullPolicy: IfNotPresent securityContext: allowPrivilegeEscalation: true @@ -314,8 +314,8 @@ spec: value: os.users - name: NATS_SUBJECT_SYSTEM_GROUPS value: os.groups - - name: RESERVED_SPACE - value: '1000' + - name: RESERVED_SPACE_PERCENT + value: '1.00' - name: OLARES_VERSION value: '1.12' - name: FILE_CACHE_DIR diff --git a/framework/search3/.olares/config/cluster/deploy/search3_server_deploy.yaml b/framework/search3/.olares/config/cluster/deploy/search3_server_deploy.yaml index 221c9eaed..543682a2b 100644 --- a/framework/search3/.olares/config/cluster/deploy/search3_server_deploy.yaml +++ b/framework/search3/.olares/config/cluster/deploy/search3_server_deploy.yaml @@ -240,7 +240,7 @@ spec: value: os_framework_search3 containers: - name: search3 - image: beclab/search3:v0.1.2 + image: beclab/search3:v0.1.3 imagePullPolicy: IfNotPresent ports: - containerPort: 8080 @@ -301,7 +301,7 @@ spec: priorityClassName: "system-cluster-critical" containers: - name: search3monitor - image: beclab/search3monitor:v0.1.2 + image: beclab/search3monitor:v0.1.3 imagePullPolicy: IfNotPresent ports: - containerPort: 8081 diff --git a/framework/search3/.olares/config/cluster/deploy/search3_validation.yaml b/framework/search3/.olares/config/cluster/deploy/search3_validation.yaml index 405f1bacf..0e4f4daf4 100644 --- a/framework/search3/.olares/config/cluster/deploy/search3_validation.yaml +++ b/framework/search3/.olares/config/cluster/deploy/search3_validation.yaml @@ -64,7 +64,7 @@ spec: operator: Exists containers: - name: search3-validation - image: beclab/search3validation:v0.1.2 + image: beclab/search3validation:v0.1.3 imagePullPolicy: IfNotPresent ports: - containerPort: 8443 diff --git a/infrastructure/gpu/.olares/config/gpu/hami/values.yaml b/infrastructure/gpu/.olares/config/gpu/hami/values.yaml index 184695959..937060603 100644 --- a/infrastructure/gpu/.olares/config/gpu/hami/values.yaml +++ b/infrastructure/gpu/.olares/config/gpu/hami/values.yaml @@ -4,7 +4,7 @@ nameOverride: "" fullnameOverride: "" namespaceOverride: "" imagePullSecrets: [] -version: "v2.6.7" +version: "v2.6.8" # Nvidia GPU Parameters resourceName: "nvidia.com/gpu" diff --git a/platform/hami/.olares/Olares.yaml b/platform/hami/.olares/Olares.yaml index e6c1cab67..54434970e 100644 --- a/platform/hami/.olares/Olares.yaml +++ b/platform/hami/.olares/Olares.yaml @@ -3,7 +3,7 @@ target: prebuilt output: containers: - - name: beclab/hami:v2.6.7 + name: beclab/hami:v2.6.8 - name: beclab/hami-webui-fe-oss:v1.0.8 - diff --git a/platform/kubeblocks/.olares/Olares.yaml b/platform/kubeblocks/.olares/Olares.yaml index 3554ad90b..1f22c5cea 100644 --- a/platform/kubeblocks/.olares/Olares.yaml +++ b/platform/kubeblocks/.olares/Olares.yaml @@ -5,6 +5,6 @@ output: - name: beclab/apecloud-kubeblocks-tools:1.0.1 - - name: beclab/apecloud-kubeblocks:1.0.1 + name: beclab/kubeblocks:1.0.1-ext1 - name: beclab/kubeblock-addon-charts:v1.0.1-ext2 diff --git a/platform/kubeblocks/.olares/config/cluster/deploy/kubeblocks.yaml b/platform/kubeblocks/.olares/config/cluster/deploy/kubeblocks.yaml index acb6fb80b..e8ca7ea74 100644 --- a/platform/kubeblocks/.olares/config/cluster/deploy/kubeblocks.yaml +++ b/platform/kubeblocks/.olares/config/cluster/deploy/kubeblocks.yaml @@ -98,7 +98,7 @@ spec: capabilities: drop: - ALL - image: beclab/apecloud-kubeblocks:1.0.1 + image: beclab/kubeblocks:1.0.1-ext1 imagePullPolicy: IfNotPresent ports: - name: webhook-server