MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / DownAndUp

Function DownAndUp

agent/utils/compose/compose.go:218–234  ·  view source on GitHub ↗
(filePath string)

Source from the content-addressed store, hash-verified

216}
217
218func DownAndUp(filePath string) (string, error) {
219 if err := checkCmd(); err != nil {
220 return "", err
221 }
222 cmdMgr := cmd.NewCommandMgr(cmd.WithTimeout(20 * time.Minute))
223 base, extra := getComposeBaseCmd()
224 argsDown := append(extra, loadFiles(filePath)...)
225 argsDown = append(argsDown, "down")
226 stdout, err := cmdMgr.RunWithStdout(base, argsDown...)
227 if err != nil {
228 return stdout, err
229 }
230 argsUp := append(extra, loadFiles(filePath)...)
231 argsUp = append(argsUp, "up", "-d")
232 stdout, err = cmdMgr.RunWithStdout(base, argsUp...)
233 return stdout, err
234}
235
236func loadFiles(filePath string) []string {
237 var fileItem []string

Callers

nothing calls this directly

Calls 4

checkCmdFunction · 0.85
getComposeBaseCmdFunction · 0.85
loadFilesFunction · 0.85
RunWithStdoutMethod · 0.45

Tested by

no test coverage detected