2023-03-29 14:58:28 +08:00
|
|
|
package model
|
|
|
|
|
2023-09-25 17:50:14 +08:00
|
|
|
import (
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/constant"
|
|
|
|
"path"
|
|
|
|
)
|
|
|
|
|
2023-03-29 14:58:28 +08:00
|
|
|
type Runtime struct {
|
|
|
|
BaseModel
|
|
|
|
Name string `gorm:"type:varchar;not null" json:"name"`
|
|
|
|
AppDetailID uint `gorm:"type:integer" json:"appDetailId"`
|
2023-03-30 16:47:47 +08:00
|
|
|
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"`
|
2023-03-29 14:58:28 +08:00
|
|
|
Type string `gorm:"type:varchar;not null" json:"type"`
|
2023-03-30 16:47:47 +08:00
|
|
|
Status string `gorm:"type:varchar;not null" json:"status"`
|
|
|
|
Resource string `gorm:"type:varchar;not null" json:"resource"`
|
2023-09-28 15:28:21 +08:00
|
|
|
Port int `gorm:"type:integer;" json:"port"`
|
2023-03-30 16:47:47 +08:00
|
|
|
Message string `gorm:"type:longtext;" json:"message"`
|
2023-09-25 17:50:14 +08:00
|
|
|
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")
|
2023-03-29 14:58:28 +08:00
|
|
|
}
|