funcs

package
v0.0.0-...-baaa91a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProcessMapLock   = new(sync.RWMutex)
	GlobalProcessMap = make(map[string]*ProcessObj)

	RemoteMode = false
)
View Source
var LocalIp string

Functions

func AddDeploy

func AddDeploy(name, configFile, guid string, param map[string]string, configHash string) (port int, err error)

func CleanDeployDir

func CleanDeployDir()

func DeleteDeploy

func DeleteDeploy(guid string) error

func GetPort

func GetPort() int

func InitConfig

func InitConfig(cfg string) error

func InitDeploy

func InitDeploy()

func InitDeployDir

func InitDeployDir(param []*AgentManagerTable) error

func InitLocalIp

func InitLocalIp() bool

func LoadDeployProcess

func LoadDeployProcess()

func PrintProcessList

func PrintProcessList() []byte

func SaveDeployProcess

func SaveDeployProcess()

func StartManager

func StartManager()

func StopDeployProcess

func StopDeployProcess()

Types

type AgentManagerTable

type AgentManagerTable struct {
	EndpointGuid    string `json:"endpoint_guid"`
	Name            string `json:"name"`
	User            string `json:"user"`
	Password        string `json:"password"`
	InstanceAddress string `json:"instance_address"`
	AgentAddress    string `json:"agent_address"`
	ConfigFile      string `json:"config_file"`
	BinPath         string `json:"bin_path"`
	AgentRemotePort string `json:"agent_remote_port"`
}

type AgentsConfig

type AgentsConfig struct {
	Process            []*ProcessConfig `json:"process"`
	HttpRegisterEnable bool             `json:"http_register_enable"`
}

type DeployConfig

type DeployConfig struct {
	Enable         bool     `json:"enable"`
	StartPort      int      `json:"start_port"`
	PackagePath    []string `json:"package_path"`
	DeployDir      string   `json:"deploy_dir"`
	EachMaxProcess int      `json:"each_max_process"`
}

type GlobalConfig

type GlobalConfig struct {
	Http       *HttpConfig    `json:"http"`
	Deploy     *DeployConfig  `json:"deploy"`
	Manager    *ManagerConfig `json:"manager"`
	Agents     *AgentsConfig  `json:"agents"`
	OsBash     []string       `json:"os_bash"`
	RemoteMode string         `json:"remote_mode"`
}

func Config

func Config() *GlobalConfig

type HttpConfig

type HttpConfig struct {
	Port int `json:"port"`
}

type HttpResponse

type HttpResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func (*HttpResponse) Byte

func (h *HttpResponse) Byte() []byte

type InitDeployParam

type InitDeployParam struct {
	AgentManagerRemoteIp string               `json:"agentManagerRemoteIp"`
	Config               []*AgentManagerTable `json:"config"`
}

type ManagerConfig

type ManagerConfig struct {
	AliveCheck  int    `json:"alive_check"`
	AutoRestart bool   `json:"auto_restart"`
	Retry       int    `json:"retry"`
	SaveFile    string `json:"save_file"`
}

type ProcessConfig

type ProcessConfig struct {
	Name string `json:"name"`
	Cmd  string `json:"cmd"`
}

type ProcessObj

type ProcessObj struct {
	Pid        int       `json:"pid"`
	Guid       string    `json:"guid"`
	Name       string    `json:"name"`
	Port       int       `json:"port"`
	Cmd        string    `json:"cmd"`
	RunCmd     string    `json:"run_cmd"`
	StartTime  time.Time `json:"start_time"`
	StopTime   time.Time `json:"stop_time"`
	Retry      int       `json:"retry"`
	Path       string    `json:"path"`
	Status     string    `json:"status"`
	Deploy     bool      `json:"deploy"`
	ConfigHash string    `json:"config_hash"`
	Lock       *sync.RWMutex
	Process    *os.Process
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL