Documentation ¶
Index ¶
- Variables
- func CreateDeploy(uid int, param *req.DeploySetParam) (err error)
- func DelDeploy(uid, DeployID int) error
- func DeployRelationServerIds(deployId int) []int
- func GetSysConfig(key string) string
- func Start()
- func UpdateDeploy(uid int, param *req.DeploySetParam) (err error)
- type CommonMap
- type Deploy
- type DeployDetailInfo
- type DeployDocker
- type DeployGit
- type DeployRelationServer
- type DeployServerRelation
- type DeployTaskInfo
- type DeployZip
- type Member
- type ModelBase
- type ModelBase1
- type Schedule
- func (m *Schedule) Count() (num int, err error)
- func (m *Schedule) Create() bool
- func (m *Schedule) Del() bool
- func (m *Schedule) ExportList(lastId int, scheduleType int) ([]Schedule, int)
- func (m *Schedule) Get() bool
- func (m *Schedule) List(offset int, limit int) ([]Schedule, int)
- func (m *Schedule) RunCallBack() bool
- func (m *Schedule) Save() bool
- type Server
- func (m *Server) BatchCheck(ids []int) bool
- func (m *Server) Count() (num int, err error)
- func (m *Server) Get() bool
- func (m *Server) GetApiSecret(id int) (secret string)
- func (m *Server) List(offset int, limit int) ([]Server, int)
- func (m *Server) ListByUser() []Server
- func (m *Server) UserServerIds() (ids []int)
- type SysConfig
- type Telegraf
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Redis *zmRedis Mysql *gorm.DB InfluxDB *zmInflux )
Functions ¶
func CreateDeploy ¶
func CreateDeploy(uid int, param *req.DeploySetParam) (err error)
CreateDeploy 创建部署应用
func DeployRelationServerIds ¶
DeployRelationServerIds 根据应用ID
func UpdateDeploy ¶
func UpdateDeploy(uid int, param *req.DeploySetParam) (err error)
UpdateDeploy 更新部署应用
Types ¶
type Deploy ¶
type Deploy struct { ID int `gorm:"primary_key;column:id;type:int(10) unsigned;not null" json:"id"` // 应用唯一编号 UId int `gorm:"index:IX_UID;column:uid;type:int(11);not null" json:"uid"` // 创建用户UID Title string `gorm:"column:title;type:varchar(120);not null" json:"title"` // 应用名称 DeployType int8 `gorm:"column:deploy_type;type:tinyint(1);not null" json:"deploy_type"` // 部署类型 0-本地 1-git 2-zip 3-docker WorkDir string `gorm:"column:work_dir;type:varchar(255);not null" json:"work_dir"` // 工作目录 BeforeCommand string `gorm:"column:before_command;type:varchar(2000);not null" json:"before_command"` // 前置命令 AfterCommand string `gorm:"column:after_command;type:varchar(2000);not null" json:"after_command"` // 后置命令 NowVersion int `gorm:"column:now_version;type:int(10) unsigned;not null" json:"now_version"` // 当前版本 OpenID string `gorm:"unique;column:open_id;type:char(32);not null" json:"open_id"` // 应用开放编码(用于hook部署) CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time;type:datetime" json:"update_time"` }
Deploy 纸喵部署应用表
func DeployList ¶
func DeployList(uid int, param *req.DeployListParam) (result []Deploy, totalRows int)
DeployList 部署应用列表
func (*Deploy) GetIdByOpenId ¶
type DeployDetailInfo ¶
type DeployDetailInfo struct { Deploy DeployGit DeployGit `json:"deploy_git"` DeployZip DeployZip `json:"deploy_zip"` DeployDocker DeployDocker `json:"deploy_docker"` }
DeployDetailInfo 部署应用信息结构
func GetDeployDetailInfo ¶
func GetDeployDetailInfo(uid, deployId int) (result DeployDetailInfo)
GetDeployDetailInfo 根据服应用ID获取部署应用任务信息
type DeployDocker ¶
type DeployDocker struct { DeployID int `gorm:"primary_key;column:deploy_id;type:int(10) unsigned;not null" json:"deploy_id"` // 部署应用编号 DockerImage string `gorm:"column:docker_image;type:varchar(500);not null" json:"docker_image"` // 资源地址(完整路径) UserName string `gorm:"column:user_name;type:varchar(255);not null" json:"user_name"` // 账号 Password string `gorm:"column:password;type:varchar(255);not null" json:"password"` // 密码 IsRuning int8 `gorm:"column:is_runing;type:tinyint(1);not null" json:"is_runing"` // 是否启动 -1-不启动 1-启动 ContainerName string `gorm:"column:container_name;type:varchar(255);not null" json:"container_name"` // 容器名称 ContainerVolumes string `gorm:"column:container_volumes;type:varchar(1000);not null" json:"container_volumes"` // 地址映射 a:b a宿主机 b容器内 ContainerPorts string `gorm:"column:container_ports;type:varchar(1000);not null" json:"container_ports"` // 端口暴露 a:b a内部 b外部 ContainerEnv string `gorm:"column:container_env;type:varchar(2000);not null" json:"container_env"` // 环境变量注入 CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time;type:datetime" json:"update_time"` }
DeployDocker 纸喵部署-docker
type DeployGit ¶
type DeployGit struct { DeployID int `gorm:"primary_key;column:deploy_id;type:int(10) unsigned;not null" json:"deploy_id"` // 部署应用编号 RemoteURL string `gorm:"column:remote_url;type:varchar(500);not null" json:"remote_url"` // 资源地址 DeployPath string `gorm:"column:deploy_path;type:varchar(500);not null" json:"deploy_path"` // 本地部署地址 Branch string `gorm:"column:branch;type:varchar(100);not null" json:"branch"` // git分支 DeployKeys string `gorm:"column:deploy_keys;type:varchar(3000);not null" json:"deploy_keys"` // 部署私钥 UserName string `gorm:"column:user_name;type:varchar(255);not null" json:"user_name"` // 账号 Password string `gorm:"column:password;type:varchar(255);not null" json:"password"` // 密码 CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time;type:datetime" json:"update_time"` }
DeployGit 纸喵部署-git
type DeployRelationServer ¶
type DeployRelationServer struct { Server DeployServerRelation }
DeployRelationServer 部署服务器信息
func DeployServerList ¶
func DeployServerList(uid, deployId int) (result []DeployRelationServer, err error)
DeployServerList 可部署服务器列表
type DeployServerRelation ¶
type DeployServerRelation struct { DeployID int `gorm:"primary_key;column:deploy_id;type:int(11);not null" json:"deploy_id"` // 部署服务id ServerID int `gorm:"primary_key;column:server_id;type:int(11);not null" json:"server_id"` // 服务器ID DeployVersion int `gorm:"column:deploy_version;type:int(10) unsigned" json:"deploy_version"` // 已部署版本 CreateTime time.Time `gorm:"column:create_time;type:datetime" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time;type:datetime" json:"update_time"` }
DeployServerRelation 部署服务-server关联表
type DeployTaskInfo ¶
type DeployTaskInfo struct { Deploy DeployGit DeployGit `json:"deploy_git"` DeployZip DeployZip `json:"deploy_zip"` DeployDocker DeployDocker `json:"deploy_docker"` }
DeployTaskInfo 部署应用信息结构
func GetDeployTaskInfo ¶
func GetDeployTaskInfo(serverId int) (result []DeployTaskInfo)
GetDeployTaskInfo 根据服务器ID获取部署应用任务信息
type DeployZip ¶
type DeployZip struct { DeployID int `gorm:"primary_key;column:deploy_id;type:int(10) unsigned;not null" json:"deploy_id"` // 部署应用编号 RemoteURL string `gorm:"column:remote_url;type:varchar(500);not null" json:"remote_url"` // 资源地址 DeployPath string `gorm:"column:deploy_path;type:varchar(500);not null" json:"deploy_path"` // 本地部署地址 Password string `gorm:"column:password;type:varchar(255);not null" json:"password"` // 密码 CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time;type:datetime" json:"update_time"` }
DeployZip 纸喵部署-zip
type Member ¶
type Member struct { Id int `gorm:"primary_key;column:id;type:int(10) unsigned;not null"` Phone string `gorm:"unique;column:phone;type:char(11);not null"` // 手机号 Password string `gorm:"column:password;type:varchar(255);not null"` // 密码 InviterUid int `gorm:"column:inviter_uid;type:int(10) unsigned;not null"` // 邀请人UID MaxDeploy int `gorm:"column:max_deploy;type:int(10) unsigned;not null"` // 最大部署应用数量 MaxSchedule int `gorm:"column:max_schedule;type:int(10) unsigned;not null"` // 最大调度任务数量 Status int8 `gorm:"column:status;type:tinyint(1);not null"` // 0-锁定 1-正常 CreateTime time.Time `gorm:"column:create_time;type:datetime;not null"` UpdateTime time.Time `gorm:"column:update_time;type:datetime;not null"` }
Member 用户表
func (*Member) AddDeployNum ¶
AddDeployNum 添加部署任务数量
func (*Member) AddScheduleNum ¶
AddScheduleNum 添加调度任务数量
type ModelBase1 ¶
type Schedule ¶
type Schedule struct { Command string `xorm:"not null comment('命令') TEXT"` CreateTime time.Time `xorm:"default 'CURRENT_TIMESTAMP' DATETIME"` Crontab string `xorm:"not null comment('规则') VARCHAR(50)"` Id int `xorm:"not null pk autoincr INT(10)"` PrevTime time.Time `gorm:"column:prev_time;type:datetime;default:null"` // 上次执行时间 NextTime time.Time `gorm:"column:next_time;type:datetime"` // 下次执行时间 Remain int `xorm:"not null default -1 comment('剩余执行次数 -1无限 0-停止') INT(11)"` ScheduleType int `xorm:"not null default 1 comment('调度类型 1-serverhttp 2-clientShell') TINYINT(1)"` ServerId int `xorm:"not null default 0 comment('服务器ID') INT(10)"` Timeout int `xorm:"not null default 30 comment('超时时间s') INT(10)"` Title string `xorm:"not null comment('标题') VARCHAR(60)"` Uid int `xorm:"not null default 0 comment('用户ID') INT(10)"` UpdateTime time.Time `xorm:"default 'CURRENT_TIMESTAMP' DATETIME"` }
func (*Schedule) ExportList ¶
ExportList 数据输出
func (*Schedule) RunCallBack ¶
type Server ¶
type Server struct { ApiSecret string `xorm:"not null default '' comment('API密钥') VARCHAR(32)"` CreateTime time.Time `xorm:"default 'CURRENT_TIMESTAMP' DATETIME"` DeviceId string `xorm:"not null comment('服务器唯一设备号') CHAR(36)"` Domain string `xorm:"not null comment('服务器地址(域名/ip)') VARCHAR(255)"` Id int `xorm:"not null pk autoincr INT(11)"` ServerName string `xorm:"not null default '' comment('服务器备注名') VARCHAR(64)"` ServerRuleId int `xorm:"not null default 0 comment('服务器规则id') INT(11)"` ServerStatus int `xorm:"not null default 0 comment('服务器状态 -1-失效 0-待认领 1-已分配通信密钥 2-已绑定') TINYINT(1)"` Uid int `xorm:"not null comment('用户ID') index INT(10)"` UpdateTime time.Time `xorm:"default 'CURRENT_TIMESTAMP' DATETIME"` }
func (*Server) GetApiSecret ¶
GetApiSecret 获取服务器ApiSecret信息
func (*Server) ListByUser ¶
func (*Server) UserServerIds ¶
UserServerIds 获取用户的服务器编号
type SysConfig ¶
type SysConfig struct { Key string `gorm:"primary_key;column:key;type:varchar(50);not null"` Data string `gorm:"column:data;type:longtext"` // 数据 Readme string `gorm:"column:readme;type:varchar(255)"` // 字段说明 CreateTime time.Time `gorm:"column:create_time;type:datetime"` UpdateTime time.Time `gorm:"column:update_time;type:timestamp"` }
SysConfig 内部回转配置
type Telegraf ¶
type Telegraf struct { ServerID int `gorm:"primary_key;column:server_id;type:int(11);not null"` // 服务器ID UId int `gorm:"column:uid;type:int(11)"` // 用户ID TomlConfig string `gorm:"column:toml_config;type:longtext"` // 私有配置 IsOpen int8 `gorm:"column:is_open;type:tinyint(1)"` // 是否开启监控功能 1-开启 2-关闭 CreateTime time.Time `gorm:"column:create_time;type:datetime"` UpdateTime time.Time `gorm:"column:update_time;type:datetime"` }
Telegraf 监控配置表
Click to show internal directories.
Click to hide internal directories.