mirror of
https://2025-dev.shylinux.com/x/20250215-cluster
synced 2025-04-25 05:08:06 +08:00
add some
This commit is contained in:
parent
61136b7f0c
commit
9f64055191
@ -1,4 +1,4 @@
|
||||
title "ContextOS 研发平台"
|
||||
title "ContextOS-Cluster"
|
||||
refer `
|
||||
网址 https://dev.shylinux.com
|
||||
`
|
||||
|
1
src/template/web.code.publish/binary.sh
Normal file
1
src/template/web.code.publish/binary.sh
Normal file
@ -0,0 +1 @@
|
||||
export ctx_dev={{.Option "domain"}}{{.Option "ctx_env"}}; {{.Option "ctx_cli"}} binary {{.Option "ctx_arg"}}
|
@ -1,9 +1,13 @@
|
||||
package travel
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/tcp"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/icebergs/core/code"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
@ -12,16 +16,32 @@ import (
|
||||
|
||||
type travel struct {
|
||||
ice.Space
|
||||
script string `name:"create name*=2025-cluster port*=40000 count*=3" icon:"bi bi-terminal"`
|
||||
list string `name:"list space auto" help:"集群管理"`
|
||||
foreach string `name:"foreach" help:"遍历" icon:"bi bi-card-list"`
|
||||
}
|
||||
|
||||
func (s travel) Script(m *ice.Message, arg ...string) {
|
||||
for i := 0; i < kit.Int(m.Option(mdb.COUNT)); i++ {
|
||||
m.Option(cli.CTX_ENV, cli.CTX_NAME, m.Option(mdb.NAME)+kit.Format(i))
|
||||
m.Option(cli.CTX_ARG, kit.JoinCmdArgs(ice.DEV, m.Option(ice.MSG_USERHOST), tcp.NODENAME, m.Option(mdb.NAME)+kit.Format(i), tcp.PORT, kit.Format(kit.Int(m.Option(tcp.PORT))+i)))
|
||||
m.Cmdy(code.PUBLISH, nfs.BINARY)
|
||||
}
|
||||
m.Action(s.Foreach, s.Script)
|
||||
}
|
||||
func (s travel) List(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
stat := map[string]int{}
|
||||
m.SpaceListServer().Table(func(value ice.Maps) { stat[value[nfs.MODULE]]++ })
|
||||
kit.For([]string{
|
||||
"2025-dev.shylinux.com/x/20250213-machine",
|
||||
"2025-dev.shylinux.com/x/20250211-service",
|
||||
}, func(key string) {
|
||||
m.Push(path.Base(key), stat[key])
|
||||
})
|
||||
m.Push(nfs.VERSION, ice.Info.Make.Version)
|
||||
m.Push(mdb.TIME, ice.Info.Make.Time)
|
||||
m.Cmdy(code.PUBLISH, nfs.BINARY)
|
||||
m.Action(s.Foreach)
|
||||
m.Cmdy("", s.Script)
|
||||
} else {
|
||||
m.Cmdy(web.SPACE, arg[0], m.PrefixKey())
|
||||
}
|
||||
@ -34,9 +54,11 @@ func (s travel) Upgrade(m *ice.Message, arg ...string) {
|
||||
}
|
||||
func (s travel) Concurrent(m *ice.Message, arg ...string) {
|
||||
m.SpaceListServer().TableGo(func(value ice.Maps, lock *task.Lock) { s.pushRecord(m, value, arg...) })
|
||||
m.SortStrR(web.SPACE)
|
||||
}
|
||||
func (s travel) Sequential(m *ice.Message, arg ...string) {
|
||||
m.SpaceListServer().Table(func(value ice.Maps) { s.pushRecord(m, value, arg...) })
|
||||
m.SortStrR(web.SPACE)
|
||||
}
|
||||
func (s travel) pushRecord(m *ice.Message, value ice.Maps, arg ...string) {
|
||||
if value[nfs.MODULE] == arg[0] {
|
||||
|
Loading…
x
Reference in New Issue
Block a user