config파일을 추가로 배포
This commit is contained in:
@ -188,11 +188,11 @@ func (hc *houstonClient) prepareDeploy(name string, version string) (destPath st
|
|||||||
return verpath, nil
|
return verpath, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hc *houstonClient) makeDownloadUrl(req *shared.DeployRequest) string {
|
func (hc *houstonClient) makeDownloadUrl(rel string) string {
|
||||||
out := req.Url
|
out := rel
|
||||||
if !strings.HasPrefix(out, "http") {
|
if !strings.HasPrefix(out, "http") {
|
||||||
tks := strings.SplitN(hc.httpAddr, "://", 2)
|
tks := strings.SplitN(hc.httpAddr, "://", 2)
|
||||||
out = fmt.Sprintf("%s://%s", tks[0], path.Join(tks[1], req.Url))
|
out = fmt.Sprintf("%s://%s", tks[0], path.Join(tks[1], rel))
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ func (hc *houstonClient) prepareUpdateSelf(req *shared.DeployRequest) (srcdir st
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
fname, err := download(tempdir, hc.makeDownloadUrl(req), req.AccessToken)
|
fname, err := download(tempdir, hc.makeDownloadUrl(req.Url), req.AccessToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest) error {
|
|||||||
|
|
||||||
logger.Println("start downloading", req.Url)
|
logger.Println("start downloading", req.Url)
|
||||||
// verpath에 배포 시작
|
// verpath에 배포 시작
|
||||||
fname, err := download(root, hc.makeDownloadUrl(req), req.AccessToken)
|
fname, err := download(root, hc.makeDownloadUrl(req.Url), req.AccessToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -286,6 +286,11 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest) error {
|
|||||||
err = untar(fname)
|
err = untar(fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
// config.json도 다운로드
|
||||||
|
_, err = download(root, hc.makeDownloadUrl(req.Config), req.AccessToken)
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -90,7 +90,7 @@ func (h *houstonHandler) UploadDeploySource(w http.ResponseWriter, r *http.Reque
|
|||||||
var filename string
|
var filename string
|
||||||
|
|
||||||
if version == "config" {
|
if version == "config" {
|
||||||
filename = path.Join("deploys", name, version, "config"+ext)
|
filename = path.Join("deploys", name, version, "config.json")
|
||||||
} else {
|
} else {
|
||||||
// deploys 폴더는 파일시스템 서비스이므로 다운로드 가능
|
// deploys 폴더는 파일시스템 서비스이므로 다운로드 가능
|
||||||
filename = path.Join("deploys", name, version, name+ext)
|
filename = path.Join("deploys", name, version, name+ext)
|
||||||
@ -189,6 +189,7 @@ func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
|
|||||||
Name: name,
|
Name: name,
|
||||||
Version: version,
|
Version: version,
|
||||||
Url: path.Join(relPath, latestFilename),
|
Url: path.Join(relPath, latestFilename),
|
||||||
|
Config: path.Join("deploys", name, "config", "config.json"),
|
||||||
},
|
},
|
||||||
targets,
|
targets,
|
||||||
))
|
))
|
||||||
|
|||||||
@ -22,6 +22,7 @@ type DeployRequest struct {
|
|||||||
Name string
|
Name string
|
||||||
Version string
|
Version string
|
||||||
Url string
|
Url string
|
||||||
|
Config string
|
||||||
AccessToken string
|
AccessToken string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user