mirror of
https://2025-dev.shylinux.com/x/20250215-cluster
synced 2025-04-25 21:24:04 +08:00
add some
This commit is contained in:
parent
61136b7f0c
commit
9f64055191
@ -1,4 +1,4 @@
|
|||||||
title "ContextOS 研发平台"
|
title "ContextOS-Cluster"
|
||||||
refer `
|
refer `
|
||||||
网址 https://dev.shylinux.com
|
网址 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
|
package travel
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"path"
|
||||||
|
|
||||||
"shylinux.com/x/ice"
|
"shylinux.com/x/ice"
|
||||||
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
|
"shylinux.com/x/icebergs/base/tcp"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
"shylinux.com/x/icebergs/core/code"
|
"shylinux.com/x/icebergs/core/code"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
@ -12,16 +16,32 @@ import (
|
|||||||
|
|
||||||
type travel struct {
|
type travel struct {
|
||||||
ice.Space
|
ice.Space
|
||||||
|
script string `name:"create name*=2025-cluster port*=40000 count*=3" icon:"bi bi-terminal"`
|
||||||
list string `name:"list space auto" help:"集群管理"`
|
list string `name:"list space auto" help:"集群管理"`
|
||||||
foreach string `name:"foreach" help:"遍历" icon:"bi bi-card-list"`
|
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) {
|
func (s travel) List(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
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(nfs.VERSION, ice.Info.Make.Version)
|
||||||
m.Push(mdb.TIME, ice.Info.Make.Time)
|
m.Push(mdb.TIME, ice.Info.Make.Time)
|
||||||
m.Cmdy(code.PUBLISH, nfs.BINARY)
|
m.Cmdy("", s.Script)
|
||||||
m.Action(s.Foreach)
|
|
||||||
} else {
|
} else {
|
||||||
m.Cmdy(web.SPACE, arg[0], m.PrefixKey())
|
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) {
|
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.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) {
|
func (s travel) Sequential(m *ice.Message, arg ...string) {
|
||||||
m.SpaceListServer().Table(func(value ice.Maps) { s.pushRecord(m, value, arg...) })
|
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) {
|
func (s travel) pushRecord(m *ice.Message, value ice.Maps, arg ...string) {
|
||||||
if value[nfs.MODULE] == arg[0] {
|
if value[nfs.MODULE] == arg[0] {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user