houston 업데이트를 스크립트로 하자
This commit is contained in:
@ -323,18 +323,33 @@ func (hc *houstonClient) prepareUpdateSelf(req *shared.DeployRequest) (srcdir st
|
||||
return filepath.ToSlash(tempdir), replacer, err
|
||||
}
|
||||
|
||||
func (hc *houstonClient) deploy(req *shared.DeployRequest, cb func(*protos.DeployingProgress)) error {
|
||||
func (hc *houstonClient) deploy(req *shared.DeployRequest, cb func(*protos.DeployingProgress)) (err error) {
|
||||
logger.Println("start deploying")
|
||||
root, err := hc.prepareDeploy(req.Name, req.Version)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
defer func() {
|
||||
if req.Name == "houston" && err == nil {
|
||||
// houston.update 다운로드가 완료되었으므로 종료
|
||||
// 종료되고나면 스크립트가 알아서 재 실행
|
||||
hc.Shutdown()
|
||||
}
|
||||
}()
|
||||
var root string
|
||||
if req.Name == "houston" {
|
||||
// houston은 버전없이 houston.update폴더로 다운로드
|
||||
root = "./houston.update"
|
||||
} else {
|
||||
root, err = hc.prepareDeploy(req.Name, req.Version)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// verpath에 배포 시작
|
||||
h := md5.New()
|
||||
h.Write([]byte(strings.Trim(req.Url, "/")))
|
||||
at := hex.EncodeToString(h.Sum(nil))
|
||||
fname, err := download(root, hc.makeDownloadUrl(req.Url), at, func(written int64, total int64) {
|
||||
var fname string
|
||||
fname, err = download(root, hc.makeDownloadUrl(req.Url), at, func(written int64, total int64) {
|
||||
prog := protos.DeployingProgress{
|
||||
State: "download",
|
||||
Progress: written,
|
||||
@ -360,7 +375,7 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest, cb func(*protos.Deplo
|
||||
err = untar(fname)
|
||||
}
|
||||
|
||||
if err == nil && len(req.Config) > 0 {
|
||||
if err == nil && len(req.Config) > 0 && req.Name != "houston" {
|
||||
// config.json도 다운로드
|
||||
h := md5.New()
|
||||
h.Write([]byte(strings.Trim(req.Config, "/")))
|
||||
|
||||
Reference in New Issue
Block a user