You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1Panel/agent/app/model/runtime.go

42 lines
1.3 KiB

package model
import (
"path"
"github.com/1Panel-dev/1Panel/agent/constant"
)
type Runtime struct {
BaseModel
Name string `gorm:"type:varchar;not null" json:"name"`
AppDetailID uint `gorm:"type:integer" json:"appDetailId"`
Image string `gorm:"type:varchar" json:"image"`
WorkDir string `gorm:"type:varchar" json:"workDir"`
DockerCompose string `gorm:"type:varchar" json:"dockerCompose"`
Env string `gorm:"type:varchar" json:"env"`
Params string `gorm:"type:varchar" json:"params"`
Version string `gorm:"type:varchar;not null" json:"version"`
Type string `gorm:"type:varchar;not null" json:"type"`
Status string `gorm:"type:varchar;not null" json:"status"`
Resource string `gorm:"type:varchar;not null" json:"resource"`
Port int `gorm:"type:integer;" json:"port"`
Message string `gorm:"type:longtext;" json:"message"`
CodeDir string `gorm:"type:varchar;" json:"codeDir"`
}
func (r *Runtime) GetComposePath() string {
return path.Join(r.GetPath(), "docker-compose.yml")
}
func (r *Runtime) GetEnvPath() string {
return path.Join(r.GetPath(), ".env")
}
func (r *Runtime) GetPath() string {
return path.Join(constant.RuntimeDir, r.Type, r.Name)
}
func (r *Runtime) GetLogPath() string {
return path.Join(r.GetPath(), "build.log")
}