Compare commits

...

167 Commits

Author SHA1 Message Date
63727343ee [1.3] 신고
- 데모 파일 압축해서 업로드하도록 수정
2025-07-14 11:32:25 +09:00
19a4ff103f metric 서비스 복원 2025-07-01 18:51:40 +09:00
106aa68529 prometheus metric 관련 코드 제거 2025-06-26 14:48:05 +09:00
cf4a2a3ea5 포트 수정 및 로그 추가 2025-06-25 19:43:36 +09:00
965d6fa5b9 [1.2] 인프라
- houston.sh 리눅스 줄바꿈으로 변경
- make_houston_package.ps1이 houston.sh도 포함하도록 변경
2025-06-09 12:08:29 +09:00
0ed48e0de7 [1.2] 리플레이
- 리플레이 파일 다운로드 api 배열로 반환하도록 수정
2025-05-13 18:14:16 +09:00
d8ccbf209c [1.2] 리플레이
- 리플레이 파일 이름 유지하도록 수정
2025-05-13 17:37:24 +09:00
5f68795185 리플레이 저장
- stdout pipe를 통해 houston에 리플레이 upload 요청 기능 추가
2025-01-09 16:21:29 +09:00
3ab055008c 인증 일단 막음 2024-08-13 17:30:33 +09:00
71e80d2908 모듈 업데이트 2024-08-05 10:23:42 +09:00
12a0f9d2b1 argument 수식 처리 2024-08-05 10:20:41 +09:00
016f459252 houston server에 재접속시 autorun이 다시 불리는 문제 수정 2024-07-30 11:19:25 +09:00
030fa658f5 모듈 업데이트 2024-07-29 17:50:33 +09:00
3c96921703 autorun 포맷 오류시 대응 2024-07-25 16:10:09 +09:00
6f444e0187 config file service 방식 변경 2024-07-24 13:13:46 +09:00
3eaad85453 Merge branch 'master' of https://repositories.action2quare.com/ayo/houston 2024-07-10 14:55:49 +09:00
401cfa8b84 noauth대신 authtype 파라미터 사용 2024-07-10 14:55:47 +09:00
5e4799ff55 모듈 업데이트 2024-07-08 15:12:54 +09:00
86e14fbd23 logger.UseLogFile을 houston의 자식 프로세스에도 적용 2024-07-08 15:10:32 +09:00
fb3886e2e4 하위 프로세스에 환경변수 전달 2024-06-12 14:32:32 +09:00
95d6741389 config 로딩을 gocommon사용하도록 변경 2024-06-06 13:18:50 +09:00
fdb534c5e0 프로세스 정지시 로그 자동 업로드 2024-06-05 17:26:28 +09:00
dfcb78b70c 로그파일에 호스트이름 추가 2024-06-05 17:26:17 +09:00
4e928f3426 autorun 타이밍 변경. Query를 먼저 보내고 해야 함 2024-06-05 15:33:09 +09:00
d546f2340d config handler 추가 2024-06-05 13:41:43 +09:00
bad563dce7 autorun 추가 2024-06-05 13:40:10 +09:00
62494fb052 주소 잘못 보냄 2024-02-15 17:32:24 +09:00
eb86c0a073 houston을 prometheus target 파일로 출력 2024-02-15 17:04:28 +09:00
9d4718592d houston에 constlabel 설정 가능 2024-02-15 12:17:22 +09:00
dcc94d2609 homepath 설정 2024-02-13 15:12:18 +09:00
f45558483e 버전 비교 로직 제거 2024-02-07 17:03:19 +09:00
01940222b6 모듈 업데이트 2024-01-22 17:17:25 +09:00
d03f02a44f 윈도우에서 로그 폴더 위치 비정상 수정 2023-12-08 18:30:14 +09:00
27dd9226e9 윈도우에서 동작 안하는 문제 수정 2023-12-08 16:47:14 +09:00
00fa08a739 자식 프로세스 강종 후 나도 바로 종료 2023-12-05 18:56:14 +09:00
ccfa9e4be3 houston 종료시 kill signal 보냄 2023-12-05 18:54:42 +09:00
68a5876fd8 index와 pid 출력 2023-12-02 22:04:27 +09:00
33181f1717 모듈 업데이트 2023-12-02 21:31:27 +09:00
6e0bd71c80 중지할 프로세스를 동시에 처리 2023-12-01 19:34:35 +09:00
75992472f3 로그 추가 2023-12-01 10:38:02 +09:00
ee1459d760 metric 등록 오류 수정 2023-12-01 02:34:24 +09:00
3913c6cdcf 모듈 업데이트 2023-11-30 14:48:54 +09:00
2744a0a990 metrix exporter를 프로세스 단위로 내림 2023-11-30 14:47:11 +09:00
1d3266bbaf 동일 실행파일을 여러개 실행시켰을 때 구분해서 affinity 설정 2023-11-30 14:17:27 +09:00
023a2a5194 환경변수를 expand할 수 있음 2023-11-29 18:46:10 +09:00
6eaa856688 모듈 업데이트 2023-11-29 17:35:58 +09:00
afa270c9a0 메트릭 사용방법 변경 2023-11-28 22:31:42 +09:00
ad3382db89 모듈 업데이트 2023-11-28 00:57:43 +09:00
e1e2f3c087 endian 수정 2023-11-27 23:27:53 +09:00
cf4b458a4b metric namespace 설정 추가 2023-11-26 18:02:02 +09:00
72b88b194f 로그 변경 2023-11-25 22:16:12 +09:00
cfd6e23384 실행인자 cr 제거 2023-11-25 22:07:24 +09:00
6416c27230 메트릭 로그 정리 2023-11-25 21:06:52 +09:00
2ae42d0b08 setcap 다시 제거 -> iptables로 정리 2023-11-24 17:19:26 +09:00
d4cd792950 setcap 부활 2023-11-24 16:02:31 +09:00
84543f9a31 심볼링크 로그 파일은 빼고 삭제 2023-11-24 01:52:52 +09:00
1a404e5361 프로세스 종료시 알림 2023-11-24 00:19:17 +09:00
d18fe3e3a1 메트릭 중복 등록시 크래시 막음 2023-11-23 14:55:37 +09:00
b2ff0e8ffc set_permission 리눅스&클라이언트만 2023-11-23 12:51:33 +09:00
3208eba280 소켓 바인딩 권한 부여 2023-11-23 12:36:57 +09:00
882d35d604 모듈 업데이트 2023-11-16 19:57:36 +09:00
ba72262d50 custom metric 추가 2023-11-16 19:47:30 +09:00
8d764c8d18 최신 로그파일에 심볼릭 링크 생성 2023-11-14 11:22:23 +09:00
299a0a2bd3 빌드 태그는 main만 2023-11-14 10:29:33 +09:00
5c765fe32f 최신 로그 파일의 심볼릭 링크 생성 2023-11-13 17:29:22 +09:00
394466e216 로그 저장 로직 단순화 2023-11-13 16:43:56 +09:00
61d2fbf709 server 태그는 떼고 client 태그로만 빌드 구분 2023-11-13 12:04:27 +09:00
d43b83e761 client와 server 빌드를 분리하고 client에는 node_exporter 통합 2023-11-13 11:35:52 +09:00
432cc68024 절대 경로로 child process 실행 2023-11-08 09:21:09 +09:00
22148f8ae7 마지막 배포 상태 항상 유지 + timestamp 2023-10-26 13:53:36 +09:00
282ef95ab0 로그 다시 제거 2023-10-26 10:42:48 +09:00
5b0b977a39 로그 추가 2023-10-26 10:40:33 +09:00
2985e0fdaf GetDeployingProgress 추가 2023-10-24 21:18:28 +09:00
b8c1e97ab8 chunksize 계산 2023-10-24 20:57:41 +09:00
c9fecf55de 로그 추가 2023-10-24 20:39:12 +09:00
15ab1c9e7c 로그 추가 2023-10-24 20:18:49 +09:00
b6b8aa0794 deployprogress 2023-10-24 20:08:48 +09:00
64ca01c3a7 모듈 업데이트 2023-09-19 18:52:24 +09:00
5798e77a6c 모듈 업데이트 2023-09-11 12:49:05 +09:00
c5e2bc203a 모듈 업데이트 2023-09-08 15:28:13 +09:00
3ace1be27a stdout을 dev/null로 redirect 2023-09-05 17:16:05 +09:00
3dc121bc71 버전에 태그가 일찍 붙는 문제 수정 2023-07-03 14:31:55 +09:00
849973c449 서비스 자체 태그도 넘겨줌 2023-07-03 14:18:11 +09:00
d1a192159b 서비스 태그를 하위 버전에도 붙여줌 2023-07-03 14:12:21 +09:00
7a5696961f 버전에 태그를 붙임 2023-07-03 14:08:28 +09:00
4d9a25dd6b 클라이언트에서는 태그를 없애고 서버에서만 관리 2023-07-03 11:34:21 +09:00
9bd09509c8 reaonly 대신 tag로 교체 2023-07-03 10:54:13 +09:00
1b57e9f87e 업로드 된 로그 파일은 지우되, 최신도 같이 지워지던 문제 수정 2023-06-30 16:48:13 +09:00
4667d351a8 업로드한 로그 제거 안함 2023-06-30 16:38:01 +09:00
571f0d76df 업로드한 로그도 제거하지 말자 2023-06-30 15:51:03 +09:00
15dd1e544c 하위 폴더 복사 누락 수정 2023-06-29 14:13:04 +09:00
45ab15d345 gracefulstop 말고 바로 stop 2023-06-29 12:24:13 +09:00
02db65e06f houston 버전 관리 2023-06-29 12:05:11 +09:00
a8821b694b 버전 파일 경로 오류 수정 2023-06-29 11:11:23 +09:00
5429d3d90f houstonClient도 버전 관리 2023-06-29 11:00:26 +09:00
cf46888b6a houstonClient 종료시 houstonServer도 종료 2023-06-29 10:19:57 +09:00
6a35d7b1fe 프로세스 구동중인지 검출하는 로직 변경 2023-06-28 18:29:12 +09:00
d04dd5b05d 로그 더 추가 2023-06-28 18:22:50 +09:00
d3442be5dc 로그 추가 2023-06-28 18:15:13 +09:00
06bc095ea4 프로세스 종료 판별 로직 수정 2023-06-28 18:00:51 +09:00
da47d7c587 httpwriter tracker 일단 다시 제거 2023-06-27 20:05:23 +09:00
d464812cf8 config 다운로드 경로 수정 2023-06-27 11:55:24 +09:00
fa8b78efed restart 로직 변경 2023-06-27 11:17:16 +09:00
9b0aa4d640 인덱스 버그 수정 2023-06-27 11:02:19 +09:00
cacbc1008a operation argument에 []string 지원 2023-06-27 10:53:14 +09:00
6d319f2fa1 logapicall 플래그 추가 2023-06-27 10:06:26 +09:00
01b4782e78 프로세스 재시작 지원 2023-06-27 09:44:56 +09:00
72e94ccfc3 noauth 처리 2023-06-27 00:03:43 +09:00
d17c53c79c 로그 추가 2023-06-26 23:24:49 +09:00
9590de2e00 프로세스 종료 대기 로직 수정 2023-06-26 22:38:29 +09:00
58897522a7 config 파일이 없어도 괜춘 2023-06-26 19:19:58 +09:00
06b390815c 프로세스 재시작 요청 추가 2023-06-26 11:26:57 +09:00
3d3020f827 폴더 다시 조정 2023-06-22 20:39:38 +09:00
9947835ba1 deploys, downloads 경로 변경 2023-06-22 20:35:35 +09:00
30ff0a4b27 deploy source에 다운로드 경로를 보내줌 2023-06-22 20:24:59 +09:00
c98023cc8b 서버와 클라이언트 동시에 구동하는 옵션 추가 2023-06-22 17:16:09 +09:00
3278bca32f 하드코딩된 폴더들 const로 뺌 2023-06-22 17:15:56 +09:00
bdc3e19718 flag를 flagx로 교체 2023-06-21 14:35:27 +09:00
61a98247d8 따옴표 문제 수정 2023-06-15 16:25:55 +09:00
3f2ea5cee3 자식 프로세스 비정상종료시 처리 2023-06-15 11:24:02 +09:00
a8548fffe2 cors cjfl 2023-06-14 15:51:54 +09:00
f58db1ec09 json 소문자로 변경 2023-06-14 15:33:44 +09:00
1c1f9f748a 안쓰는 필드 제거 2023-06-14 15:30:01 +09:00
279c9f47f0 client도 storageroot지원 2023-06-14 14:16:47 +09:00
46aedbe767 모듈 업데이트 2023-06-14 01:50:48 +09:00
96ee2a4627 자동 재접속 2023-06-14 01:50:40 +09:00
2e4b7811db replace에 다음 실행 파라미터도 넘길 수 있음 2023-06-14 01:50:25 +09:00
3add5d9355 로거 되돌림 2023-06-14 00:13:51 +09:00
20b2df1fc5 로그 정리 2023-06-13 23:54:32 +09:00
4cec01609a 로거 정리 2023-06-13 23:49:37 +09:00
43da9424f0 다운로드 링크 수정 2023-06-13 23:49:25 +09:00
c4c0f86947 로거 정리 2023-06-13 23:49:14 +09:00
838b3a2194 unzip 버그 수정 - 백슬래시 처리 추가 2023-06-13 23:48:51 +09:00
93c13ba92f houston package 생성 스크립트 추가 2023-06-13 20:13:03 +09:00
ed5b4c06e9 ignore 업데이트 2023-06-13 20:12:37 +09:00
c1847ee3e1 파일에 직접 로깅하는 로거로 교체 2023-06-13 20:03:10 +09:00
d490188bd2 템플릿 변경 2023-06-13 16:27:47 +09:00
ac355d32b4 config 구조 변경 2023-06-13 16:26:00 +09:00
26b12fad72 클라이언트 다운로드 url은 deploys로 시작하는게 맞음 2023-06-13 16:25:32 +09:00
faefd8cfca 폴더 생성 확인 2023-06-13 11:18:22 +09:00
5f1b23ed80 deploy, download 경로 지정 2023-06-13 11:04:30 +09:00
5c00ff73d7 houston server config에 storagepath 추가 2023-06-13 10:10:30 +09:00
b14ad791df config파일을 추가로 배포 2023-06-12 12:28:33 +09:00
471d07a188 config도 폴더로 저장 2023-06-12 11:50:00 +09:00
153a9e50ca config는 특별처리 2023-06-12 11:43:29 +09:00
fa5a612173 Merge branch 'master' of https://repositories.action2quare.com/ayo/houston 2023-06-11 17:14:47 +09:00
6719d9b6c1 monitor func 제거하고 grpc dial을 timeout context로 교체 2023-06-11 17:14:44 +09:00
06c7fbd32d deploys 폴더가 없으면 생성 2023-06-11 16:04:04 +09:00
1d525eb7cf handler 경로 변경 2023-06-10 16:27:46 +09:00
18e7ee0afa 테스트 코드 제거 2023-06-09 16:19:51 +09:00
5326e26a8c houston 자체 업데이트 기능 추가 - replacer 2023-06-09 16:16:26 +09:00
ae783aabaf 포트 설정 버그 수정 2023-06-09 11:56:36 +09:00
1d87ef3501 서버, 클라이언트 config 분리 2023-06-09 11:53:31 +09:00
cff643310b 회수 버그 수정 2023-05-30 16:51:23 +09:00
9b9c3eaa4d 최초 deploy후 arg가 안보이는 문제 수정 2023-05-30 16:29:14 +09:00
2f30d4cbc0 args가 빈 값으로 들어왔을 때 처리 2023-05-30 15:28:18 +09:00
3161afd091 deleteDeploySource, undeploy 추가 2023-05-30 12:12:23 +09:00
18e7cbf75e 경로 문제 수정 2023-05-28 21:21:37 +09:00
49921d44ce 실행중이지 않은 로그도 업로드 2023-05-26 17:51:28 +09:00
10555ba61a download 경로 변경 2023-05-26 17:51:08 +09:00
28d8fc4149 argument에 ./가 계속 붙는 문제 수정 2023-05-26 16:26:40 +09:00
c4c157e2f8 fileserver stripprefix 수정 2023-05-25 11:22:30 +09:00
383f846934 client server 실행인자 추가 2023-05-25 10:59:04 +09:00
53a385d018 go-ayo/common을 gocommon으로 변경 2023-05-24 15:14:04 +09:00
11ea571b6e 바인딩 주소 변경 2023-05-23 16:30:23 +09:00
566a4067ab Merge branch 'master' of https://repositories.action2quare.com/ayo/houston 2023-05-23 13:54:27 +09:00
8289018fd6 houston handler 추가 2023-05-23 13:54:25 +09:00
28 changed files with 2952 additions and 881 deletions

5
.gitignore vendored
View File

@ -1,3 +1,6 @@
go-ayo/
*.log *.log
*.exe *.exe
houston
houston.zip
config.json
.vscode/

View File

@ -2,84 +2,130 @@ package client
import ( import (
"context" "context"
"errors"
"fmt"
"io" "io"
"io/fs"
"net/http"
"os" "os"
"os/exec" "os/exec"
"os/signal"
"path" "path"
"path/filepath"
"reflect" "reflect"
"sort" "sort"
"strconv" "strconv"
"strings"
"sync"
"sync/atomic" "sync/atomic"
"syscall"
"time"
"unsafe" "unsafe"
"repositories.action2quare.com/ayo/go-ayo/logger" "github.com/djherbis/times"
"repositories.action2quare.com/ayo/gocommon"
"repositories.action2quare.com/ayo/gocommon/flagx"
"repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/houston/shared" "repositories.action2quare.com/ayo/houston/shared"
"repositories.action2quare.com/ayo/houston/shared/protos" "repositories.action2quare.com/ayo/houston/shared/protos"
"time"
"github.com/shirou/gopsutil/v3/cpu"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
sigar "github.com/cloudfoundry/gosigar" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
) )
type runcommand struct {
Exec string `json:"exec"`
Args []string `json:"args"`
Version string `json:"version"`
}
type clientConfig struct {
GrpcAddress string `json:"grpc_server_address"`
HttpAddress string `json:"http_server_address"`
StorageRoot string `json:"storage_path"`
MetricNamespace string `json:"metric_namespace"`
MetricPipeName string `json:"metric_pipe"`
ConstLabels map[string]string `json:"metric_const_labels"`
Autorun map[string]runcommand `json:"autorun"`
}
var autorun = flagx.String("autorun", "", "")
type outerconfig struct {
Houston *struct {
Client clientConfig `json:"client"`
} `json:"houston"`
}
func loadClientConfig() (clientConfig, error) {
var oc outerconfig
err := gocommon.LoadConfig[outerconfig](&oc)
if err != nil {
logger.Println(err)
return clientConfig{}, err
}
return oc.Houston.Client, nil
}
type HoustonClient interface { type HoustonClient interface {
SetReportMetrics(map[string]float32)
Shutdown() Shutdown()
Start()
MetricHandler() http.Handler
} }
type bufferStack struct { var seq = int32(1)
pool [5][]byte
cursor int32
}
func (bs *bufferStack) pop() []byte {
pos := atomic.LoadInt32(&bs.cursor)
for !atomic.CompareAndSwapInt32(&bs.cursor, pos, pos+1) {
pos = atomic.LoadInt32(&bs.cursor)
}
defer func() {
bs.pool[pos] = nil
}()
curbuf := bs.pool[pos]
if curbuf == nil {
curbuf = make([]byte, 1024)
}
return curbuf
}
func (bs *bufferStack) push(x []byte) {
pos := atomic.AddInt32(&bs.cursor, -1)
bs.pool[pos] = x
}
type procmeta struct { type procmeta struct {
id int32
cmd *exec.Cmd cmd *exec.Cmd
name string name string
args []string
version string version string
state protos.ProcessState verpath string
state int32
stdin io.WriteCloser stdin io.WriteCloser
logUploadChan chan *shared.UploadRequest }
buffers bufferStack
func (pm *procmeta) isState(s protos.ProcessState) bool {
return atomic.LoadInt32(&pm.state) == int32(s)
}
func (pm *procmeta) getState() protos.ProcessState {
return protos.ProcessState(atomic.LoadInt32(&pm.state))
}
func (pm *procmeta) setState(s protos.ProcessState) {
atomic.StoreInt32(&pm.state, int32(s))
}
type uploadRequest struct {
filePath string
name string
version string
uploadedFileName string
} }
type houstonClient struct { type houstonClient struct {
client *grpc.ClientConn
childProcs []*procmeta childProcs []*procmeta
extraMetrics unsafe.Pointer // map[string]float32 extraMetrics unsafe.Pointer // map[string]float32
deploys map[string][]*protos.VersionAndArgs deploys map[string][]*protos.VersionAndArgs
shutdownFunc context.CancelFunc shutdownFunc context.CancelFunc
ctx context.Context
operationChan chan *protos.OperationQueryResponse
exitChan chan *exec.Cmd exitChan chan *exec.Cmd
httpAddr string clientChan chan *grpc.ClientConn
uploadChan chan uploadRequest
timestamp string timestamp string
} wg sync.WaitGroup
config clientConfig
func bToMb(b uint64) uint32 { version string
return uint32(b / 1024 / 1024) standalone bool
siblingProcIndex map[string]uint64
registry *prometheus.Registry
} }
func unmarshal[T any](val *T, src map[string]string) { func unmarshal[T any](val *T, src map[string]string) {
@ -92,47 +138,91 @@ func unmarshal[T any](val *T, src map[string]string) {
if argval.Elem().Field(i).CanInt() { if argval.Elem().Field(i).CanInt() {
num, _ := strconv.ParseInt(arg, 10, 0) num, _ := strconv.ParseInt(arg, 10, 0)
argval.Elem().Field(i).SetInt(num) argval.Elem().Field(i).SetInt(num)
} else if argval.Elem().Field(i).Kind() == reflect.Array || argval.Elem().Field(i).Kind() == reflect.Slice {
conv := strings.Split(arg, "\n")
argval.Elem().Field(i).Set(reflect.ValueOf(conv))
} else { } else {
argval.Elem().Field(i).SetString(arg) argval.Elem().Field(i).SetString(arg)
} }
} }
logger.Println("operation receive :", argval.Elem().Type().Name(), *val)
} }
func gatherDeployedPrograms(name string) []*protos.VersionAndArgs { type version_args_ts struct {
var rawvers []*protos.VersionAndArgs *protos.VersionAndArgs
if vers, err := os.ReadDir(path.Join("./", name)); err == nil { modTime time.Time
}
func gatherDeployedPrograms(storageRoot, name string) (out []*protos.VersionAndArgs) {
var rawvers []version_args_ts
targetPath := path.Join(storageRoot, name)
if vers, err := os.ReadDir(targetPath); err == nil {
for _, ver := range vers { for _, ver := range vers {
if ver.IsDir() { if ver.IsDir() {
args := lastExecutionArgs(path.Join(name, ver.Name())) fi, _ := ver.Info()
rawvers = append(rawvers, &protos.VersionAndArgs{ args := lastExecutionArgs(path.Join(targetPath, ver.Name()))
rawvers = append(rawvers, version_args_ts{
VersionAndArgs: &protos.VersionAndArgs{
Version: ver.Name(), Version: ver.Name(),
Args: args, Args: args,
},
modTime: fi.ModTime(),
}) })
} }
} }
} }
sort.Slice(rawvers, func(i, j int) bool { sort.Slice(rawvers, func(i, j int) bool {
leftParsed := shared.ParseVersionString(rawvers[i].Version) return rawvers[i].modTime.After(rawvers[j].modTime)
rightParsed := shared.ParseVersionString(rawvers[j].Version)
return shared.CompareVersionString(leftParsed, rightParsed) < 0
}) })
return rawvers
for _, v := range rawvers {
out = append(out, v.VersionAndArgs)
}
return
} }
func (hc *houstonClient) makeOperationQueryRequest() *protos.OperationQueryRequest { func (hc *houstonClient) makeOperationQueryRequest() *protos.OperationQueryRequest {
hn, _ := os.Hostname() var procs []*protos.ProcessDescription
procs := make([]*protos.ProcessDescription, 0, len(hc.childProcs)) var deploys []*protos.DeployedVersions
var selfname string
var selfargs []string
if hc.standalone {
selfname = path.Base(filepath.ToSlash(os.Args[0]))
selfargs = os.Args[1:]
} else {
selfname = "houston"
selfargs = []string{}
}
if len(path.Ext(selfname)) > 0 {
selfname = selfname[:len(selfname)-len(path.Ext(selfname))]
}
procs = append(procs, &protos.ProcessDescription{
Name: selfname,
Args: selfargs,
Version: hc.version,
State: protos.ProcessState_Running,
Pid: int32(os.Getpid()),
})
deploys = append(deploys, &protos.DeployedVersions{
Name: selfname,
Versions: []*protos.VersionAndArgs{
{Version: hc.version, Args: selfargs},
},
})
for _, child := range hc.childProcs { for _, child := range hc.childProcs {
procs = append(procs, &protos.ProcessDescription{ procs = append(procs, &protos.ProcessDescription{
Name: child.name, Name: child.name,
Args: child.cmd.Args, Args: child.cmd.Args,
Version: child.version, Version: child.version,
State: child.state, State: child.getState(),
Pid: int32(child.cmd.Process.Pid), Pid: int32(child.cmd.Process.Pid),
}) })
} }
var deploys []*protos.DeployedVersions
for name, prog := range hc.deploys { for name, prog := range hc.deploys {
deploys = append(deploys, &protos.DeployedVersions{ deploys = append(deploys, &protos.DeployedVersions{
Name: name, Name: name,
@ -140,19 +230,30 @@ func (hc *houstonClient) makeOperationQueryRequest() *protos.OperationQueryReque
}) })
} }
hn, _ := os.Hostname()
return &protos.OperationQueryRequest{ return &protos.OperationQueryRequest{
Hostname: hn, Hostname: hn,
PublicIp: os.Getenv("PUBIP"),
PrivateIp: os.Getenv("PRVIP"),
Procs: procs, Procs: procs,
Deploys: deploys, Deploys: deploys,
} }
} }
func NewClient(grpcAddr string, httpAddr string) (HoustonClient, error) { func NewClient(standalone bool) (HoustonClient, error) {
client, err := grpc.Dial(grpcAddr, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials())) clientConfig, err := loadClientConfig()
if err != nil { if err != nil {
return nil, err return nil, err
} }
if len(clientConfig.GrpcAddress) == 0 {
return nil, errors.New("client.grpc_server_address is missing")
}
if len(clientConfig.HttpAddress) == 0 {
return nil, errors.New("client.http_server_address is missing")
}
exefile, err := os.Executable() exefile, err := os.Executable()
if err != nil { if err != nil {
return nil, err return nil, err
@ -163,73 +264,104 @@ func NewClient(grpcAddr string, httpAddr string) (HoustonClient, error) {
return nil, err return nil, err
} }
sp, err := os.Stat(clientConfig.StorageRoot)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
err = os.MkdirAll(clientConfig.StorageRoot, 0775)
}
} else if !sp.IsDir() {
err = errors.New(clientConfig.StorageRoot + " is not directory")
}
if err != nil {
return nil, err
}
deploys := make(map[string][]*protos.VersionAndArgs) deploys := make(map[string][]*protos.VersionAndArgs)
if dirs, err := os.ReadDir("./"); err == nil { if dirs, err := os.ReadDir(clientConfig.StorageRoot); err == nil {
for _, dir := range dirs { for _, dir := range dirs {
if dir.IsDir() { if dir.IsDir() {
flagf := path.Join(dir.Name(), "@houston") flagf := path.Join(clientConfig.StorageRoot, dir.Name(), "@houston")
if _, err := os.Stat(flagf); !os.IsNotExist(err) { if _, err := os.Stat(flagf); !os.IsNotExist(err) {
deploys[dir.Name()] = gatherDeployedPrograms(dir.Name()) deploys[dir.Name()] = gatherDeployedPrograms(clientConfig.StorageRoot, dir.Name())
} }
} }
} }
} }
ver, _ := os.ReadFile("@version")
if len(ver) == 0 {
ver = []byte("0.0.0")
}
hc := &houstonClient{ hc := &houstonClient{
client: client, config: clientConfig,
clientChan: make(chan *grpc.ClientConn),
extraMetrics: unsafe.Pointer(&map[string]float32{}), extraMetrics: unsafe.Pointer(&map[string]float32{}),
deploys: deploys, deploys: deploys,
httpAddr: httpAddr,
timestamp: exefi.ModTime().String(), timestamp: exefi.ModTime().String(),
version: string(ver),
standalone: standalone,
uploadChan: make(chan uploadRequest, 100),
siblingProcIndex: make(map[string]uint64),
registry: prometheus.NewRegistry(),
} }
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
go func() {
// regularly send status
sc := protos.NewMonitorClient(client)
hn, _ := os.Hostname()
mem := sigar.Mem{}
mem.Get()
metrics := &protos.Metrics{
Hostname: hn,
Total: bToMb(mem.Total),
}
for {
select {
case <-ctx.Done():
return
case <-time.After(5 * time.Second):
percent, _ := cpu.Percent(0, false)
metrics.Cpu = float32(percent[0])
metrics.Free = bToMb(mem.ActualFree)
metrics.Metrics = *(*map[string]float32)(atomic.LoadPointer(&hc.extraMetrics))
sc.Report(context.Background(), metrics, grpc.WaitForReady(true))
mem.Get()
}
}
}()
exitChan := make(chan *exec.Cmd, 10) exitChan := make(chan *exec.Cmd, 10)
operationChan := make(chan *protos.OperationQueryResponse, 10) operationChan := make(chan *protos.OperationQueryResponse, 10)
hc.wg.Add(1)
// autorun 처리
go func() { go func() {
defer hc.wg.Done()
// 메인 operator // 메인 operator
op := protos.NewOperationClient(hc.client) var op protos.OperationClient
myname, _ := os.Executable()
myname = path.Base(filepath.ToSlash(myname))
if len(path.Ext(myname)) > 0 {
myname = myname[:len(myname)-len(path.Ext(myname))]
}
if myname == "__debug_bin" {
myname = "houston"
}
for { for {
select { select {
case <-ctx.Done(): case <-ctx.Done():
return return
case newClient := <-hc.clientChan:
op = protos.NewOperationClient(newClient)
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
case exited := <-exitChan: case exited := <-exitChan:
var newprocs []*procmeta var newprocs []*procmeta
for _, proc := range hc.childProcs { for _, proc := range hc.childProcs {
if proc.cmd == exited && proc.state != protos.ProcessState_Stopped { if proc.cmd == exited {
proc.state = protos.ProcessState_Stopped if proc.isState(protos.ProcessState_Running) || proc.isState(protos.ProcessState_Restart) {
go func(proc *procmeta) {
if err := proc.cmd.Process.Signal(syscall.SIGTERM); err != nil {
proc.cmd.Process.Signal(os.Kill)
}
proc.cmd.Wait()
proc.cmd.Process.Release()
if proc.isState(protos.ProcessState_Restart) {
if err := hc.startChildProcess(&shared.StartProcessRequest{
Version: proc.version,
Name: proc.name,
Args: proc.args,
}); err != nil {
logger.ErrorWithCallStack(err)
} else {
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
}
}
}(proc)
}
} else { } else {
newprocs = append(newprocs, proc) newprocs = append(newprocs, proc)
} }
@ -242,22 +374,69 @@ func NewClient(grpcAddr string, httpAddr string) (HoustonClient, error) {
case shared.Deploy: case shared.Deploy:
var dr shared.DeployRequest var dr shared.DeployRequest
unmarshal(&dr, resp.Args) unmarshal(&dr, resp.Args)
err := hc.deploy(&dr) if dr.Name == myname {
if err == nil { if srcdir, replacer, err := hc.prepareUpdateSelf(&dr); err == nil {
prog := gatherDeployedPrograms(dr.Name) args := []string{
hc.deploys[dr.Name] = prog fmt.Sprintf("%d", os.Getpid()),
op.Refresh(ctx, hc.makeOperationQueryRequest()) srcdir,
filepath.ToSlash(os.Args[0]),
}
args = append(args, os.Args[1:]...)
cmd := exec.Command(replacer, args...)
if err := cmd.Start(); err != nil {
logger.Println(err)
} else {
hc.shutdownFunc()
}
} else { } else {
logger.Println(err) logger.Println(err)
} }
} else {
hn, _ := os.Hostname()
if err := hc.deploy(&dr, func(dp *protos.DeployingProgress) {
dp.Hostname = hn
dp.Name = dr.Name
dp.Version = dr.Version
op.ReportDeployingProgress(ctx, dp)
}); err == nil {
prog := gatherDeployedPrograms(hc.config.StorageRoot, dr.Name)
hc.deploys[dr.Name] = prog
op.Refresh(ctx, hc.makeOperationQueryRequest())
op.ReportDeployingProgress(ctx, &protos.DeployingProgress{
Hostname: hn,
Name: dr.Name,
Version: dr.Version,
State: "success",
Progress: 0,
Total: 0,
})
} else {
logger.Println(err)
op.ReportDeployingProgress(ctx, &protos.DeployingProgress{
Hostname: hn,
Name: dr.Name,
Version: dr.Version,
State: "fail:" + err.Error(),
Progress: 0,
Total: 0,
})
}
}
case shared.Withdraw: case shared.Withdraw:
var wr shared.WithdrawRequest var wr shared.WithdrawRequest
unmarshal(&wr, resp.Args) unmarshal(&wr, resp.Args)
err := hc.withdraw(&wr) err := hc.withdraw(&wr)
if err == nil { if err == nil {
prog := gatherDeployedPrograms(wr.Name) prog := gatherDeployedPrograms(hc.config.StorageRoot, wr.Name)
if len(prog) == 0 {
delete(hc.deploys, wr.Name)
} else {
hc.deploys[wr.Name] = prog hc.deploys[wr.Name] = prog
}
op.Refresh(ctx, hc.makeOperationQueryRequest()) op.Refresh(ctx, hc.makeOperationQueryRequest())
} else { } else {
logger.Println(err) logger.Println(err)
@ -267,20 +446,22 @@ func NewClient(grpcAddr string, httpAddr string) (HoustonClient, error) {
var sr shared.StartProcessRequest var sr shared.StartProcessRequest
unmarshal(&sr, resp.Args) unmarshal(&sr, resp.Args)
if err := hc.startChildProcess(&sr); err != nil { if err := hc.startChildProcess(&sr); err != nil {
logger.Println(err) logger.ErrorWithCallStack(err)
} else {
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
} }
case shared.Stop: case shared.Stop:
var sr shared.StopProcessRequest var sr shared.StopProcessRequest
unmarshal(&sr, resp.Args) unmarshal(&sr, resp.Args)
if err := hc.stopChildProcess(&sr); err != nil { if err := hc.stopChildProcess(&sr, op); err != nil {
logger.Println(err) logger.Println(err)
} }
case shared.Restart: case shared.Restart:
var rr shared.RestartProcessRequest var rr shared.RestartProcessRequest
unmarshal(&rr, resp.Args) unmarshal(&rr, resp.Args)
if err := hc.restartChildProcess(&rr); err != nil { if err := hc.restartChildProcess(&rr, op); err != nil {
logger.Println(err) logger.Println(err)
} }
@ -290,38 +471,47 @@ func NewClient(grpcAddr string, httpAddr string) (HoustonClient, error) {
if err := hc.uploadFiles(&ur); err != nil { if err := hc.uploadFiles(&ur); err != nil {
logger.Println(err) logger.Println(err)
} }
case shared.Exception:
idstr := resp.Args["id"]
id64, _ := strconv.ParseInt(idstr, 10, 0)
id := int32(id64)
hc.childProcs = gocommon.ShrinkSlice(hc.childProcs, func(e *procmeta) bool {
if e.id == id {
e.cmd.Wait()
e.cmd.Process.Release()
return true
}
return false
})
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
} }
} }
} }
}() }()
go func() { hc.shutdownFunc = func() {
// receive from stream // child process 강제 종료
for { for _, procmeta := range hc.childProcs {
select { if procmeta.cmd != nil && procmeta.cmd.Process != nil {
case <-ctx.Done(): procmeta.cmd.Process.Signal(os.Kill)
return }
}
default: time.Sleep(time.Second)
err := hc.checkOperation(operationChan) cancel()
if err != nil {
logger.Println("hc.checkUpdate failed :", err)
} }
}
}
}()
hc.shutdownFunc = cancel
hc.exitChan = exitChan hc.exitChan = exitChan
hc.ctx = ctx
hc.operationChan = operationChan
return hc, nil return hc, nil
} }
func (hc *houstonClient) Shutdown() { func uploadSafe(url, filePath, name, version, uploadedFileName string) error {
hc.shutdownFunc()
}
func (hc *houstonClient) checkOperation(opChan chan<- *protos.OperationQueryResponse) error {
defer func() { defer func() {
r := recover() r := recover()
if r != nil { if r != nil {
@ -329,14 +519,204 @@ func (hc *houstonClient) checkOperation(opChan chan<- *protos.OperationQueryResp
} }
}() }()
op := protos.NewOperationClient(hc.client) t, err := times.Stat(filePath)
cl, err := op.Query(context.Background(), grpc.WaitForReady(true)) if err != nil {
return err
}
file, err := os.Open(filePath)
if err != nil {
return err
}
if file == nil {
return errors.New("upload file is missing :" + filePath)
}
defer file.Close()
// hc.config.HttpAddress+"/upload",
httpreq, err := http.NewRequest("POST", url, file)
if err != nil {
return err
}
hn, _ := os.Hostname()
// createTime := file.
httpreq.Header.Set("Houston-Service-Name", name)
httpreq.Header.Set("Houston-Service-Version", version)
if len(uploadedFileName) == 0 {
uploadedFileName = t.BirthTime().UTC().Format(time.DateOnly) + "." + hn + path.Ext(filePath)
}
httpreq.Header.Set("Houston-Service-Filename", uploadedFileName)
httpreq.Header.Set("Content-Type", "application/zip")
resp, err := http.DefaultClient.Do(httpreq)
if err != nil {
return err
}
resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("upload file failed. response code : %s, %d", filePath, resp.StatusCode)
}
if err := os.Remove(filePath); err != nil {
return err
}
return nil
}
func (hc *houstonClient) Start() {
// receive from stream
defer func() {
hc.wg.Wait()
for _, proc := range hc.childProcs {
if err := proc.cmd.Process.Signal(syscall.SIGTERM); err != nil {
proc.cmd.Process.Signal(os.Kill)
proc.setState(protos.ProcessState_Stopping)
}
}
for _, proc := range hc.childProcs {
proc.cmd.Wait()
proc.cmd.Process.Release()
}
close(hc.uploadChan)
}()
if len(hc.config.MetricPipeName) == 0 {
hc.config.MetricPipeName = "houston_metric_pipe"
}
if len(hc.config.MetricNamespace) == 0 {
hc.config.MetricNamespace = "ou"
}
run_metric_pipe_reader(hc.config, hc.registry, hc.ctx)
go func() {
// upload 고루틴
url := hc.config.HttpAddress + "/upload"
for req := range hc.uploadChan {
logger.Println("uploadSafe :", req)
err := uploadSafe(url, req.filePath, req.name, req.version, req.uploadedFileName)
if err != nil {
logger.Println("uploadSafe return err :", err)
}
}
}()
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
go func() {
c := <-interrupt
logger.Println("interrupt!!!!!!!! :", c.String())
hc.shutdownFunc()
}()
var client *grpc.ClientConn
reconnCount := 0
time.Sleep(time.Second)
if autorun != nil && len(*autorun) > 0 {
hascount := strings.Split(*autorun, "/")
var service string
count := 1
if len(hascount) > 1 {
service = hascount[0]
if len(hascount[1]) > 0 {
count, _ = strconv.Atoi(hascount[1])
}
} else {
service = *autorun
}
if cmd, ok := hc.config.Autorun[service]; ok {
// service 서비스
for i := 0; i < count; i++ {
sr := shared.StartProcessRequest{
Name: service,
Version: cmd.Version,
Args: append([]string{cmd.Exec}, cmd.Args...),
}
if err := hc.startChildProcess(&sr); err != nil {
logger.Println("startChildProcess failed by autorun :", err)
logger.ErrorWithCallStack(err)
} else {
logger.Println("autorun success :", sr)
}
}
}
}
for {
select {
case <-hc.ctx.Done():
return
default:
if client == nil {
if reconnCount == 0 {
logger.Println("grpc.DialContext :", hc.config.GrpcAddress)
}
reconnCount++
var err error
dialContext, cancelDial := context.WithTimeout(context.Background(), 5*time.Second)
client, err = grpc.DialContext(dialContext, hc.config.GrpcAddress, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()))
cancelDial()
if err != nil {
logger.Println("grpc.DialContext returns err :", err)
} else if client != nil {
reconnCount = 0
logger.Println("grpc.DialContext succeeded")
hc.clientChan <- client
}
}
if client != nil {
err := hc.checkOperation(client)
if err != nil {
logger.Println("grpc.DialContext hc.checkOperation failed :", err)
client = nil
}
}
}
}
}
func (hc *houstonClient) Shutdown() {
hc.shutdownFunc()
}
func (hc *houstonClient) MetricHandler() http.Handler {
return promhttp.InstrumentMetricHandler(
hc.registry, promhttp.HandlerFor(hc.registry, promhttp.HandlerOpts{}),
)
}
func (hc *houstonClient) checkOperation(client *grpc.ClientConn) error {
defer func() {
r := recover()
if r != nil {
logger.Println(r)
}
}()
op := protos.NewOperationClient(client)
cl, err := op.Query(hc.ctx, grpc.WaitForReady(true))
if err != nil { if err != nil {
return err return err
} }
err = cl.Send(hc.makeOperationQueryRequest()) err = cl.Send(hc.makeOperationQueryRequest())
if err != nil { if err != nil {
cl.CloseSend() cl.CloseSend()
return err return err
@ -348,10 +728,6 @@ func (hc *houstonClient) checkOperation(opChan chan<- *protos.OperationQueryResp
cl.CloseSend() cl.CloseSend()
return err return err
} }
opChan <- update hc.operationChan <- update
} }
} }
func (hc *houstonClient) SetReportMetrics(extra map[string]float32) {
atomic.StorePointer(&hc.extraMetrics, unsafe.Pointer(&extra))
}

26
client/client_linux.go Normal file
View File

@ -0,0 +1,26 @@
//go:build linux
package client
import (
"golang.org/x/sys/unix"
"repositories.action2quare.com/ayo/gocommon/logger"
)
func set_affinity(pid int, cpu int) {
var cpuset unix.CPUSet
err := unix.SchedGetaffinity(pid, &cpuset)
if err != nil {
logger.Println("SchedGetaffinity failed :", err)
}
count := cpuset.Count()
cpuset.Zero()
cpuset.Set(cpu % count)
err = unix.SchedSetaffinity(pid, &cpuset)
if err != nil {
logger.Println("SchedSetaffinity failed :", err)
}
}

41
client/client_misc.go Normal file
View File

@ -0,0 +1,41 @@
//go:build !linux
package client
func set_affinity(pid int, cpu int) {
}
// package main
// import (
// "fmt"
// "syscall"
// "time"
// "unsafe"
// )
// func main() {
// var mask uintptr
// // Get the current CPU affinity of the process
// if _, _, err := syscall.RawSyscall(syscall.SYS_SCHED_GETAFFINITY, 0, uintptr(unsafe.Sizeof(mask)), uintptr(unsafe.Pointer(&mask))); err != 0 {
// fmt.Println("Failed to get CPU affinity:", err)
// return
// }
// fmt.Println("Current CPU affinity:", mask)
// // Set the new CPU affinity
// mask = 3
// if _, _, err := syscall.RawSyscall(syscall.SYS_SCHED_SETAFFINITY, 0, uintptr(unsafe.Sizeof(mask)), uintptr(unsafe.Pointer(&mask))); err != 0 {
// fmt.Println("Failed to set CPU affinity:", err)
// return
// }
// fmt.Println("New CPU affinity:", mask)
// // some code
// for {
// println("Hello, World!")
// time.Sleep(1 * time.Second)
// }
// }

View File

@ -3,18 +3,20 @@ package client
import ( import (
"archive/tar" "archive/tar"
"archive/zip" "archive/zip"
"crypto/md5"
"encoding/hex"
"errors" "errors"
"fmt" "fmt"
"io" "io"
"io/fs"
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"path" "path"
"path/filepath"
"strconv"
"strings" "strings"
"repositories.action2quare.com/ayo/go-ayo/logger" "repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/houston/shared" "repositories.action2quare.com/ayo/houston/shared"
"repositories.action2quare.com/ayo/houston/shared/protos" "repositories.action2quare.com/ayo/houston/shared/protos"
@ -23,17 +25,42 @@ import (
"golang.org/x/text/transform" "golang.org/x/text/transform"
) )
func download(dir string, urlpath string, accessToken string) (string, error) { func pof2(x int64, min int64) (out int64) {
out = 1
org := x
for (x >> 1) > 0 {
out = out << 1
x = x >> 1
}
if org > out {
out = out << 1
}
if out < min {
out = min
}
return
}
func download(dir string, urlpath string, accessToken string, cb func(int64, int64)) (target string, err error) {
logger.Println("start downloading", dir, urlpath)
defer func() {
if err != nil {
logger.Println("downloading failed :", err)
} else {
logger.Println("downloading succeeded")
}
}()
parsed, err := url.Parse(urlpath) parsed, err := url.Parse(urlpath)
if err != nil { if err != nil {
return "", err return "", err
} }
req, _ := http.NewRequest("GET", urlpath, nil) req, _ := http.NewRequest("GET", urlpath, nil)
if len(accessToken) > 0 {
req.Header.Add("Authorization", accessToken)
}
req.Header.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 Edg/111.0.1661.51") req.Header.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 Edg/111.0.1661.51")
req.Header.Add("As-X-UrlHash", accessToken)
resp, err := http.DefaultClient.Do(req) resp, err := http.DefaultClient.Do(req)
if err != nil { if err != nil {
return "", err return "", err
@ -44,18 +71,36 @@ func download(dir string, urlpath string, accessToken string) (string, error) {
return "", fmt.Errorf("download failed : %d %s", resp.StatusCode, parsed.Path) return "", fmt.Errorf("download failed : %d %s", resp.StatusCode, parsed.Path)
} }
out, err := os.Create(path.Join(dir, path.Base(parsed.Path))) out, err := os.Create(path.Join(dir, path.Base(filepath.ToSlash(parsed.Path))))
if err != nil { if err != nil {
return "", err return "", err
} }
defer out.Close() defer out.Close()
_, err = io.Copy(out, resp.Body) cl := resp.Header.Get("Content-Length")
if err != nil { totalLength, _ := strconv.ParseInt(cl, 10, 0)
return "", err totalWritten := int64(0)
chunkSize := pof2(totalLength/100, 1024*1024)
if cb != nil {
cb(0, totalLength)
} }
return out.Name(), nil for {
written, err := io.CopyN(out, resp.Body, chunkSize)
totalWritten += written
if cb != nil {
cb(totalWritten, totalLength)
}
if err != nil {
if err == io.EOF {
break
}
return "", err
}
}
return filepath.ToSlash(out.Name()), nil
} }
func unzip(fname string) error { func unzip(fname string) error {
@ -64,7 +109,10 @@ func unzip(fname string) error {
os.Remove(fname) os.Remove(fname)
return err return err
} }
defer archive.Close() defer func() {
archive.Close()
os.Remove(fname)
}()
verpath := path.Dir(fname) verpath := path.Dir(fname)
for _, f := range archive.File { for _, f := range archive.File {
@ -75,14 +123,16 @@ func unzip(fname string) error {
name = f.Name name = f.Name
} }
name = strings.ReplaceAll(name, `\`, "/")
filePath := path.Join(verpath, name) filePath := path.Join(verpath, name)
if f.FileInfo().IsDir() || strings.HasSuffix(f.FileInfo().Name(), `\`) {
if f.FileInfo().IsDir() { if err = os.MkdirAll(filePath, 0775); err != nil {
os.MkdirAll(filePath, os.ModePerm) return err
}
continue continue
} }
if err := os.MkdirAll(path.Dir(filePath), os.ModePerm); err != nil { if err := os.MkdirAll(path.Dir(filePath), 0775); err != nil {
return err return err
} }
@ -103,6 +153,7 @@ func unzip(fname string) error {
dstFile.Close() dstFile.Close()
fileInArchive.Close() fileInArchive.Close()
} }
return nil return nil
} }
@ -111,7 +162,10 @@ func untar(fname string) error {
if err != nil { if err != nil {
return err return err
} }
defer file.Close() defer func() {
file.Close()
os.Remove(fname)
}()
verpath := path.Dir(fname) verpath := path.Dir(fname)
tarReader := tar.NewReader(file) tarReader := tar.NewReader(file)
@ -126,7 +180,7 @@ func untar(fname string) error {
switch header.Typeflag { switch header.Typeflag {
case tar.TypeDir: case tar.TypeDir:
if err := os.MkdirAll(path.Join(verpath, header.Name), 0755); err != nil { if err := os.MkdirAll(path.Join(verpath, header.Name), 0775); err != nil {
return err return err
} }
case tar.TypeReg: case tar.TypeReg:
@ -143,6 +197,7 @@ func untar(fname string) error {
return errors.New("unknown type") return errors.New("unknown type")
} }
} }
return nil return nil
} }
@ -150,8 +205,9 @@ func (hc *houstonClient) prepareDeploy(name string, version string) (destPath st
// houston관리용임을 표시하기 위해 더미파일 생성 // houston관리용임을 표시하기 위해 더미파일 생성
defer func() { defer func() {
var flagf *os.File var flagf *os.File
if _, err := os.Stat(path.Join(name, "@houston")); os.IsNotExist(err) { markerPath := path.Join(hc.config.StorageRoot, name, "@houston")
flagf, err = os.Create(path.Join(name, "@houston")) if _, err := os.Stat(markerPath); os.IsNotExist(err) {
flagf, err = os.Create(markerPath)
if err != nil { if err != nil {
return return
} }
@ -160,10 +216,10 @@ func (hc *houstonClient) prepareDeploy(name string, version string) (destPath st
} }
}() }()
verpath := path.Join("./", name, version) verpath := path.Join(hc.config.StorageRoot, name, version)
if _, err := os.Stat(verpath); os.IsNotExist(err) { if _, err := os.Stat(verpath); os.IsNotExist(err) {
// 없네? 만들면 된다. // 없네? 만들면 된다.
err = os.MkdirAll(verpath, fs.FileMode(os.O_WRONLY)) err = os.MkdirAll(verpath, 0775)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -180,24 +236,63 @@ func (hc *houstonClient) prepareDeploy(name string, version string) (destPath st
return verpath, nil return verpath, nil
} }
func (hc *houstonClient) deploy(req *shared.DeployRequest) error { func (hc *houstonClient) makeDownloadUrl(rel string) string {
logger.Println("start deploying") out := rel
root, err := hc.prepareDeploy(req.Name, req.Version) if !strings.HasPrefix(out, "http") {
tks := strings.SplitN(hc.config.HttpAddress, "://", 2)
out = fmt.Sprintf("%s://%s", tks[0], path.Join(tks[1], rel))
}
return out
}
func copyfile(src, dst string) error {
fi, err := os.Stat(src)
if err != nil { if err != nil {
return err return err
} }
inmode := fi.Mode()
if !strings.HasPrefix(req.Url, "http") { in, err := os.Open(src)
tks := strings.SplitN(hc.httpAddr, "://", 2)
req.Url = fmt.Sprintf("%s://%s", tks[0], path.Join(tks[1], req.Url))
}
logger.Println("start downloading", req.Url)
// verpath에 배포 시작
fname, err := download(root, req.Url, req.AccessToken)
if err != nil { if err != nil {
return err return err
} }
defer in.Close()
out, err := os.Create(dst)
if err != nil {
return err
}
defer out.Close()
copied, err := io.Copy(out, in)
if err != nil {
return err
}
if copied < fi.Size() {
return errors.New("copy not completed")
}
if err := out.Sync(); err != nil {
return err
}
if err := out.Chmod(inmode); err != nil {
return err
}
return nil
}
func (hc *houstonClient) prepareUpdateSelf(req *shared.DeployRequest) (srcdir string, replacer string, err error) {
// 내가 스스로 업데이트
// 다운로드 받고 압축 푼 다음에 교체용 프로세스 시작
tempdir, err := os.MkdirTemp(os.TempDir(), "*")
if err != nil {
return "", "", err
}
fname, err := download(tempdir, hc.makeDownloadUrl(req.Url), req.AccessToken, nil)
if err != nil {
return "", "", err
}
switch path.Ext(fname) { switch path.Ext(fname) {
case ".zip": case ".zip":
@ -206,23 +301,90 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest) error {
err = untar(fname) err = untar(fname)
} }
if err != nil {
return "", "", err
}
// houston version 파일
err = os.WriteFile(path.Join(path.Dir(fname), "@version"), []byte(req.Version), 0644)
if err != nil {
return "", "", err
}
selfname, _ := os.Executable()
srcreplacer := path.Join(path.Dir(fname), "replacer") + path.Ext(selfname)
replacer = "./" + filepath.ToSlash("replacer"+path.Ext(selfname))
err = copyfile(srcreplacer, replacer)
if err == nil {
err = os.Chmod(replacer, 0775)
}
// replacer먼저 가져옴
return filepath.ToSlash(tempdir), replacer, err
}
func (hc *houstonClient) deploy(req *shared.DeployRequest, cb func(*protos.DeployingProgress)) error {
logger.Println("start deploying")
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) {
prog := protos.DeployingProgress{
State: "download",
Progress: written,
Total: total,
}
cb(&prog)
})
if err != nil {
return err
}
cb(&protos.DeployingProgress{
State: "unpack",
Progress: 0,
Total: 0,
})
switch path.Ext(fname) {
case ".zip":
err = unzip(fname)
case ".tar":
err = untar(fname)
}
if err == nil && len(req.Config) > 0 {
// config.json도 다운로드
h := md5.New()
h.Write([]byte(strings.Trim(req.Config, "/")))
at = hex.EncodeToString(h.Sum(nil))
_, err = download(root, hc.makeDownloadUrl(req.Config), at, nil)
}
return err return err
} }
func (hc *houstonClient) withdraw(req *shared.WithdrawRequest) error { func (hc *houstonClient) withdraw(req *shared.WithdrawRequest) error {
fd, _ := os.Stat(path.Join("./", req.Name, req.Version)) targetPath := path.Join(hc.config.StorageRoot, req.Name, req.Version)
fd, _ := os.Stat(targetPath)
if fd != nil { if fd != nil {
if fd.IsDir() { if fd.IsDir() {
for _, running := range hc.childProcs { for _, running := range hc.childProcs {
if running.name == req.Name && running.version == req.Version { if running.name == req.Name && (len(req.Version) == 0 || running.version == req.Version) {
// 회수하려는 버전이 돌고 있다 // 회수하려는 버전이 돌고 있다
if running.state != protos.ProcessState_Stopped {
return fmt.Errorf("withdraw failed. %s@%s is still running", req.Name, req.Version) return fmt.Errorf("withdraw failed. %s@%s is still running", req.Name, req.Version)
} }
} }
}
return os.RemoveAll(path.Join("./", req.Name, req.Version)) return os.RemoveAll(targetPath)
} }
} }

9
client/deploy_test.go Normal file
View File

@ -0,0 +1,9 @@
package client
import (
"testing"
)
func TestDownload(t *testing.T) {
}

185
client/houston_pipe_req.go Normal file
View File

@ -0,0 +1,185 @@
package client
import (
"archive/zip"
"bytes"
"crypto/aes"
"crypto/md5"
"encoding/base64"
"encoding/hex"
"errors"
"io"
"os"
"path/filepath"
"strings"
)
var pipeReqPrefix = []byte("houston_pipe_req")
var pipeReqHandle = map[string]func(hc *houstonClient, meta *procmeta, param string) error{
"upload": handleStdOutUploadRequest,
}
func HandleHoustonPipeReq(hc *houstonClient, meta *procmeta, buff []byte) (pipeRequest bool, retErr error) {
if !bytes.HasPrefix(buff, pipeReqPrefix) {
return false, nil // Not a pipe request
}
command, param, err := parsePipeReq(buff)
if err != nil {
return true, err
}
if handler, ok := pipeReqHandle[command]; ok {
if err := handler(hc, meta, param); err != nil {
return true, err
}
}
return true, nil
}
var pipeReqDelimeter = []byte("|")
var pipeReqKey = []byte{
0x77, 0x77, 0x71, 0x3c, 0x75, 0x64, 0x22, 0x54,
0x3e, 0x41, 0x27, 0x68, 0x39, 0x6e, 0x23, 0x49,
0x5f, 0x66, 0x71, 0x50, 0x32, 0x68, 0x53, 0x43,
0x72, 0x2f, 0x62, 0x39, 0x6e, 0x22, 0x27, 0x2d,
}
var errInvalidRequestBuff = errors.New("parsePipeReq got invalid request format")
func parsePipeReq(buff []byte) (command, param string, err error) {
//buff == "houston_pipe_req|EncryptString\r\n"
parts := bytes.Split(buff, pipeReqDelimeter)
if len(parts) != 2 {
return "", "", errInvalidRequestBuff
}
//Decrypt
decryptBuff, err := decryptPipeReq(parts[1])
if err != nil {
return "", "", err
}
//buff == houston_pipe_req|command|example_paramstring|MD5
//decryptBuff == command|example_paramstring|MD5
parts = bytes.Split(decryptBuff, pipeReqDelimeter)
if len(parts) != 3 {
return "", "", errInvalidRequestBuff
}
command = string(parts[0])
param = string(parts[1])
receivedHash := string(parts[2])
if err := validatePipeReq(command, param, receivedHash); err != nil {
return "", "", err
}
return command, param, nil
}
func decryptPipeReq(encordBuff []byte) ([]byte, error) {
decordBuff, err := base64.StdEncoding.DecodeString(string(encordBuff))
if err != nil {
return nil, err
}
if len(decordBuff)%aes.BlockSize != 0 {
return nil, errors.New("parsePipeReq got encrypted data which is not a multiple of the block size")
}
aesBlock, err := aes.NewCipher(pipeReqKey)
if err != nil {
return nil, err
}
decryptBuff := make([]byte, len(decordBuff))
for start := 0; start < len(decordBuff); start += aes.BlockSize {
aesBlock.Decrypt(decryptBuff[start:start+aes.BlockSize], decordBuff[start:start+aes.BlockSize])
}
return decryptBuff, nil
}
var errValidatePipeFail = errors.New("validatePipeReq fail to check validation of buff")
func validatePipeReq(command, param, receivedHash string) error {
//Decord receivedHash
receiveHashLen := md5.Size * 2
if len(receivedHash) < receiveHashLen {
return errValidatePipeFail
}
decordHash, err := hex.DecodeString(receivedHash[0:receiveHashLen])
if err != nil {
return err
}
//Generate md5 from command and param
var reqBuilder strings.Builder
reqBuilder.WriteString(command)
reqBuilder.Write(pipeReqDelimeter)
reqBuilder.WriteString(param)
buffHashWriter := md5.New()
buffHashWriter.Write([]byte(reqBuilder.String()))
buffHash := buffHashWriter.Sum(nil)
if !bytes.Equal(decordHash, buffHash) {
return errValidatePipeFail
}
return nil
}
func handleStdOutUploadRequest(hc *houstonClient, meta *procmeta, param string) error {
if uploadZipPath, err := compressFile(param); err != nil {
return err
} else {
hc.uploadToAppendFile(uploadZipPath, meta.name, meta.version, filepath.Base(uploadZipPath))
}
return nil
}
func compressFile(fullPath string) (string, error) {
ext := filepath.Ext(fullPath)
zipFullPath := fullPath[:len(fullPath)-len(ext)] + ".zip"
// Create
newZipFile, err := os.Create(zipFullPath)
if err != nil {
return "", err
}
defer newZipFile.Close()
zipWriter := zip.NewWriter(newZipFile)
defer zipWriter.Close()
// Open
fileToZip, err := os.Open(fullPath)
if err != nil {
return "", err
}
defer fileToZip.Close()
fileToZipInfo, err := fileToZip.Stat()
if err != nil {
return "", err
}
// Zip
fileToZipHeader, err := zip.FileInfoHeader(fileToZipInfo)
if err != nil {
return "", err
}
fileToZipHeader.Name = fileToZipInfo.Name()
fileToZipHeader.Method = zip.Deflate
fileToZipWriter, err := zipWriter.CreateHeader(fileToZipHeader)
if err != nil {
return "", err
}
_, err = io.Copy(fileToZipWriter, fileToZip)
if err != nil {
return "", err
}
// Remove
err = os.Remove(fullPath)
if err != nil {
return "", err
}
return zipFullPath, nil
}

View File

@ -2,23 +2,27 @@ package client
import ( import (
"archive/zip" "archive/zip"
"bufio"
"context" "context"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"io" "io"
"math"
"net/http" "net/http"
"os" "os"
"os/exec" "os/exec"
"path" "path"
"path/filepath" "path/filepath"
"regexp" "regexp"
"runtime/debug" "sort"
"strconv"
"strings"
"syscall" "syscall"
"time" "time"
"repositories.action2quare.com/ayo/go-ayo/logger" "github.com/Knetic/govaluate"
"repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/houston/shared" "repositories.action2quare.com/ayo/houston/shared"
"repositories.action2quare.com/ayo/houston/shared/protos" "repositories.action2quare.com/ayo/houston/shared/protos"
) )
@ -39,8 +43,52 @@ func lastExecutionArgs(verpath string) []string {
return out return out
} }
func (meta *procmeta) zipLogFiles(req *shared.UploadRequest, start, except string) (string, []string, error) { func (hc *houstonClient) uploadToAppendFile(filePath string, name string, version string, uploadedFileName string) {
root := path.Join(req.Name, req.Version) hc.uploadChan <- uploadRequest{
filePath: filePath,
name: name,
version: version,
uploadedFileName: uploadedFileName,
}
}
var errUploadZipLogFailed = errors.New("not ok")
func (hc *houstonClient) uploadZipLogFile(zipFile string, name string, version string) error {
zf, err := os.Open(zipFile)
if err != nil {
return err
}
if zf == nil {
return errUploadZipLogFailed
}
defer zf.Close()
req, err := http.NewRequest("POST", hc.config.HttpAddress+"/upload", zf)
if err != nil {
logger.Println(err)
}
req.Header.Set("Houston-Service-Name", name)
req.Header.Set("Houston-Service-Version", version)
req.Header.Set("Houston-Service-Filename", path.Base(filepath.ToSlash(zipFile)))
req.Header.Set("Content-Type", "application/zip")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return errUploadZipLogFailed
}
return nil
}
func zipLogFiles(storageRoot string, req *shared.UploadRequest) (string, []string, error) {
root := path.Join(storageRoot, req.Name, req.Version)
matches, err := filepath.Glob(path.Join(root, req.Filter)) matches, err := filepath.Glob(path.Join(root, req.Filter))
if err != nil { if err != nil {
return "", nil, err return "", nil, err
@ -50,9 +98,17 @@ func (meta *procmeta) zipLogFiles(req *shared.UploadRequest, start, except strin
return "", nil, nil return "", nil, nil
} }
for i, file := range matches {
file = filepath.ToSlash(file)
matches[i] = file
}
root = path.Join(root, path.Dir(req.Filter)) root = path.Join(root, path.Dir(req.Filter))
// Create a file to write the archive to. hostname, _ := os.Hostname()
f, err := os.CreateTemp("", "") zipFileName := path.Join(os.TempDir(), hostname+"_"+path.Base(filepath.ToSlash(matches[0]))) + ".zip"
os.Remove(zipFileName)
f, err := os.OpenFile(zipFileName, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
if err != nil { if err != nil {
return "", nil, err return "", nil, err
} }
@ -63,91 +119,195 @@ func (meta *procmeta) zipLogFiles(req *shared.UploadRequest, start, except strin
oldestFile := "" oldestFile := ""
for i, file := range matches { for i, file := range matches {
file = filepath.ToSlash(file)
matches[i] = file
if file == root { if file == root {
continue continue
} }
if file >= except {
break if fi, err := os.Lstat(file); err == nil {
} if (fi.Mode() & os.ModeSymlink) == os.ModeSymlink {
if len(start) > 0 && file < start { matches[i] = ""
continue continue
} }
}
if len(oldestFile) == 0 { if len(oldestFile) == 0 {
oldestFile = path.Base(file) oldestFile = path.Base(filepath.ToSlash(file))
} }
relative := file[len(root)+1:] relative := file[len(root)+1:]
fw, err := w.Create(relative) fw, err := w.Create(relative)
if err != nil { if err != nil {
logger.Error(err)
return "", nil, err return "", nil, err
} }
src, err := os.Open(file) src, err := os.Open(file)
if err != nil { if err != nil {
logger.Error(err)
return "", nil, err return "", nil, err
} }
defer src.Close() defer src.Close()
if _, err = io.Copy(fw, src); err != nil { if _, err = io.Copy(fw, src); err != nil {
logger.Error(err)
return "", nil, err return "", nil, err
} }
} }
return f.Name(), matches, nil return f.Name(), matches, nil
// defer func() {
// tempname := f.Name()
// f.Close()
// resp, _ := http.Post(req.Url, "application/zip", f)
// if resp != nil && resp.Body != nil {
// resp.Body.Close()
// }
// os.Remove(tempname)
// if del, err := strconv.ParseBool(req.DeleteAfterUploaded); del && err == nil {
// for _, file := range matches {
// if strings.HasSuffix(file, except) {
// continue
// }
// os.Remove(file)
// }
// }
// }()
// Create a new zip archive.
//}(f)
//return nil
} }
func prepareProcessLaunch(req *shared.StartProcessRequest) *procmeta { func prepareProcessLaunch(storageRoot string, req *shared.StartProcessRequest) (*procmeta, error) {
re := regexp.MustCompile(`[^\s"']+|"([^"]*)"|'([^']*)`) if len(req.Args) == 0 {
args := re.FindAllString(req.Args, -1) return nil, errors.New("args is empty")
}
verpath := path.Join("./", req.Name, req.Version) if req.Version == "latest" {
entries, err := os.ReadDir(path.Join(storageRoot, req.Name))
if err != nil {
return nil, err
}
var latestTimestamp time.Time
var latestVersion string
for _, entry := range entries {
if !entry.IsDir() {
continue
}
fi, err := entry.Info()
if err != nil {
return nil, err
}
createTime := fi.ModTime()
if latestTimestamp.Before(createTime) {
latestTimestamp = fi.ModTime()
latestVersion = fi.Name()
}
}
if len(latestVersion) > 0 {
req.Version = latestVersion
}
}
verpath := path.Join(storageRoot, req.Name, req.Version)
fi, err := os.Stat(verpath) fi, err := os.Stat(verpath)
if err != nil {
return nil, err
}
if fi.IsDir() {
exefile := "./" + path.Clean(strings.TrimPrefix(req.Args[0], "/"))
os.Chmod(path.Join(verpath, exefile), 0777)
exef, _ := os.Executable()
expanded := make([]string, len(req.Args))
for i, arg := range req.Args {
expanded[i] = os.ExpandEnv(arg)
}
exename := path.Join(path.Dir(strings.ReplaceAll(exef, "\\", "/")), verpath, exefile)
logger.Println("exefile :", exefile)
logger.Println("verpath :", verpath)
logger.Println("exef :", exef)
logger.Println("path.Dir :", path.Dir(exef))
logger.Println("exename :", exename)
cmd := exec.Command(os.ExpandEnv(exename), expanded[1:]...)
if err == nil && fi.IsDir() {
cmd := exec.Command("./"+args[0], args[1:]...)
cmd.Dir = verpath cmd.Dir = verpath
stdin, _ := cmd.StdinPipe() stdin, _ := cmd.StdinPipe()
seq++
return &procmeta{ return &procmeta{
id: seq,
cmd: cmd, cmd: cmd,
name: req.Name, name: req.Name,
args: req.Args,
version: req.Version, version: req.Version,
state: protos.ProcessState_Stopped, verpath: verpath,
state: int32(protos.ProcessState_Stopped),
stdin: stdin, stdin: stdin,
logUploadChan: make(chan *shared.UploadRequest), }, nil
buffers: bufferStack{cursor: 0}, }
return nil, errors.New("not found")
}
func makeLogFilePrefix(meta *procmeta, index int) string {
now := time.Now().UTC()
ext := path.Ext(meta.args[0])
nameonly := path.Base(filepath.ToSlash(meta.args[0]))
if len(ext) > 0 {
nameonly = nameonly[:len(nameonly)-len(ext)]
}
ts := now.Format("2006-01-02T15-04-05")
if index == 0 {
return path.Join(meta.verpath, "logs", fmt.Sprintf("%s_%s", nameonly, ts))
}
return path.Join(meta.verpath, "logs", fmt.Sprintf("%s_%d_%s", nameonly, index, ts))
}
func evaluateExpression(expression string, params map[string]any) (any, error) {
expression = strings.TrimSpace(expression)
expr, err := govaluate.NewEvaluableExpression(expression)
if err != nil {
return 0, err
}
return expr.Evaluate(params)
}
func evaluateArgs(args []string, params map[string]any) ([]string, error) {
re := regexp.MustCompile(`\$\(\((.*?)\)\)`)
for i, input := range args {
matches := re.FindAllStringSubmatch(input, -1)
if len(matches) == 0 {
continue
}
for _, match := range matches {
if len(match) > 1 {
expression := strings.TrimSpace(match[1])
expr, err := govaluate.NewEvaluableExpression(expression)
if err != nil {
return nil, err
}
result, err := expr.Evaluate(params)
if err != nil {
return nil, err
}
// 원래 표현식을 결과로 대체
input = strings.Replace(input, match[0], fmt.Sprintf("%v", result), -1)
} }
} }
return nil
args[i] = input
}
return args, nil
}
func parseEnv(input []string) map[string]any {
output := make(map[string]any, len(input))
for _, envkv := range input {
kv := strings.SplitN(envkv, "=", 2)
parsed, err := strconv.ParseInt(kv[1], 10, 0)
if err == nil {
output[kv[0]] = parsed
} else {
parsed, err := strconv.ParseFloat(kv[1], 32)
if err == nil {
output[kv[0]] = parsed
} else {
output[kv[0]] = kv[1]
}
}
}
return output
} }
func (hc *houstonClient) launch(meta *procmeta) error { func (hc *houstonClient) launch(meta *procmeta) error {
@ -155,315 +315,301 @@ func (hc *houstonClient) launch(meta *procmeta) error {
if err != nil { if err != nil {
return err return err
} }
stderr, err := meta.cmd.StderrPipe()
err = os.MkdirAll(path.Join(meta.verpath, "logs"), 0775)
if err != nil { if err != nil {
return err return err
} }
err = os.MkdirAll(path.Join(meta.cmd.Dir, "logs"), os.ModePerm) stdReader := func(r io.ReadCloser, index int) {
if err != nil {
return err
}
relayChan := make(chan struct {
size int
buf []byte
})
go func() {
defer func() { defer func() {
r := recover() reco := recover()
if r != nil { if reco != nil {
logger.Println(r) logger.Println(reco)
debug.PrintStack()
} }
close(relayChan)
hc.exitChan <- meta.cmd
}() }()
now := time.Now().UTC() defer func() {
ext := path.Ext(meta.cmd.Args[0]) overflow := index / 64
nameonly := path.Base(meta.cmd.Args[0]) offset := index % 64
if len(ext) > 0 { key := fmt.Sprintf("%s-%d", meta.args[0], overflow)
nameonly = nameonly[:len(nameonly)-len(ext)] runningFlags := hc.siblingProcIndex[key]
} mask := uint64(1 << offset)
ts := now.Format("2006-01-02T15-04-05") runningFlags = runningFlags ^ mask
stdPrefix := path.Join(meta.cmd.Dir, "logs", fmt.Sprintf("%s_%s", nameonly, ts)) hc.siblingProcIndex[key] = runningFlags
logfile, _ := os.Create(stdPrefix + "_0.log") }()
defer logfile.Close()
logfileIdx := 0 defer r.Close()
for {
reader := bufio.NewReader(r)
thisFileSize := 0 thisFileSize := 0
switchToNextFile := func() string { logFileIndex := 0
logfileIdx++
nextFile := fmt.Sprintf("%s_%d.log", stdPrefix, logfileIdx)
if nextLogfile, err := os.Create(nextFile); err == nil {
logfile.Close()
logfile = nextLogfile
}
thisFileSize = 0
return nextFile
}
uploadStartFile := "" logFileNamePrefix := makeLogFilePrefix(meta, index)
select { logFileName := fmt.Sprintf("%s_%d.log", logFileNamePrefix, logFileIndex)
case req := <-meta.logUploadChan: targetFile, err := os.Create(logFileName)
nextFile := switchToNextFile()
startFile := uploadStartFile
uploadStartFile = nextFile
go func(startFile, nextFile string) {
zipFile, srcFiles, err := meta.zipLogFiles(req, startFile, nextFile)
if err == nil && len(zipFile) > 0 && len(srcFiles) > 0 {
zf, _ := os.Open(zipFile)
if zf != nil {
req, err := http.NewRequest("POST", hc.httpAddr+"/upload", zf)
if err != nil { if err != nil {
logger.Error(err) logger.Println("failed to create log file :", logFileName)
}
req.Header.Set("Houston-Service-Name", meta.name)
req.Header.Set("Houston-Service-Version", meta.version)
req.Header.Set("Houston-Service-Filename", path.Base(srcFiles[0])+".zip")
req.Header.Set("Content-Type", "application/zip")
resp, err := http.DefaultClient.Do(req)
if err == nil {
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
for _, oldf := range srcFiles {
os.Remove(oldf)
}
}
}
}
}
}(startFile, nextFile)
case bt := <-relayChan:
if bt.buf == nil {
return return
} }
logfile.Write(bt.buf[:bt.size])
meta.buffers.push(bt.buf) exef, _ := os.Executable()
thisFileSize += bt.size var linkPath string
if thisFileSize > 1024*1024 { if index == 0 {
switchToNextFile() linkPath = path.Join(path.Dir(exef), path.Dir(logFileName), meta.name+".log")
} } else {
linkPath = path.Join(path.Dir(exef), path.Dir(logFileName), fmt.Sprintf("%s_%d.log", meta.name, index))
} }
os.Remove(linkPath)
os.Symlink(path.Base(filepath.ToSlash(targetFile.Name())), linkPath)
defer func() {
if targetFile != nil {
targetFile.Close()
} }
}() }()
stdReader := func(r io.Reader) {
defer func() { defer func() {
recover() logger.Println("stdReader is terminated :", meta.name)
stdout.Close() if meta.isState(protos.ProcessState_Running) {
hc.operationChan <- &protos.OperationQueryResponse{
Operation: string(shared.Exception),
Args: map[string]string{
"id": fmt.Sprintf("%d", meta.id),
},
}
}
}() }()
for { for {
buff := meta.buffers.pop() buff, err := reader.ReadBytes('\n')
size, err := r.Read(buff)
if err != nil { if err != nil {
relayChan <- struct { logger.Println("ReadBytes at stdReader return err :", err, meta.name)
size int
buf []byte
}{buf: nil}
break break
} }
if size > 0 {
relayChan <- struct { for written := 0; written < len(buff); {
size int n, err := targetFile.Write(buff)
buf []byte if err != nil {
}{size: size, buf: buff} logger.Println("write log file failed :", logFileName, err)
break
} else {
written += n
thisFileSize += n
}
}
if thisFileSize > 5*1024*1024 {
logFileIndex++
logFileName = fmt.Sprintf("%s_%d.log", logFileNamePrefix, logFileIndex)
nextTargetFile, err := os.Create(logFileName)
if err != nil {
logger.Println("failed to create log file :", logFileName)
} else {
targetFile.Close()
targetFile = nextTargetFile
os.Remove(linkPath)
os.Symlink(path.Base(filepath.ToSlash(targetFile.Name())), linkPath)
thisFileSize = 0
}
} }
} }
} }
go stdReader(stderr) index := 0
go stdReader(stdout) for overflow := 0; ; overflow++ {
key := fmt.Sprintf("%s-%d", meta.args[0], overflow)
runningFlags := hc.siblingProcIndex[key]
if runningFlags == math.MaxUint64 {
index += 64
} else {
for si := 0; si < 64; si++ {
mask := uint64(1 << si)
if runningFlags&mask == 0 {
index += si
runningFlags |= mask
break
}
}
hc.siblingProcIndex[key] = runningFlags
break
}
}
go stdReader(stdout, index)
meta.cmd.Env = append(os.Environ(), fmt.Sprintf("HOUSTON_SIBLIING_INDEX=%d", index))
meta.cmd.Args, err = evaluateArgs(meta.cmd.Args, parseEnv(meta.cmd.Env))
if err != nil {
logger.Println("evaluateArgs failed :", err)
return err
}
logger.Println("startChildProcess :", meta.cmd.Args)
err = meta.cmd.Start() err = meta.cmd.Start()
if err == nil { if err == nil {
meta.state = protos.ProcessState_Running logger.Println("process index, pid =", index, meta.cmd.Process.Pid)
set_affinity(meta.cmd.Process.Pid, index)
meta.setState(protos.ProcessState_Running)
} }
return err return err
} }
func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest) error { func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest) error {
logger.Println("startChildProcess :", *req) meta, err := prepareProcessLaunch(hc.config.StorageRoot, req)
if req.Version == "latest" {
// 최신 버전을 찾음
latest, err := shared.FindLastestVersion(path.Join("./", req.Name))
if err != nil { if err != nil {
return err return err
} }
req.Version = latest
}
meta := prepareProcessLaunch(req)
if err := hc.launch(meta); err != nil { if err := hc.launch(meta); err != nil {
return err return err
} }
// launch가 성공하면 args 저장. this and parent folder // launch가 성공하면 args 저장. this and parent folder
if argfile, err := os.Create(path.Join(req.Name, "@args")); err == nil { vers := hc.deploys[req.Name]
for _, ver := range vers {
if ver.Version == req.Version {
ver.Args = meta.args
}
}
if argfile, err := os.Create(path.Join(hc.config.StorageRoot, req.Name, "@args")); err == nil {
enc := json.NewEncoder(argfile) enc := json.NewEncoder(argfile)
enc.Encode(meta.cmd.Args) enc.Encode(req.Args)
argfile.Close() argfile.Close()
} }
if argfile, err := os.Create(path.Join(req.Name, req.Version, "@args")); err == nil { if argfile, err := os.Create(path.Join(hc.config.StorageRoot, req.Name, req.Version, "@args")); err == nil {
enc := json.NewEncoder(argfile) enc := json.NewEncoder(argfile)
enc.Encode(meta.cmd.Args) enc.Encode(req.Args)
argfile.Close() argfile.Close()
} }
hc.childProcs = append(hc.childProcs, meta) hc.childProcs = append(hc.childProcs, meta)
op := protos.NewOperationClient(hc.client)
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
return nil return nil
} }
var errNoRunningProcess = errors.New("no running processed") func (hc *houstonClient) stopChildProcess(req *shared.StopProcessRequest, op protos.OperationClient) error {
killer := func(proc *procmeta) {
func (hc *houstonClient) stopChildProcess(req *shared.StopProcessRequest) error { proc.setState(protos.ProcessState_Stopping)
if req.Version == "latest" { if err := proc.cmd.Process.Signal(syscall.SIGTERM); err != nil {
// 최신 버전을 찾음 proc.cmd.Process.Signal(os.Kill)
latest, err := shared.FindLastestVersion(path.Join("./", req.Name))
if err != nil {
return err
} }
req.Version = latest go func() {
proc.cmd.Wait()
hc.operationChan <- &protos.OperationQueryResponse{
Operation: string(shared.Exception),
Args: map[string]string{
"id": fmt.Sprintf("%d", proc.id),
},
}
}()
} }
var remains []*procmeta
var killing []*procmeta
for _, proc := range hc.childProcs { for _, proc := range hc.childProcs {
if proc.state != protos.ProcessState_Running { if !proc.isState(protos.ProcessState_Running) {
continue continue
} }
if req.Pid != 0 { if req.Pid != 0 {
if req.Pid == int32(proc.cmd.Process.Pid) { if req.Pid == int32(proc.cmd.Process.Pid) {
// 해당 pid만 제거 // 해당 pid만 제거
killing = append(killing, proc) killer(proc)
} else {
remains = append(remains, proc)
} }
} else if proc.name == req.Name { } else if proc.name == req.Name {
if len(req.Version) == 0 { if len(req.Version) == 0 {
// program 다 정지 // program 다 정지
killing = append(killing, proc) killer(proc)
} else if req.Version == proc.version { } else if req.Version == proc.version {
// program의 특정 버전만 정지 // program의 특정 버전만 정지
killing = append(killing, proc) killer(proc)
} else {
// 해당 사항 없음
remains = append(remains, proc)
}
} else {
// 해당 사항 없음
remains = append(remains, proc)
} }
} }
if len(killing) > 0 {
for _, proc := range killing {
if err := proc.cmd.Process.Signal(syscall.SIGTERM); err != nil {
proc.cmd.Process.Signal(os.Kill)
proc.state = protos.ProcessState_Stopping
} }
}
op := protos.NewOperationClient(hc.client)
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
for _, proc := range killing {
proc.cmd.Wait()
}
hc.childProcs = remains
op.Refresh(context.Background(), hc.makeOperationQueryRequest()) op.Refresh(context.Background(), hc.makeOperationQueryRequest())
return nil return nil
}
return errNoRunningProcess
} }
func (hc *houstonClient) restartChildProcess(req *shared.RestartProcessRequest) error { func (hc *houstonClient) restartChildProcess(req *shared.RestartProcessRequest, op protos.OperationClient) error {
if req.Version == "latest" {
// 최신 버전을 찾음
latest, err := shared.FindLastestVersion(path.Join("./", req.Name))
if err != nil {
return err
}
req.Version = latest
}
var restarts []*procmeta
for _, proc := range hc.childProcs { for _, proc := range hc.childProcs {
if proc.name == req.Name { if proc.cmd.Process.Pid == int(req.Pid) {
if len(req.Version) == 0 { if len(req.Config) > 0 {
restarts = append(restarts, proc) // config.json를 먼저 다운로드 시도
} else if req.Version == proc.version { root := proc.verpath
restarts = append(restarts, proc) if _, err := download(root, hc.makeDownloadUrl(req.Config), "", nil); err != nil {
}
}
}
if len(restarts) == 0 {
return errNoRunningProcess
}
for _, proc := range restarts {
if err := proc.cmd.Process.Signal(syscall.SIGTERM); err != nil {
proc.cmd.Process.Signal(os.Kill)
}
proc.state = protos.ProcessState_Stopping
}
op := protos.NewOperationClient(hc.client)
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
for _, proc := range restarts {
proc.cmd.Wait()
proc.state = protos.ProcessState_Stopped
}
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
for _, proc := range restarts {
if err := hc.launch(proc); err != nil {
return err return err
} }
} }
proc.setState(protos.ProcessState_Restart)
op.Refresh(context.Background(), hc.makeOperationQueryRequest()) op.Refresh(context.Background(), hc.makeOperationQueryRequest())
hc.exitChan <- proc.cmd
break
}
}
return nil return nil
} }
func (hc *houstonClient) uploadFiles(req *shared.UploadRequest) error { func (hc *houstonClient) uploadFiles(req *shared.UploadRequest) error {
if req.Version == "latest" { logger.Println("uploadFiles req :", *req)
// 최신 버전을 찾음
latest, err := shared.FindLastestVersion(path.Join("./", req.Name))
if err != nil {
return err
}
req.Version = latest
}
for _, child := range hc.childProcs { for _, child := range hc.childProcs {
if child.version == req.Version && child.name == req.Name { if child.version == req.Version && child.name == req.Name {
child.logUploadChan <- req logger.Println("uploadFiles found :", child.version, child.name)
break
go func() {
zipFile, srcFiles, err := zipLogFiles(hc.config.StorageRoot, req)
if err == nil && len(zipFile) > 0 && len(srcFiles) > 0 {
if err = hc.uploadZipLogFile(zipFile, child.name, child.version); err == nil {
// 마지막거 빼고 삭제
if req.DeleteAfterUploaded == "true" {
for i := 0; i < len(srcFiles)-1; i++ {
os.Remove(srcFiles[i])
}
} else {
sort.StringSlice(srcFiles).Sort()
for i := 0; i < len(srcFiles)-1; i++ {
if len(srcFiles[i]) > 0 {
os.Remove(srcFiles[i])
}
}
}
} else {
logger.Println("uploadZipLogFile failed :", err)
}
} else if err != nil {
logger.Println("zipLogFiles failed :", err)
}
}()
return nil
} }
} }
// TODO : 실행 중이 아닌 폴더에서도 대상을 찾는다 // 실행 중이 아닌 폴더에서도 대상을 찾는다
// deploys // 전체 파일을 대상으로
zipFile, srcFiles, err := zipLogFiles(hc.config.StorageRoot, req)
if err == nil && len(zipFile) > 0 && len(srcFiles) > 0 {
if err = hc.uploadZipLogFile(zipFile, req.Name, req.Version); err == nil {
// 마지막거 빼고 삭제
sort.StringSlice(srcFiles).Sort()
for i := 0; i < len(srcFiles)-1; i++ {
if len(srcFiles[i]) > 0 {
os.Remove(srcFiles[i])
}
}
} else {
logger.Println("uploadZipLogFile failed :", err)
}
} else if err != nil {
logger.Println("zipLogFiles failed :", err)
}
return nil return nil
} }

View File

@ -0,0 +1,95 @@
package client
import (
"bufio"
"context"
"encoding/json"
"io"
"maps"
"strconv"
"strings"
"github.com/prometheus/client_golang/prometheus"
"repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/gocommon/metric"
)
type pipeListener struct {
config clientConfig
registry *prometheus.Registry
}
func run_metric_pipe_reader(config clientConfig, registry *prometheus.Registry, ctx context.Context) {
r := &pipeListener{
config: config,
registry: registry,
}
go r.listen(ctx)
}
type pipeReader struct {
handle io.ReadCloser
constLabels map[string]string
collector *metric.PrometheusCollector
}
func (l *pipeListener) startReader(r io.ReadCloser) {
reader := pipeReader{
handle: r,
constLabels: l.config.ConstLabels,
collector: metric.NewPrometheusCollector(l.config.MetricNamespace, l.registry),
}
defer func() {
reader.close(l.registry)
}()
scanner := bufio.NewScanner(r)
for scanner.Scan() {
reader.parseLine(scanner.Text())
}
}
func (r *pipeReader) close(registry *prometheus.Registry) {
registry.Unregister(r.collector)
r.handle.Close()
}
func (r *pipeReader) parseLine(line string) {
defer func() {
r := recover()
if r != nil {
logger.Println(r)
}
}()
switch line[0] {
case '{':
var desc metric.MetricDescription
if err := json.Unmarshal([]byte(line), &desc); err != nil {
logger.Println("unmarshal metric failed :", err, line)
return
}
if desc.ConstLabels == nil {
desc.ConstLabels = make(map[string]string)
}
maps.Copy(desc.ConstLabels, r.constLabels)
r.collector = r.collector.RegisterMetric(&desc)
default:
kv := strings.Split(line, ":")
if len(kv) != 2 {
return
}
if len(kv[1]) == 0 {
r.collector = r.collector.UnregisterMetric(kv[0])
} else {
if val, err := strconv.ParseFloat(kv[1], 64); err == nil {
r.collector.UpdateMetric(kv[0], val)
}
}
}
}

View File

@ -0,0 +1,40 @@
package client
import (
"context"
"os"
"golang.org/x/sys/unix"
"repositories.action2quare.com/ayo/gocommon/logger"
)
func (r *pipeListener) listen(ctx context.Context) {
mode := 0666 // 읽기/쓰기 권한
pipeName := "/tmp/" + r.config.MetricPipeName
os.Remove(pipeName)
if err := unix.Mkfifo(pipeName, uint32(mode)); err != nil {
logger.Println("mkfifo failed :", pipeName, err)
return
}
defer os.Remove(pipeName)
go func() {
// file에 쓰기 핸들을 하나 열고 ctx가 Done일 때 닫음. 이래야 reader가 계속 열려있게 됨
f, err := os.OpenFile(pipeName, os.O_WRONLY, 0)
if err != nil {
logger.Println(err)
return
}
<-ctx.Done()
f.Close()
}()
file, err := os.Open(pipeName)
if err != nil {
logger.Println("FIFO open error:", err)
return
}
r.startReader(file)
}

View File

@ -0,0 +1,35 @@
package client
import (
"context"
"strings"
"github.com/natefinch/npipe"
"repositories.action2quare.com/ayo/gocommon/logger"
)
func (r *pipeListener) listen(ctx context.Context) {
pipename := r.config.MetricPipeName
if !strings.HasPrefix(pipename, `\\.\pipe\`) {
pipename = `\\.\pipe\` + pipename
}
listener, err := npipe.Listen(pipename)
if err != nil {
logger.Println("metric pipe npipe.Listen failed :", err)
return
}
go func() {
<-ctx.Done()
logger.Println("listener close")
listener.Close()
}()
for {
if conn, err := listener.Accept(); err == nil {
go r.startReader(conn)
} else {
logger.Println("metric pipe listener.Accept failed :", err)
}
}
}

View File

@ -1 +1,12 @@
{} {
"houston" : {
"client" : {
"grpc_server_address" : "10.5.10.100:8080",
"http_server_address" : "https://kdcc.action2quare.com/houston"
},
"server" : {
"grpc_port" : 8080,
"storage_path" : "/data"
}
}
}

90
go.mod
View File

@ -1,28 +1,82 @@
module repositories.action2quare.com/ayo/houston module repositories.action2quare.com/ayo/houston
go 1.19 go 1.23.0
toolchain go1.24.4
require ( require (
github.com/cloudfoundry/gosigar v1.3.12 github.com/Knetic/govaluate v3.0.0+incompatible
github.com/shirou/gopsutil/v3 v3.23.4 github.com/djherbis/times v1.6.0
golang.org/x/text v0.9.0 golang.org/x/sys v0.31.0
google.golang.org/grpc v1.55.0 golang.org/x/text v0.23.0
google.golang.org/protobuf v1.30.0 google.golang.org/grpc v1.60.1
repositories.action2quare.com/ayo/go-ayo v0.0.0-20230521165809-09cee56768c5 google.golang.org/protobuf v1.36.1
repositories.action2quare.com/ayo/gocommon v0.0.0-20250701095003-d77fa2108add
) )
require ( require (
github.com/go-ole/go-ole v1.2.6 // indirect github.com/alecthomas/kingpin/v2 v2.4.0 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/beevik/ntp v1.4.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/dennwc/btrfs v0.0.0-20240418142341-0167142bde7a // indirect
github.com/dennwc/ioctl v1.0.0 // indirect
github.com/ema/qdisc v1.0.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/hashicorp/go-envparse v0.1.0 // indirect
github.com/hodgesds/perf-utils v0.7.0 // indirect
github.com/illumos/go-kstat v0.0.0-20210513183136-173c9b0a9973 // indirect
github.com/josharian/native v1.1.0 // indirect
github.com/jsimonetti/rtnetlink/v2 v2.0.2 // indirect
github.com/lufia/iostat v1.2.1 // indirect
github.com/mattn/go-xmlrpc v0.0.3 // indirect
github.com/mdlayher/ethtool v0.2.0 // indirect
github.com/mdlayher/genetlink v1.3.2 // indirect
github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
github.com/mdlayher/wifi v0.3.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/selinux v1.11.1 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/prometheus-community/go-runit v0.1.0 // indirect
github.com/prometheus/client_golang v1.20.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.2-0.20240603130017-1754b780536b // indirect
github.com/safchain/ethtool v0.5.10 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
howett.net/plist v1.0.1 // indirect
)
require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/golang/protobuf v1.5.3 // indirect github.com/golang/protobuf v1.5.3 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/golang/snappy v0.0.1 // indirect
github.com/onsi/gomega v1.18.1 // indirect github.com/klauspost/compress v1.17.9 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/natefinch/npipe v0.0.0-20160621034901-c1b8fa8bdcce
github.com/pires/go-proxyproto v0.7.0 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/prometheus/node_exporter v1.9.1
github.com/shoenig/go-m1cpu v0.1.5 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/stretchr/testify v1.10.0 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect github.com/xdg-go/scram v1.1.1 // indirect
golang.org/x/net v0.10.0 // indirect github.com/xdg-go/stringprep v1.0.3 // indirect
golang.org/x/sys v0.8.0 // indirect github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect go.mongodb.org/mongo-driver v1.11.6 // indirect
golang.org/x/crypto v0.36.0 // indirect
golang.org/x/net v0.37.0 // indirect
golang.org/x/sync v0.12.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect
) )

285
go.sum
View File

@ -1,152 +1,221 @@
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY=
github.com/cloudfoundry/gosigar v1.3.12 h1:kUvHg+O7DcYKpMSQEJFpNf9kJXLwATBJh5gBwcRxGqI= github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
github.com/cloudfoundry/gosigar v1.3.12/go.mod h1:OKmnKziBrg7zYdKJQ4fDW+B6Aqh/1Vy1StnjqiPEI3I= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/beevik/ntp v1.4.3 h1:PlbTvE5NNy4QHmA4Mg57n7mcFTmr1W1j3gcK7L1lqho=
github.com/beevik/ntp v1.4.3/go.mod h1:Unr8Zg+2dRn7d8bHFuehIMSvvUYssHMxW3Q5Nx4RW5Q=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/dennwc/btrfs v0.0.0-20240418142341-0167142bde7a h1:KfFsGLJFVdCXlySUkV2FmxNtmiztpJb6tV+XYBmmv8E=
github.com/dennwc/btrfs v0.0.0-20240418142341-0167142bde7a/go.mod h1:MYsOV9Dgsec3FFSOjywi0QK5r6TeBbdWxdrMGtiYXHA=
github.com/dennwc/ioctl v1.0.0 h1:DsWAAjIxRqNcLn9x6mwfuf2pet3iB7aK90K4tF16rLg=
github.com/dennwc/ioctl v1.0.0/go.mod h1:ellh2YB5ldny99SBU/VX7Nq0xiZbHphf1DrtHxxjMk0=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/djherbis/times v1.6.0 h1:w2ctJ92J8fBvWPxugmXIv7Nz7Q3iDMKNx9v5ocVH20c=
github.com/djherbis/times v1.6.0/go.mod h1:gOHeRAz2h+VJNZ5Gmc/o7iD9k4wW7NMVqieYCY99oc0=
github.com/ema/qdisc v1.0.0 h1:EHLG08FVRbWLg8uRICa3xzC9Zm0m7HyMHfXobWFnXYg=
github.com/ema/qdisc v1.0.0/go.mod h1:FhIc0fLYi7f+lK5maMsesDqwYojIOh3VfRs8EVd5YJQ=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/hashicorp/go-envparse v0.1.0 h1:bE++6bhIsNCPLvgDZkYqo3nA+/PFI51pkrHdmPSDFPY=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/hashicorp/go-envparse v0.1.0/go.mod h1:OHheN1GoygLlAkTlXLXvAdnXdZxy8JUweQ1rAXx1xnc=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/hodgesds/perf-utils v0.7.0 h1:7KlHGMuig4FRH5fNw68PV6xLmgTe7jKs9hgAcEAbioU=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/hodgesds/perf-utils v0.7.0/go.mod h1:LAklqfDadNKpkxoAJNHpD5tkY0rkZEVdnCEWN5k4QJY=
github.com/illumos/go-kstat v0.0.0-20210513183136-173c9b0a9973 h1:hk4LPqXIY/c9XzRbe7dA6qQxaT6Axcbny0L/G5a4owQ=
github.com/illumos/go-kstat v0.0.0-20210513183136-173c9b0a9973/go.mod h1:PoK3ejP3LJkGTzKqRlpvCIFas3ncU02v8zzWDW+g0FY=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA=
github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
github.com/jsimonetti/rtnetlink/v2 v2.0.2 h1:ZKlbCujrIpp4/u3V2Ka0oxlf4BCkt6ojkvpy3nZoCBY=
github.com/jsimonetti/rtnetlink/v2 v2.0.2/go.mod h1:7MoNYNbb3UaDHtF8udiJo/RH6VsTKP1pqKLUTVCvToE=
github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lufia/iostat v1.2.1 h1:tnCdZBIglgxD47RyD55kfWQcJMGzO+1QBziSQfesf2k=
github.com/lufia/iostat v1.2.1/go.mod h1:rEPNA0xXgjHQjuI5Cy05sLlS2oRcSlWHRLrvh/AQ+Pg=
github.com/mattn/go-xmlrpc v0.0.3 h1:Y6WEMLEsqs3RviBrAa1/7qmbGB7DVD3brZIbqMbQdGY=
github.com/mattn/go-xmlrpc v0.0.3/go.mod h1:mqc2dz7tP5x5BKlCahN/n+hs7OSZKJkS9JsHNBRlrxA=
github.com/mdlayher/ethtool v0.2.0 h1:akcA4WZVWozzirPASeMq8qgLkxpF3ykftVXwnrMKrhY=
github.com/mdlayher/ethtool v0.2.0/go.mod h1:W0pIBrNPK1TslIN4Z9wt1EVbay66Kbvek2z2f29VBfw=
github.com/mdlayher/genetlink v1.3.2 h1:KdrNKe+CTu+IbZnm/GVUMXSqBBLqcGpRDa0xkQy56gw=
github.com/mdlayher/genetlink v1.3.2/go.mod h1:tcC3pkCrPUGIKKsCsp0B3AdaaKuHtaxoJRz3cc+528o=
github.com/mdlayher/netlink v1.7.2 h1:/UtM3ofJap7Vl4QWCPDGXY8d3GIY2UGSDbK+QWmY8/g=
github.com/mdlayher/netlink v1.7.2/go.mod h1:xraEF7uJbxLhc5fpHL4cPe221LI2bdttWlU+ZGLfQSw=
github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U=
github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA=
github.com/mdlayher/wifi v0.3.1 h1:bZDuMI1f7z5BtUUO3NgHRdR/R88YtywIe6dsEFI0Txs=
github.com/mdlayher/wifi v0.3.1/go.mod h1:ODQaObvsglghTuNhezD9grkTB4shVNc28aJfTXmvSi8=
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/natefinch/npipe v0.0.0-20160621034901-c1b8fa8bdcce h1:TqjP/BTDrwN7zP9xyXVuLsMBXYMt6LLYi55PlrIcq8U=
github.com/natefinch/npipe v0.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:ifHPsLndGGzvgzcaXUvzmt6LxKT4pJ+uzEhtnMt+f7A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
github.com/opencontainers/selinux v1.11.1 h1:nHFvthhM0qY8/m+vfhJylliSshm8G1jJ2jDMcgULaH8=
github.com/opencontainers/selinux v1.11.1/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
github.com/pires/go-proxyproto v0.7.0 h1:IukmRewDQFWC7kfnb66CSomk2q/seBuilHBYFwyq0Hs=
github.com/pires/go-proxyproto v0.7.0/go.mod h1:Vz/1JPY/OACxWGQNIRY2BeyDmpoaWmEP40O9LbuiFR4=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/shirou/gopsutil/v3 v3.23.4 h1:hZwmDxZs7Ewt75DV81r4pFMqbq+di2cbt9FsQBqLD2o= github.com/prometheus-community/go-runit v0.1.0 h1:uTWEj/Fn2RoLdfg/etSqwzgYNOYPrARx1BHUN052tGA=
github.com/shirou/gopsutil/v3 v3.23.4/go.mod h1:ZcGxyfzAMRevhUR2+cfhXDH6gQdFYE/t8j1nsU4mPI8= github.com/prometheus-community/go-runit v0.1.0/go.mod h1:AvJ9Jo3gAFu2lbM4+qfjdpq30FfiLDJZKbQ015u08IQ=
github.com/shoenig/go-m1cpu v0.1.5 h1:LF57Z/Fpb/WdGLjt2HZilNnmZOxg/q2bSKTQhgbrLrQ= github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
github.com/shoenig/go-m1cpu v0.1.5/go.mod h1:Wwvst4LR89UxjeFtLRMrpgRiyY4xPsejnVZym39dbAQ= github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/shoenig/test v0.6.3 h1:GVXWJFk9PiOjN0KoJ7VrJGH6uLPnqxR7/fe3HUPfE0c= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/shoenig/test v0.6.3/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
github.com/prometheus/node_exporter v1.9.1 h1:5PIaixeIW9WYDAymngAK2Ucg3yHbnbG2Fz5VZuoMgj4=
github.com/prometheus/node_exporter v1.9.1/go.mod h1:g6tnkDIRSFw3/UI59KRExdfmqlkLK95qzpT3+wTXarE=
github.com/prometheus/procfs v0.15.2-0.20240603130017-1754b780536b h1:4EJkx3vycI+n5JY5ht+bnSUGamkmmXkpcNeO/OBT/0A=
github.com/prometheus/procfs v0.15.2-0.20240603130017-1754b780536b/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/safchain/ethtool v0.5.10 h1:Im294gZtuf4pSGJRAOGKaASNi3wMeFaGaWuSaomedpc=
github.com/safchain/ethtool v0.5.10/go.mod h1:w9jh2Lx7YBR4UwzLkzCmWl85UY0W2uZdd7/DckVE5+c=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= go.mongodb.org/mongo-driver v1.11.6 h1:XM7G6PjiGAO5betLF13BIa5TlLUUE3uJ/2Ox3Lz1K+o=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= go.mongodb.org/mongo-driver v1.11.6/go.mod h1:G9TgswdsWjX4tmDA5zfs2+6AEPpYJwqblyjsfuh8oXY=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211031064116-611d5d643895/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
repositories.action2quare.com/ayo/go-ayo v0.0.0-20230521165809-09cee56768c5 h1:EobNJQwZ/TyRRtXY9XhJslN80V+sKoAztsda3x+ISE0= howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM=
repositories.action2quare.com/ayo/go-ayo v0.0.0-20230521165809-09cee56768c5/go.mod h1:3gLLbyiq4cOEraSiY6wpYWdcWRPcQKIcs0TfQ/Vwhoc= howett.net/plist v1.0.1/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
repositories.action2quare.com/ayo/gocommon v0.0.0-20250625075907-b6e187a0a747 h1:SJRRWoTKSj9hjzbEyKG55wW2YAHdxiT4cqLl1fJda9Y=
repositories.action2quare.com/ayo/gocommon v0.0.0-20250625075907-b6e187a0a747/go.mod h1:q64I6gqlD61qwi9FfuPkwqy6Z6uzSHdcEjoHAJC27gQ=
repositories.action2quare.com/ayo/gocommon v0.0.0-20250701095003-d77fa2108add h1:V5XUI79yK4KPukSWkxJWgx4PsiejQTjoufiglZh2m7I=
repositories.action2quare.com/ayo/gocommon v0.0.0-20250701095003-d77fa2108add/go.mod h1:q64I6gqlD61qwi9FfuPkwqy6Z6uzSHdcEjoHAJC27gQ=

4
houston.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
nohup ./houston -client -logfile > /dev/null &

View File

@ -1,20 +1,16 @@
package houston_test package main
import ( import (
"fmt"
"path"
"testing" "testing"
"time"
"repositories.action2quare.com/ayo/houston/client"
) )
func TestOperationServer(t *testing.T) { func TestOperationServer(t *testing.T) {
hc, _ := client.NewClient("localhost:8080", "http://localhost/commandcenter") fmt.Println(path.Join("a", "b", "/"))
for i := 0; ; i++ { fmt.Println(path.Join("a", "b/"))
hc.SetReportMetrics(map[string]float32{ fmt.Println(path.Join("a", "b/", "/"))
"count": float32(i), fmt.Println(path.Join("a", "b/", "/", "/"))
})
time.Sleep(1300 * time.Millisecond)
}
// token, _ := getMicrosoftAuthoizationToken("30330e18-f407-4e35-a6d6-b734b9fe9ee9", "VTr8Q~VBAUAOSmFiHM~bjgszYXBm9nuGBQCk8cLq") // token, _ := getMicrosoftAuthoizationToken("30330e18-f407-4e35-a6d6-b734b9fe9ee9", "VTr8Q~VBAUAOSmFiHM~bjgszYXBm9nuGBQCk8cLq")
//go func() { //go func() {

45
main_client.go Normal file
View File

@ -0,0 +1,45 @@
//go:build client
package main
import (
"context"
"time"
"repositories.action2quare.com/ayo/gocommon/flagx"
"repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/houston/client"
"net/http"
)
func main() {
flagx.Parse()
hc, err := client.NewClient(true)
if err != nil {
panic(err)
}
http.Handle("/metrics", hc.MetricHandler())
server := &http.Server{Addr: ":9200", Handler: nil}
go func() {
defer func() {
logger.Println("metric server shutdown")
r := recover()
if r != nil {
logger.Println(r)
}
}()
logger.Println("metric server start")
if err := server.ListenAndServe(); err != nil {
logger.Println("metric server cannot listen :", err)
}
}()
hc.Start()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
server.Shutdown(ctx)
cancel()
}

15
main_server.go Normal file
View File

@ -0,0 +1,15 @@
//go:build !client
package main
import (
"repositories.action2quare.com/ayo/gocommon/flagx"
"repositories.action2quare.com/ayo/houston/server"
)
func main() {
flagx.Parse()
svr := server.NewServer()
svr.Start()
}

31
make_houston_package.ps1 Normal file
View File

@ -0,0 +1,31 @@
# $ErrorActionPreference = 'SilentlyContinue'
del houston.zip
$Env:GOOS="linux"
$Env:GOARCH="amd64"
# go get repositories.action2quare.com/ayo/gocommon
# go mod tidy
go build -ldflags="-s -w" -tags=client .
cp houston .\replacer\houston
cp config.json .\replacer\config.json
cp houston.sh .\replacer\houston.sh
cd replacer
go build -ldflags="-s -w" .
Compress-Archive -Path replacer -DestinationPath houston.zip -Force
Compress-Archive -Path config.json -Update -DestinationPath houston.zip
Compress-Archive -Path houston -Update -DestinationPath houston.zip
Compress-Archive -Path houston.sh -Update -DestinationPath houston.zip
del houston
del config.json
del replacer
del houston.sh
mv houston.zip ..\houston.zip
cd ..

View File

@ -5,6 +5,7 @@ import "protos/empty.proto";
service Operation { service Operation {
rpc Query(stream OperationQueryRequest) returns (stream OperationQueryResponse) {} rpc Query(stream OperationQueryRequest) returns (stream OperationQueryResponse) {}
rpc Refresh(OperationQueryRequest) returns (Empty) {} rpc Refresh(OperationQueryRequest) returns (Empty) {}
rpc ReportDeployingProgress(DeployingProgress) returns (Empty) {}
} }
message VersionAndArgs { message VersionAndArgs {
@ -19,6 +20,9 @@ message DeployedVersions {
message OperationQueryRequest { message OperationQueryRequest {
string hostname = 1; string hostname = 1;
string public_ip = 4;
string private_ip =5;
repeated ProcessDescription procs = 2; repeated ProcessDescription procs = 2;
repeated DeployedVersions deploys = 3; repeated DeployedVersions deploys = 3;
} }
@ -27,7 +31,8 @@ enum ProcessState {
Stopped = 0; Stopped = 0;
Stopping = 1; Stopping = 1;
Running = 2; Running = 2;
Error = 3; Restart = 3;
Error = 4;
} }
message ProcessDescription { message ProcessDescription {
@ -36,11 +41,18 @@ message ProcessDescription {
string version = 3; string version = 3;
ProcessState state = 4; ProcessState state = 4;
int32 pid = 5; int32 pid = 5;
int32 stdout_size = 6;
int32 stderr_size = 7;
} }
message OperationQueryResponse { message OperationQueryResponse {
string operation = 1; string operation = 1;
map<string, string> args = 2; map<string, string> args = 2;
} }
message DeployingProgress {
string hostname = 1;
string name = 2;
string version = 3;
string state = 4;
int64 progress = 5;
int64 total = 6;
}

113
replacer/main.go Normal file
View File

@ -0,0 +1,113 @@
package main
import (
"encoding/json"
"errors"
"io"
"log"
"os"
"os/exec"
"path"
"time"
)
func copy(src, dst string, stdlog *log.Logger) error {
fi, err := os.Stat(src)
if err != nil {
return err
}
if fi.IsDir() {
entries, _ := os.ReadDir(src)
for _, ent := range entries {
if err := copy(path.Join(src, ent.Name()), path.Join(dst, ent.Name()), stdlog); err != nil {
return err
}
}
return nil
}
inmode := fi.Mode()
in, err := os.Open(src)
if err != nil {
return err
}
defer in.Close()
out, err := os.Create(dst)
if err != nil {
return err
}
defer out.Close()
copied, err := io.Copy(out, in)
if err != nil {
return err
}
if copied < fi.Size() {
return errors.New("copy not completed")
}
if err := out.Sync(); err != nil {
return err
}
if err := out.Chmod(inmode); err != nil {
return err
}
stdlog.Println("file copied :", src, dst)
return nil
}
func main() {
logfile, _ := os.OpenFile("replacer.log", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666)
defer logfile.Close()
stdlog := log.New(logfile, "", log.LstdFlags)
args := os.Args
// args[1] : 나를 시작한 pid. pid가 종료될 때 까지 기다림
// args[2] : target 폴더
// args[3:] : 다시 시작할 때 넘겨줄 arguments(프로세스 이름 포함)
stdlog.Println(args)
for {
stdlog.Println("wait for terminating of", args[3])
cmd := exec.Command("ps", "-p", args[1])
if err := cmd.Run(); err != nil {
break
}
time.Sleep(time.Second)
}
stdlog.Println("target is terminated")
// replacer 제거. 내가 돌고 있으므로 복사는 안된다.
// 내가 실행되기 전에 이미 복사가 되서 나는 최신 버전임
os.Remove(path.Join(args[2], os.Args[0]))
if err := copy(args[2], "", stdlog); err != nil {
stdlog.Fatal(err)
}
nextArgs := args[4:]
if bt, _ := os.ReadFile("@args"); len(bt) > 0 {
var tempArgs []string
if json.Unmarshal(bt, &tempArgs) == nil {
nextArgs = tempArgs
}
}
os.Remove("@args")
err := os.RemoveAll(args[2])
if err != nil {
stdlog.Println("os.RemoveAll failed :", args[2], err)
}
err = os.Chmod(args[3], 0775)
if err != nil {
stdlog.Println("os.Chmod failed :", err)
}
stdlog.Println("exec.Command :", args)
cmd := exec.Command(args[3], nextArgs...)
cmd.Start()
}

View File

@ -2,38 +2,82 @@ package server
import ( import (
"encoding/json" "encoding/json"
"errors"
"fmt"
"io" "io"
"io/fs"
"net/http" "net/http"
"os" "os"
"path" "path"
"regexp"
"strconv" "strconv"
"strings"
"time" "time"
"repositories.action2quare.com/ayo/go-ayo/logger" "repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/houston/shared" "repositories.action2quare.com/ayo/houston/shared"
) )
/*
*
현재 접속 중인 Agent 목록을 보여줍니다.
- http method : GET
*/
const (
sub_folder_name_deploys = string("_deploys")
sub_folder_name_downloads = string("_downloads")
)
func (h *houstonHandler) GetAgents(w http.ResponseWriter, r *http.Request) { func (h *houstonHandler) GetAgents(w http.ResponseWriter, r *http.Request) {
enc := json.NewEncoder(w) enc := json.NewEncoder(w)
enc.Encode(h.Operation().Hosts()) allHosts := h.Operation().Hosts()
enc.Encode(allHosts)
}
func readTagsFromFile(paths ...string) string {
raw, _ := os.ReadFile(path.Join(paths...))
if len(raw) > 0 {
tag := string(raw)
return strings.Trim(tag, "\n")
}
return ""
} }
func (h *houstonHandler) GetDeploySources(w http.ResponseWriter, r *http.Request) { func (h *houstonHandler) GetDeploySources(w http.ResponseWriter, r *http.Request) {
files, err := os.ReadDir("deploys") files, err := os.ReadDir(h.deployPath)
if err != nil { if err != nil {
logger.Error(err) logger.Println(err)
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
return return
} }
getVersions := func(name string) []string { getVersions := func(name string) []string {
var out []string vers, _ := os.ReadDir(path.Join(h.deployPath, name))
files, _ := os.ReadDir(path.Join("deploys", name)) mytags := readTagsFromFile(h.deployPath, name, "@tags")
for _, fd := range files { out := []string{
mytags,
}
for _, fd := range vers {
if fd.IsDir() { if fd.IsDir() {
out = append(out, fd.Name()) ver := fd.Name()
files, _ := os.ReadDir(path.Join(h.deployPath, name, ver))
vertags := readTagsFromFile(h.deployPath, name, ver, "@tags")
if len(files) > 0 {
for _, file := range files {
if strings.HasPrefix(file.Name(), "@") {
continue
}
downloadpath := path.Join(sub_folder_name_deploys, name, ver, file.Name())
ver = fmt.Sprintf("%s:%s", ver+mytags+vertags, downloadpath)
break
} }
} }
out = append(out, ver)
}
}
return out return out
} }
@ -57,7 +101,7 @@ func (h *houstonHandler) UploadDeploySource(w http.ResponseWriter, r *http.Reque
// </form> // </form>
file, header, err := r.FormFile("file") file, header, err := r.FormFile("file")
if err != nil { if err != nil {
logger.Error(err) logger.Println(err)
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
return return
} }
@ -65,7 +109,7 @@ func (h *houstonHandler) UploadDeploySource(w http.ResponseWriter, r *http.Reque
contents, err := io.ReadAll(file) contents, err := io.ReadAll(file)
if err != nil { if err != nil {
logger.Error(err) logger.Println(err)
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
return return
} }
@ -74,10 +118,21 @@ func (h *houstonHandler) UploadDeploySource(w http.ResponseWriter, r *http.Reque
name := r.FormValue("name") name := r.FormValue("name")
ext := path.Ext(header.Filename) ext := path.Ext(header.Filename)
// deploys 폴더는 파일시스템 서비스이므로 다운로드 가능 var filename string
filename := path.Join("deploys", name, version, name+ext)
if err = os.MkdirAll(path.Dir(filename), os.ModePerm); err != nil { if version == "config" {
logger.Error(err) filename = path.Join(h.deployPath, name, version, "config"+ext)
tags := readTagsFromFile(h.deployPath, name, version, "@tags")
if !strings.Contains(tags, "#hidden") {
tags = tags + "#hidden"
os.WriteFile(path.Join(h.deployPath, name, version, "@tags"), []byte(tags), 0644)
}
} else {
filename = path.Join(h.deployPath, name, version, name+ext)
}
if err = os.MkdirAll(path.Dir(filename), 0775); err != nil {
logger.Println(err)
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
return return
} }
@ -85,12 +140,75 @@ func (h *houstonHandler) UploadDeploySource(w http.ResponseWriter, r *http.Reque
// 파일 저장 // 파일 저장
err = os.WriteFile(filename, contents, 0644) err = os.WriteFile(filename, contents, 0644)
if err != nil { if err != nil {
logger.Error(err) logger.Println(err)
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
return return
} }
} }
func (h *houstonHandler) DeleteDeploySource(w http.ResponseWriter, r *http.Request) {
// <form action="/houston" method="post" enctype="multipart/form-data">
// <input type="text" name="name">
// <input type="text" name="version">
// </form>
version := r.FormValue("version")
name := r.FormValue("name")
if len(version) == 0 || len(name) == 0 {
w.WriteHeader(http.StatusBadRequest)
return
}
// deploys 폴더는 파일시스템 서비스이므로 다운로드 가능
targetpath := path.Join(h.deployPath, name, version)
if err := os.RemoveAll(targetpath); err != nil {
logger.Println("deleteDeploySource failed :", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
}
func (h *houstonHandler) findLastestConfigFile(name string) (string, error) {
logger.Println("findLastestConfigFile :", name)
configFiles, err := os.ReadDir(path.Join(h.deployPath, name, "config"))
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
return "", nil
}
logger.Println("findLastestConfigFile failed :", err)
return "", err
}
var cf fs.FileInfo
for _, file := range configFiles {
if file.IsDir() {
continue
}
if strings.HasPrefix(file.Name(), "config.") {
test, err := file.Info()
if err != nil {
return "", err
}
if cf == nil {
cf = test
} else if test.ModTime().After(cf.ModTime()) {
cf = test
}
}
}
if cf != nil {
logger.Println("findLastestConfigFile cf found :", cf.Name())
return path.Join(sub_folder_name_deploys, name, "config", cf.Name()), nil
}
logger.Println("findLastestConfigFile cf NOT found")
return "", nil
}
func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) { func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
// <form action="/houston" method="post" enctype="multipart/form-data"> // <form action="/houston" method="post" enctype="multipart/form-data">
// <input type="text" name="name"> // <input type="text" name="name">
@ -105,7 +223,7 @@ func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
var targets []string var targets []string
if len(traws) > 0 { if len(traws) > 0 {
if err := json.Unmarshal([]byte(traws), &targets); err != nil { if err := json.Unmarshal([]byte(traws), &targets); err != nil {
logger.Error(err) logger.Println(err)
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
return return
} }
@ -116,11 +234,11 @@ func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
return return
} }
relPath := path.Join("deploys", name, version) relPath := path.Join(h.deployPath, name, version)
files, err := os.ReadDir(relPath) files, err := os.ReadDir(relPath)
if err != nil { if err != nil {
logger.Error(err) logger.Println(err)
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusBadRequest)
return return
} }
@ -131,6 +249,10 @@ func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
continue continue
} }
if strings.HasPrefix(fd.Name(), "@") {
continue
}
fi, _ := fd.Info() fi, _ := fd.Info()
if fi.ModTime().After(latestTime) { if fi.ModTime().After(latestTime) {
latestFilename = fi.Name() latestFilename = fi.Name()
@ -142,11 +264,52 @@ func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
return return
} }
configPath, err := h.findLastestConfigFile(name)
if err != nil {
logger.Println(err)
w.WriteHeader(http.StatusBadRequest)
return
}
h.Operation().Deploy(MakeDeployRequest( h.Operation().Deploy(MakeDeployRequest(
shared.DeployRequest{ shared.DeployRequest{
Name: name, Name: name,
Version: version, Version: version,
Url: path.Join(relPath, latestFilename), Url: path.Join(sub_folder_name_deploys, name, version, latestFilename),
Config: configPath,
},
targets,
))
}
func (h *houstonHandler) Undeploy(w http.ResponseWriter, r *http.Request) {
// <form action="/houston" method="post" enctype="multipart/form-data">
// <input type="text" name="name">
// <input type="text" name="version">
// <input type="text" name="targets">
// </form>
name := r.FormValue("name")
version := r.FormValue("version")
traws := r.FormValue("targets")
var targets []string
if len(traws) > 0 {
if err := json.Unmarshal([]byte(traws), &targets); err != nil {
logger.Println(err)
w.WriteHeader(http.StatusBadRequest)
return
}
}
if len(name) == 0 || len(version) == 0 || len(targets) == 0 {
w.WriteHeader(http.StatusBadRequest)
return
}
h.Operation().Withdraw(MakeWithdrawRequest(
shared.WithdrawRequest{
Name: name,
Version: version,
}, },
targets, targets,
)) ))
@ -162,13 +325,13 @@ func (h *houstonHandler) StartProcess(w http.ResponseWriter, r *http.Request) {
// </form> // </form>
name := r.FormValue("name") name := r.FormValue("name")
version := r.FormValue("version") version := r.FormValue("version")
args := r.FormValue("args") argsline := r.FormValue("args")
traws := r.FormValue("targets") traws := r.FormValue("targets")
var targets []string var targets []string
if len(traws) > 0 { if len(traws) > 0 {
if err := json.Unmarshal([]byte(traws), &targets); err != nil { if err := json.Unmarshal([]byte(traws), &targets); err != nil {
logger.Error(err) logger.Println(err)
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
return return
} }
@ -179,6 +342,28 @@ func (h *houstonHandler) StartProcess(w http.ResponseWriter, r *http.Request) {
return return
} }
re := regexp.MustCompile(`[^\s"']+|"([^"]*)"|'([^']*)`)
argsTemp := re.FindAllString(argsline, -1)
var args []string
for _, arg := range argsTemp {
arg = strings.Trim(arg, "\n ")
if strings.HasPrefix(arg, `"`) && len(args) > 0 {
lastarg := args[len(args)-1]
if strings.HasSuffix(lastarg, "=") {
args[len(args)-1] = lastarg + arg
} else {
args = append(args, arg)
}
} else {
args = append(args, arg)
}
}
if len(args) == 0 {
w.WriteHeader(http.StatusBadRequest)
return
}
h.Operation().StartProcess(MakeStartProcessRequest(shared.StartProcessRequest{ h.Operation().StartProcess(MakeStartProcessRequest(shared.StartProcessRequest{
Name: name, Name: name,
Version: version, Version: version,
@ -207,7 +392,7 @@ func (h *houstonHandler) StopProcess(w http.ResponseWriter, r *http.Request) {
var targets []string var targets []string
if len(traws) > 0 { if len(traws) > 0 {
if err := json.Unmarshal([]byte(traws), &targets); err != nil { if err := json.Unmarshal([]byte(traws), &targets); err != nil {
logger.Error(err) logger.Println(err)
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
return return
} }
@ -220,6 +405,58 @@ func (h *houstonHandler) StopProcess(w http.ResponseWriter, r *http.Request) {
Version: version, Version: version,
Pid: int32(pid), Pid: int32(pid),
}, targets)) }, targets))
h.Operation().Upload(MakeUploadRequest(shared.UploadRequest{
Name: name,
Version: version,
Url: "upload",
DeleteAfterUploaded: "true",
}, targets))
}
func (h *houstonHandler) RestartProcess(w http.ResponseWriter, r *http.Request) {
// <form action="/houston" method="post" enctype="multipart/form-data">
// <input type="text" name="name">
// <input type="text" name="target">
// <input type="text" name="pid">
// <input type="text" name="config">
// </form>
pidstr := r.FormValue("pid")
target := r.FormValue("target")
name := r.FormValue("name")
if len(target) == 0 || len(pidstr) == 0 || len(name) == 0 {
w.WriteHeader(http.StatusBadRequest)
return
}
deployConfig := false
configstr := r.FormValue("config")
if len(configstr) > 0 {
deployConfig, _ = strconv.ParseBool(configstr)
}
pid, err := strconv.ParseInt(pidstr, 10, 0)
if err != nil {
logger.Println(err)
w.WriteHeader(http.StatusBadRequest)
return
}
var configPath string
if deployConfig {
configPath, err = h.findLastestConfigFile(name)
if err != nil {
logger.Println(err)
w.WriteHeader(http.StatusBadRequest)
return
}
}
h.Operation().RestartProcess(MakeRestartRequest(shared.RestartProcessRequest{
Name: name,
Pid: int32(pid),
Config: configPath,
}, []string{target}))
} }
func (h *houstonHandler) UploadLogs(w http.ResponseWriter, r *http.Request) { func (h *houstonHandler) UploadLogs(w http.ResponseWriter, r *http.Request) {
@ -244,7 +481,7 @@ func (h *houstonHandler) UploadLogs(w http.ResponseWriter, r *http.Request) {
} }
var targets []string var targets []string
if err := json.Unmarshal([]byte(traws), &targets); err != nil { if err := json.Unmarshal([]byte(traws), &targets); err != nil {
logger.Error(err) logger.Println(err)
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
return return
} }
@ -269,22 +506,50 @@ func (h *houstonHandler) GetLogFileLinks(w http.ResponseWriter, r *http.Request)
return return
} }
if version == "latest" { root := path.Join(h.downloadPath, name, version)
version, _ = shared.FindLastestVersion(path.Join("downloads", name))
}
root := path.Join("downloads", name, version)
logfiles, err := os.ReadDir(root) logfiles, err := os.ReadDir(root)
if err != nil { if err != nil {
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusBadRequest)
return return
} }
var out []string var out []string
for _, lf := range logfiles { for _, lf := range logfiles {
out = append(out, path.Join(root, lf.Name())) out = append(out, path.Join(sub_folder_name_downloads, name, version, lf.Name()))
} }
enc := json.NewEncoder(w) enc := json.NewEncoder(w)
enc.Encode(out) enc.Encode(out)
} }
func (h *houstonHandler) GetDemoFileLink(w http.ResponseWriter, r *http.Request) {
// <form action="/houston" method="post" enctype="multipart/form-data">
// <input type="text" name="name">
// <input type="text" name="version">
// <input type="text" name="filename">
// </form>
name := r.FormValue("name")
version := r.FormValue("version")
fileName := r.FormValue("filename")
logger.Println("GetDemoFileLink :", name, version, fileName)
if len(name) == 0 || len(version) == 0 || len(fileName) == 0 {
w.WriteHeader(http.StatusBadRequest)
return
}
demoFilePath := path.Join(h.downloadPath, name, version, fileName)
demoFileInfo, err := os.Stat(demoFilePath)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
return
}
out := []string{path.Join(sub_folder_name_downloads, name, version, demoFileInfo.Name())}
enc := json.NewEncoder(w)
enc.Encode(out)
}
func (h *houstonHandler) GetDeployingProgress(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(h.Operation().DeplyingProgress())
}

View File

@ -1,30 +1,33 @@
package server package server
import ( import (
"crypto/md5"
"encoding/hex"
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"net/url"
"os" "os"
"path" "path"
"reflect" "reflect"
"runtime/debug" "runtime/debug"
"strings" "strings"
"repositories.action2quare.com/ayo/go-ayo/logger" "repositories.action2quare.com/ayo/gocommon"
) "repositories.action2quare.com/ayo/gocommon/flagx"
"repositories.action2quare.com/ayo/gocommon/logger"
const (
defaultMaxMemory = 32 << 10 // 32 KB
) )
type HoustonServerWithHandler interface { type HoustonServerWithHandler interface {
HoustonServer HoustonServer
RegisterHandlers(serveMux *http.ServeMux, prefix string) error RegisterHandlers(serveMux gocommon.ServerMuxInterface, prefix string) error
} }
type houstonHandler struct { type houstonHandler struct {
HoustonServer HoustonServer
methods map[string]reflect.Method methods map[string]reflect.Method
deployPath string
downloadPath string
} }
func NewHoustonHandler() HoustonServerWithHandler { func NewHoustonHandler() HoustonServerWithHandler {
@ -42,20 +45,84 @@ func NewHoustonHandler() HoustonServerWithHandler {
} }
} }
func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string) error { func (h *houstonHandler) RegisterHandlers(serveMux gocommon.ServerMuxInterface, prefix string) error {
serveMux.Handle("/"+path.Join(prefix, "houston"), h) config := loadServerConfig()
storagePath := config.StorageRoot
h.deployPath = path.Join(storagePath, sub_folder_name_deploys)
h.downloadPath = path.Join(storagePath, sub_folder_name_downloads)
dfsx := http.FileServer(http.Dir("./deploys")) if err := os.MkdirAll(h.deployPath, 0775); err != nil {
serveMux.Handle( return err
"/"+path.Join(prefix, "deploys", "/"), }
http.StripPrefix(fmt.Sprintf("/%s/deploys", prefix), dfsx))
ufsx := http.FileServer(http.Dir("./downloads")) if err := os.MkdirAll(h.downloadPath, 0775); err != nil {
serveMux.Handle( return err
"/"+path.Join(prefix, "downloads", "/"), }
http.StripPrefix(fmt.Sprintf("/%s/downloads", prefix), ufsx))
serveMux.HandleFunc("/"+path.Join(prefix, "upload"), func(w http.ResponseWriter, r *http.Request) { if len(prefix) > 0 {
prefix = "/" + prefix
}
serveMux.Handle(prefix, h)
fsx := http.FileServer(http.Dir(h.deployPath))
deployPrefix := fmt.Sprintf("%s/%s/", prefix, sub_folder_name_deploys)
logger.Printf("houstonHandler registed. deployPath : %s -> %s", fmt.Sprintf("%s/%s/", prefix, sub_folder_name_deploys), h.deployPath)
serveMux.HandleFunc(fmt.Sprintf("%s/%s/", prefix, sub_folder_name_deploys), func(w http.ResponseWriter, r *http.Request) {
p := strings.TrimPrefix(r.URL.Path, deployPrefix)
rp := strings.TrimPrefix(r.URL.RawPath, deployPrefix)
h := md5.New()
src := strings.TrimLeft(r.URL.Path, fmt.Sprintf("/%s/", prefix))
h.Write([]byte(src))
at := hex.EncodeToString(h.Sum(nil))
if len(p) < len(r.URL.Path) && (r.URL.RawPath == "" || len(rp) < len(r.URL.RawPath)) && at == r.Header.Get("As-X-UrlHash") {
r2 := new(http.Request)
*r2 = *r
r2.URL = new(url.URL)
*r2.URL = *r.URL
r2.URL.Path = p
r2.URL.RawPath = rp
fsx.ServeHTTP(w, r2)
} else {
http.NotFound(w, r)
}
})
// config는 접근하기 편하게 단축 경로 제공
serveMux.HandleFunc("/config/", func(w http.ResponseWriter, r *http.Request) {
logger.Println("config url.path :", r.URL.Path)
testhash := md5.New()
testhash.Write([]byte(r.URL.Path))
at := hex.EncodeToString(testhash.Sum(nil))
hash := r.Header.Get("As-X-UrlHash")
logger.Println("config at = hash :", at, hash)
if at == hash {
urlpath := strings.TrimPrefix(r.URL.Path, "/config/")
dir := path.Dir(urlpath)
file := path.Base(urlpath)
sourceFile := path.Join(h.deployPath, dir, "config", file)
logger.Println("config dest :", sourceFile)
bt, err := os.ReadFile(sourceFile)
if err != nil && !os.IsExist(err) {
logger.Println("config file is missing :", sourceFile)
w.WriteHeader(http.StatusNotFound)
} else {
if _, err = w.Write(bt); err != nil {
logger.Println("config write failed :", err)
w.WriteHeader(http.StatusInternalServerError)
}
}
} else {
http.NotFound(w, r)
}
})
ufsx := http.FileServer(http.Dir(h.downloadPath))
serveMux.Handle(fmt.Sprintf("%s/%s/", prefix, sub_folder_name_downloads), http.StripPrefix(fmt.Sprintf("%s/%s/", prefix, sub_folder_name_downloads), ufsx))
serveMux.HandleFunc(fmt.Sprintf("%s/upload", prefix), func(w http.ResponseWriter, r *http.Request) {
defer func() { defer func() {
s := recover() s := recover()
if s != nil { if s != nil {
@ -69,8 +136,8 @@ func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string
name := r.Header.Get("Houston-Service-Name") name := r.Header.Get("Houston-Service-Name")
version := r.Header.Get("Houston-Service-Version") version := r.Header.Get("Houston-Service-Version")
filename := r.Header.Get("Houston-Service-Filename") filename := r.Header.Get("Houston-Service-Filename")
dir := fmt.Sprintf("./downloads/%s/%s", name, version) dir := path.Join(h.downloadPath, name, version)
if err := os.MkdirAll(dir, os.ModePerm); err == nil { if err := os.MkdirAll(dir, 0775); err == nil {
file, _ := os.Create(path.Join(dir, filename)) file, _ := os.Create(path.Join(dir, filename))
if file != nil { if file != nil {
defer file.Close() defer file.Close()
@ -88,6 +155,9 @@ func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string
return nil return nil
} }
var noauth = flagx.Bool("noauth", false, "")
var authtype = flagx.String("auth", "on", "on|off|both")
func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer func() { defer func() {
s := recover() s := recover()
@ -102,6 +172,38 @@ func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
r.Body.Close() r.Body.Close()
}() }()
// var userinfo map[string]any
// if !*noauth && (*authtype == "on" || *authtype == "both") {
// authheader := r.Header.Get("Authorization")
// if len(authheader) == 0 {
// logger.Println("Authorization header is not valid :", authheader)
// w.WriteHeader(http.StatusBadRequest)
// return
// }
// req, _ := http.NewRequest("GET", "https://graph.microsoft.com/oidc/userinfo", nil)
// req.Header.Add("Authorization", authheader)
// client := &http.Client{}
// resp, err := client.Do(req)
// if err != nil {
// logger.Println("graph microsoft api call failed :", err)
// w.WriteHeader(http.StatusBadRequest)
// return
// }
// defer resp.Body.Close()
// raw, _ := io.ReadAll(resp.Body)
// if err = json.Unmarshal(raw, &userinfo); err != nil {
// return
// }
// if _, expired := userinfo["error"]; expired {
// w.WriteHeader(http.StatusUnauthorized)
// return
// }
// }
var operation string var operation string
if r.Method == "POST" { if r.Method == "POST" {
operation = r.FormValue("operation") operation = r.FormValue("operation")
@ -122,15 +224,14 @@ func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return return
} }
if r.PostForm == nil {
r.ParseMultipartForm(defaultMaxMemory)
}
args := []reflect.Value{ args := []reflect.Value{
reflect.ValueOf(h), reflect.ValueOf(h),
reflect.ValueOf(w), reflect.ValueOf(w),
reflect.ValueOf(r), reflect.ValueOf(r),
} }
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
method.Func.Call(args) method.Func.Call(args)
} }

View File

@ -4,11 +4,14 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"net"
"os"
"reflect" "reflect"
"strings"
"sync" "sync"
"time"
"repositories.action2quare.com/ayo/go-ayo/logger" "repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/houston/shared" "repositories.action2quare.com/ayo/houston/shared"
"repositories.action2quare.com/ayo/houston/shared/protos" "repositories.action2quare.com/ayo/houston/shared/protos"
) )
@ -19,19 +22,19 @@ type opdef struct {
} }
type ProcessSnapshot struct { type ProcessSnapshot struct {
Name string Name string `json:"name"`
Args []string Args []string `json:"args"`
Version string Version string `json:"version"`
State protos.ProcessState State protos.ProcessState `json:"state"`
Pid int32 Pid int32 `json:"pid"`
StdoutSize int32
StderrSize int32
} }
type hostWithChan struct { type hostWithChan struct {
Hostname string Hostname string
Procs []*protos.ProcessDescription PrivateIp string
Deploys map[string][]*protos.VersionAndArgs PublicIp string
Procs []*protos.ProcessDescription `json:"procs"`
Deploys map[string][]*protos.VersionAndArgs `json:"deploys"`
opChan chan *opdef opChan chan *opdef
} }
@ -42,6 +45,8 @@ func makeHostWithChan(desc *protos.OperationQueryRequest) *hostWithChan {
} }
return &hostWithChan{ return &hostWithChan{
PrivateIp: desc.PrivateIp,
PublicIp: desc.PublicIp,
Hostname: desc.GetHostname(), Hostname: desc.GetHostname(),
Procs: desc.Procs, Procs: desc.Procs,
Deploys: newdeploys, Deploys: newdeploys,
@ -61,6 +66,26 @@ func (pc *hostWithChan) makeOpChan() *hostWithChan {
type hostPool struct { type hostPool struct {
sync.Mutex sync.Mutex
hosts map[string]*hostWithChan hosts map[string]*hostWithChan
exportChan chan string
}
type deployingProgress struct {
*protos.DeployingProgress
Timestamp int64
}
type deployingBoard struct {
sync.Mutex
progs []deployingProgress
}
func (db *deployingBoard) clone() (out []deployingProgress) {
db.Lock()
defer db.Unlock()
out = make([]deployingProgress, len(db.progs))
copy(out, db.progs)
return
} }
func (sp *hostPool) regist(desc *protos.OperationQueryRequest) (string, chan *opdef) { func (sp *hostPool) regist(desc *protos.OperationQueryRequest) (string, chan *opdef) {
@ -72,10 +97,29 @@ func (sp *hostPool) regist(desc *protos.OperationQueryRequest) (string, chan *op
} else { } else {
host = makeHostWithChan(desc).withOpChan(host.opChan) host = makeHostWithChan(desc).withOpChan(host.opChan)
} }
sp.hosts[desc.Hostname] = host
test, _ := json.Marshal(sp.hosts) logger.Println("houston agent registered :", desc.Hostname, desc.PrivateIp, desc.PublicIp)
logger.Println(string(test)) go func(prvip string, pubip string) {
if len(prvip) > 0 {
address := net.JoinHostPort(prvip, "9100")
if conn, _ := net.DialTimeout("tcp", address, 3*time.Second); conn != nil {
conn.Close()
sp.exportChan <- "+" + address
return
}
}
if len(pubip) > 0 {
address := net.JoinHostPort(pubip, "9100")
if conn, _ := net.DialTimeout("tcp", address, 3*time.Second); conn != nil {
conn.Close()
sp.exportChan <- "+" + address
return
}
}
}(desc.PrivateIp, desc.PublicIp)
sp.hosts[desc.Hostname] = host
return desc.Hostname, host.opChan return desc.Hostname, host.opChan
} }
@ -88,21 +132,24 @@ func (sp *hostPool) refresh(desc *protos.OperationQueryRequest) {
host = makeHostWithChan(desc).withOpChan(host.opChan) host = makeHostWithChan(desc).withOpChan(host.opChan)
sp.hosts[desc.Hostname] = host sp.hosts[desc.Hostname] = host
} }
test, _ := json.Marshal(sp.hosts)
logger.Println(string(test))
} }
func (sp *hostPool) unregist(key string) { func (sp *hostPool) unregist(key string) {
sp.Lock() sp.Lock()
defer sp.Unlock() defer sp.Unlock()
host := sp.hosts[key]
if host != nil {
sp.exportChan <- "-" + host.PublicIp
sp.exportChan <- "-" + host.PrivateIp
}
delete(sp.hosts, key) delete(sp.hosts, key)
} }
type hostSnapshot struct { type hostSnapshot struct {
Procs []ProcessSnapshot Procs []ProcessSnapshot `json:"procs"`
Deploys map[string][]*protos.VersionAndArgs Deploys map[string][]*protos.VersionAndArgs `json:"deploys"`
} }
func (sp *hostPool) allHosts() map[string]hostSnapshot { func (sp *hostPool) allHosts() map[string]hostSnapshot {
@ -119,8 +166,6 @@ func (sp *hostPool) allHosts() map[string]hostSnapshot {
Version: p.Version, Version: p.Version,
State: p.State, State: p.State,
Pid: p.Pid, Pid: p.Pid,
StdoutSize: p.StdoutSize,
StderrSize: p.StderrSize,
}) })
} }
out[hn] = hostSnapshot{ out[hn] = hostSnapshot{
@ -147,6 +192,7 @@ func (sp *hostPool) query(filter func(*hostWithChan) bool) []*hostWithChan {
type operationServer struct { type operationServer struct {
protos.UnimplementedOperationServer protos.UnimplementedOperationServer
hp hostPool hp hostPool
db deployingBoard
} }
func marshal(argval reflect.Value, output map[string]string) map[string]string { func marshal(argval reflect.Value, output map[string]string) map[string]string {
@ -163,6 +209,12 @@ func marshal(argval reflect.Value, output map[string]string) map[string]string {
marshal(argval.Field(i), output) marshal(argval.Field(i), output)
} else if argval.Field(i).CanInt() { } else if argval.Field(i).CanInt() {
output[argval.Type().Field(i).Name] = fmt.Sprintf("%d", argval.Field(i).Int()) output[argval.Type().Field(i).Name] = fmt.Sprintf("%d", argval.Field(i).Int())
} else if argval.Field(i).Kind() == reflect.Array || argval.Field(i).Kind() == reflect.Slice {
var conv []string
for j := 0; j < argval.Field(i).Len(); j++ {
conv = append(conv, argval.Field(i).Index(j).String())
}
output[argval.Type().Field(i).Name] = strings.Join(conv, "\n")
} else { } else {
output[argval.Type().Field(i).Name] = argval.Field(i).String() output[argval.Type().Field(i).Name] = argval.Field(i).String()
} }
@ -171,15 +223,19 @@ func marshal(argval reflect.Value, output map[string]string) map[string]string {
} }
func (os *operationServer) Query(svr protos.Operation_QueryServer) error { func (os *operationServer) Query(svr protos.Operation_QueryServer) error {
// 서버는 업데이트가 있는지 확인하고 있으면 stream에 응답을 보낸다.
// 업데이트가 없으면 대기
desc, err := svr.Recv() desc, err := svr.Recv()
if err != nil { if err != nil {
return err return err
} }
hostname := desc.Hostname
key, opChan := os.hp.regist(desc) key, opChan := os.hp.regist(desc)
defer os.hp.unregist(key) defer func() {
logger.Println("operationServer.Query : houston client unregistered ", hostname)
os.hp.unregist(key)
}()
logger.Println("operationServer.Query : houston client registered ", hostname)
Outer: Outer:
for { for {
@ -198,6 +254,25 @@ Outer:
return nil return nil
} }
func (os *operationServer) ReportDeployingProgress(ctx context.Context, dp *protos.DeployingProgress) (*protos.Empty, error) {
os.db.Lock()
defer os.db.Unlock()
for i, p := range os.db.progs {
if p.Hostname == dp.Hostname && p.Name == dp.Name && p.Version == dp.Version {
os.db.progs[i].DeployingProgress = dp
os.db.progs[i].Timestamp = time.Now().UTC().Unix()
return &protos.Empty{}, nil
}
}
os.db.progs = append(os.db.progs, deployingProgress{
DeployingProgress: dp,
Timestamp: time.Now().UTC().Unix(),
})
return &protos.Empty{}, nil
}
func (os *operationServer) Refresh(ctx context.Context, desc *protos.OperationQueryRequest) (*protos.Empty, error) { func (os *operationServer) Refresh(ctx context.Context, desc *protos.OperationQueryRequest) (*protos.Empty, error) {
os.hp.refresh(desc) os.hp.refresh(desc)
return &protos.Empty{}, nil return &protos.Empty{}, nil
@ -227,12 +302,29 @@ func (os *operationServer) Deploy(d DeployRequest) {
}) })
} }
for _, t := range targets { dps := make([]deployingProgress, len(targets))
now := time.Now().UTC().Unix()
for i, t := range targets {
dps[i] = deployingProgress{
DeployingProgress: &protos.DeployingProgress{
Hostname: t.Hostname,
Name: d.Name,
Version: d.Version,
State: "prepare",
},
Timestamp: now,
}
t.opChan <- &opdef{ t.opChan <- &opdef{
operation: shared.Deploy, operation: shared.Deploy,
args: d, args: d,
} }
} }
os.db.Lock()
defer os.db.Unlock()
os.db.progs = dps
} }
func (os *operationServer) Withdraw(d WithdrawRequest) { func (os *operationServer) Withdraw(d WithdrawRequest) {
@ -341,27 +433,19 @@ func (os *operationServer) RestartProcess(d RestartProcessRequest) {
return false return false
}) })
if len(d.hostnames) > 0 { if len(d.hostnames) != 1 {
return
}
// hostname만 재시작 // hostname만 재시작
var final []*hostWithChan
conv := make(map[string]bool)
for _, hn := range d.hostnames {
conv[hn] = true
}
for _, t := range targets {
if _, ok := conv[t.Hostname]; ok {
final = append(final, t)
}
}
targets = final
}
for _, t := range targets { for _, t := range targets {
if t.Hostname == d.hostnames[0] {
t.opChan <- &opdef{ t.opChan <- &opdef{
operation: shared.Restart, operation: shared.Restart,
args: d, args: d,
} }
return
}
} }
} }
@ -400,10 +484,43 @@ func (os *operationServer) Hosts() map[string]hostSnapshot {
return os.hp.allHosts() return os.hp.allHosts()
} }
func (os *operationServer) DeplyingProgress() []deployingProgress {
return os.db.clone()
}
func targetExportLoop(in chan string) {
all := make(map[string]bool)
for addr := range in {
logger.Println("targetExportLoop :", addr)
if addr[0] == '+' {
all[addr[1:]] = true
} else if addr[0] == '-' {
delete(all, addr[1:])
}
list := make([]string, 0, len(all))
for k := range all {
list = append(list, k)
}
output := []map[string]any{{"targets": list}}
if file, err := os.Create("prometheus_targets.json"); err == nil {
enc := json.NewEncoder(file)
enc.Encode(output)
file.Close()
}
}
}
func newOperationServer() *operationServer { func newOperationServer() *operationServer {
exportChan := make(chan string)
go targetExportLoop(exportChan)
return &operationServer{ return &operationServer{
hp: hostPool{ hp: hostPool{
hosts: map[string]*hostWithChan{}, hosts: map[string]*hostWithChan{},
exportChan: exportChan,
}, },
} }
} }

View File

@ -4,6 +4,8 @@ import (
"fmt" "fmt"
"net" "net"
"repositories.action2quare.com/ayo/gocommon"
"repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/houston/shared" "repositories.action2quare.com/ayo/houston/shared"
"repositories.action2quare.com/ayo/houston/shared/protos" "repositories.action2quare.com/ayo/houston/shared/protos"
@ -12,11 +14,16 @@ import (
// protoc --go_out=. --go-grpc_out=. protos/*.proto // protoc --go_out=. --go-grpc_out=. protos/*.proto
type HoustonServer interface { type HoustonServer interface {
Start(port int) error Start() error
Stop() Stop()
Operation() Operation Operation() Operation
} }
type serverConfig struct {
GrpcPort int `json:"grpc_port"`
StorageRoot string `json:"storage_path"`
}
type DeployRequest struct { type DeployRequest struct {
shared.DeployRequest shared.DeployRequest
hostnames []string hostnames []string
@ -97,10 +104,29 @@ type Operation interface {
RestartProcess(RestartProcessRequest) RestartProcess(RestartProcessRequest)
Upload(UploadRequest) Upload(UploadRequest)
Hosts() map[string]hostSnapshot Hosts() map[string]hostSnapshot
DeplyingProgress() []deployingProgress
}
type outerconfig struct {
Houston *struct {
Server serverConfig `json:"server"`
} `json:"houston"`
}
func loadServerConfig() serverConfig {
var oc outerconfig
err := gocommon.LoadConfig[outerconfig](&oc)
if err != nil {
logger.Println(err)
return serverConfig{
GrpcPort: 8080,
}
}
return oc.Houston.Server
} }
func NewServer() HoustonServer { func NewServer() HoustonServer {
var opts []grpc.ServerOption var opts []grpc.ServerOption
grpcServer := grpc.NewServer(opts...) grpcServer := grpc.NewServer(opts...)
@ -113,6 +139,7 @@ func NewServer() HoustonServer {
rpcServer: grpcServer, rpcServer: grpcServer,
os: os, os: os,
ms: ms, ms: ms,
port: loadServerConfig().GrpcPort,
} }
} }
@ -120,23 +147,21 @@ type houstonServer struct {
rpcServer *grpc.Server rpcServer *grpc.Server
os *operationServer os *operationServer
ms *monitorServer ms *monitorServer
port int
} }
func (hs *houstonServer) Start(port int) error { func (hs *houstonServer) Start() error {
lis, err := net.Listen("tcp", fmt.Sprintf("localhost:%d", port)) logger.Println("houston server is started at port", hs.port)
lis, err := net.Listen("tcp", fmt.Sprintf("0.0.0.0:%d", hs.port))
if err != nil { if err != nil {
return err return err
} }
if err := hs.rpcServer.Serve(lis); err != nil { return hs.rpcServer.Serve(lis)
return err
}
return nil
} }
func (hs *houstonServer) Stop() { func (hs *houstonServer) Stop() {
hs.rpcServer.GracefulStop() hs.rpcServer.Stop()
} }
func (hs *houstonServer) Operation() Operation { func (hs *houstonServer) Operation() Operation {

View File

@ -1,11 +1,5 @@
package shared package shared
import (
"io/fs"
"os"
"strings"
)
type Operation string type Operation string
const ( const (
@ -16,12 +10,14 @@ const (
Restart = Operation("restart") Restart = Operation("restart")
Stop = Operation("stop") Stop = Operation("stop")
Upload = Operation("upload") Upload = Operation("upload")
Exception = Operation("exception")
) )
type DeployRequest struct { type DeployRequest struct {
Name string Name string
Version string Version string
Url string Url string
Config string
AccessToken string AccessToken string
} }
@ -33,7 +29,7 @@ type WithdrawRequest struct {
type StartProcessRequest struct { type StartProcessRequest struct {
Name string Name string
Version string Version string
Args string Args []string
} }
type StopProcessRequest struct { type StopProcessRequest struct {
@ -44,7 +40,8 @@ type StopProcessRequest struct {
type RestartProcessRequest struct { type RestartProcessRequest struct {
Name string Name string
Version string Pid int32
Config string
} }
type UploadRequest struct { type UploadRequest struct {
@ -54,61 +51,3 @@ type UploadRequest struct {
Filter string Filter string
DeleteAfterUploaded string // true, false DeleteAfterUploaded string // true, false
} }
type ParsedVersionString = []string
func ParseVersionString(ver string) ParsedVersionString {
return strings.Split(ver, ".")
}
func CompareVersionString(lhs, rhs ParsedVersionString) int {
minlen := len(lhs)
if minlen > len(rhs) {
minlen = len(rhs)
}
for i := 0; i < minlen; i++ {
if len(lhs[i]) < len(rhs[i]) {
return -1
}
if len(lhs[i]) > len(rhs[i]) {
return 1
}
if lhs[i] < rhs[i] {
return -1
}
if lhs[i] > rhs[i] {
return 1
}
}
return len(lhs) - len(rhs)
}
func FindLastestVersion(root string) (string, error) {
// 최신 버전을 찾음
entries, err := os.ReadDir(root)
if err != nil {
return "", err
}
if len(entries) == 0 {
return "", nil
}
var dironly []fs.DirEntry
for _, ent := range entries {
if ent.IsDir() {
dironly = append(dironly, ent)
}
}
latest := ParseVersionString(dironly[0].Name())
for i := 1; i < len(dironly); i++ {
next := ParseVersionString(dironly[i].Name())
if CompareVersionString(latest, next) < 0 {
latest = next
}
}
return strings.Join(latest, "."), nil
}

View File

@ -26,7 +26,8 @@ const (
ProcessState_Stopped ProcessState = 0 ProcessState_Stopped ProcessState = 0
ProcessState_Stopping ProcessState = 1 ProcessState_Stopping ProcessState = 1
ProcessState_Running ProcessState = 2 ProcessState_Running ProcessState = 2
ProcessState_Error ProcessState = 3 ProcessState_Restart ProcessState = 3
ProcessState_Error ProcessState = 4
) )
// Enum value maps for ProcessState. // Enum value maps for ProcessState.
@ -35,13 +36,15 @@ var (
0: "Stopped", 0: "Stopped",
1: "Stopping", 1: "Stopping",
2: "Running", 2: "Running",
3: "Error", 3: "Restart",
4: "Error",
} }
ProcessState_value = map[string]int32{ ProcessState_value = map[string]int32{
"Stopped": 0, "Stopped": 0,
"Stopping": 1, "Stopping": 1,
"Running": 2, "Running": 2,
"Error": 3, "Restart": 3,
"Error": 4,
} }
) )
@ -188,6 +191,8 @@ type OperationQueryRequest struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"` Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"`
PublicIp string `protobuf:"bytes,4,opt,name=public_ip,json=publicIp,proto3" json:"public_ip,omitempty"`
PrivateIp string `protobuf:"bytes,5,opt,name=private_ip,json=privateIp,proto3" json:"private_ip,omitempty"`
Procs []*ProcessDescription `protobuf:"bytes,2,rep,name=procs,proto3" json:"procs,omitempty"` Procs []*ProcessDescription `protobuf:"bytes,2,rep,name=procs,proto3" json:"procs,omitempty"`
Deploys []*DeployedVersions `protobuf:"bytes,3,rep,name=deploys,proto3" json:"deploys,omitempty"` Deploys []*DeployedVersions `protobuf:"bytes,3,rep,name=deploys,proto3" json:"deploys,omitempty"`
} }
@ -231,6 +236,20 @@ func (x *OperationQueryRequest) GetHostname() string {
return "" return ""
} }
func (x *OperationQueryRequest) GetPublicIp() string {
if x != nil {
return x.PublicIp
}
return ""
}
func (x *OperationQueryRequest) GetPrivateIp() string {
if x != nil {
return x.PrivateIp
}
return ""
}
func (x *OperationQueryRequest) GetProcs() []*ProcessDescription { func (x *OperationQueryRequest) GetProcs() []*ProcessDescription {
if x != nil { if x != nil {
return x.Procs return x.Procs
@ -255,8 +274,6 @@ type ProcessDescription struct {
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
State ProcessState `protobuf:"varint,4,opt,name=state,proto3,enum=ProcessState" json:"state,omitempty"` State ProcessState `protobuf:"varint,4,opt,name=state,proto3,enum=ProcessState" json:"state,omitempty"`
Pid int32 `protobuf:"varint,5,opt,name=pid,proto3" json:"pid,omitempty"` Pid int32 `protobuf:"varint,5,opt,name=pid,proto3" json:"pid,omitempty"`
StdoutSize int32 `protobuf:"varint,6,opt,name=stdout_size,json=stdoutSize,proto3" json:"stdout_size,omitempty"`
StderrSize int32 `protobuf:"varint,7,opt,name=stderr_size,json=stderrSize,proto3" json:"stderr_size,omitempty"`
} }
func (x *ProcessDescription) Reset() { func (x *ProcessDescription) Reset() {
@ -326,20 +343,6 @@ func (x *ProcessDescription) GetPid() int32 {
return 0 return 0
} }
func (x *ProcessDescription) GetStdoutSize() int32 {
if x != nil {
return x.StdoutSize
}
return 0
}
func (x *ProcessDescription) GetStderrSize() int32 {
if x != nil {
return x.StderrSize
}
return 0
}
type OperationQueryResponse struct { type OperationQueryResponse struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -395,6 +398,93 @@ func (x *OperationQueryResponse) GetArgs() map[string]string {
return nil return nil
} }
type DeployingProgress struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
State string `protobuf:"bytes,4,opt,name=state,proto3" json:"state,omitempty"`
Progress int64 `protobuf:"varint,5,opt,name=progress,proto3" json:"progress,omitempty"`
Total int64 `protobuf:"varint,6,opt,name=total,proto3" json:"total,omitempty"`
}
func (x *DeployingProgress) Reset() {
*x = DeployingProgress{}
if protoimpl.UnsafeEnabled {
mi := &file_protos_operation_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeployingProgress) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeployingProgress) ProtoMessage() {}
func (x *DeployingProgress) ProtoReflect() protoreflect.Message {
mi := &file_protos_operation_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeployingProgress.ProtoReflect.Descriptor instead.
func (*DeployingProgress) Descriptor() ([]byte, []int) {
return file_protos_operation_proto_rawDescGZIP(), []int{5}
}
func (x *DeployingProgress) GetHostname() string {
if x != nil {
return x.Hostname
}
return ""
}
func (x *DeployingProgress) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *DeployingProgress) GetVersion() string {
if x != nil {
return x.Version
}
return ""
}
func (x *DeployingProgress) GetState() string {
if x != nil {
return x.State
}
return ""
}
func (x *DeployingProgress) GetProgress() int64 {
if x != nil {
return x.Progress
}
return 0
}
func (x *DeployingProgress) GetTotal() int64 {
if x != nil {
return x.Total
}
return 0
}
var File_protos_operation_proto protoreflect.FileDescriptor var File_protos_operation_proto protoreflect.FileDescriptor
var file_protos_operation_proto_rawDesc = []byte{ var file_protos_operation_proto_rawDesc = []byte{
@ -410,43 +500,54 @@ var file_protos_operation_proto_rawDesc = []byte{
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x41, 0x6e, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x73, 0x22, 0x8b, 0x01, 0x0a, 0x15, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x73, 0x22, 0xc7, 0x01, 0x0a, 0x15, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51,
0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x68,
0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68,
0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x63, 0x73, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x63, 0x5f, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x75, 0x62, 0x6c,
0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x69, 0x63, 0x49, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f,
0x63, 0x73, 0x12, 0x2b, 0x0a, 0x07, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x73, 0x18, 0x03, 0x20, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74,
0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x56, 0x65, 0x65, 0x49, 0x70, 0x12, 0x29, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x63, 0x73, 0x18, 0x02, 0x20, 0x03,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x73, 0x22, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x73, 0x63,
0xcf, 0x01, 0x0a, 0x12, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x73, 0x63, 0x72, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x63, 0x73, 0x12, 0x2b,
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x0a, 0x07, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x11, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x18, 0x6e, 0x73, 0x52, 0x07, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x73, 0x22, 0x8d, 0x01, 0x0a, 0x12,
0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02,
0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65,
0x03, 0x70, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72,
0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61,
0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64,
0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x53, 0x69, 0x7a, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x70, 0x69, 0x64, 0x22, 0xa6, 0x01, 0x0a, 0x16,
0x65, 0x22, 0xa6, 0x01, 0x0a, 0x16, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65,
0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61,
0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x04, 0x61, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03,
0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75,
0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x41, 0x72, 0x67, 0x73,
0x65, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x61, 0x72, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x1a, 0x37, 0x0a, 0x09, 0x41,
0x73, 0x1a, 0x37, 0x0a, 0x09, 0x41, 0x72, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x72, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x41, 0x0a, 0x0c, 0x50, 0x72, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa5, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x69,
0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x74, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f,
0x6f, 0x70, 0x70, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x74, 0x6f, 0x70, 0x70, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f,
0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x03, 0x32, 0x78, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72,
0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x72,
0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18,
0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x4e, 0x0a, 0x0c,
0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07,
0x53, 0x74, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x74, 0x6f,
0x70, 0x70, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x75, 0x6e, 0x6e, 0x69,
0x6e, 0x67, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x10,
0x03, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x04, 0x32, 0xb1, 0x01, 0x0a,
0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x05, 0x51, 0x75, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x05, 0x51, 0x75,
0x65, 0x72, 0x79, 0x12, 0x16, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x65, 0x72, 0x79, 0x12, 0x16, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51,
0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x4f, 0x70, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x4f, 0x70,
@ -454,8 +555,12 @@ var file_protos_operation_proto_rawDesc = []byte{
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x2b, 0x0a, 0x07, 0x52, 0x65, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x2b, 0x0a, 0x07, 0x52, 0x65,
0x66, 0x72, 0x65, 0x73, 0x68, 0x12, 0x16, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x66, 0x72, 0x65, 0x73, 0x68, 0x12, 0x16, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x06, 0x2e, 0x6e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x06, 0x2e,
0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x0f, 0x5a, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x6f, 0x72,
0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65,
0x73, 0x73, 0x12, 0x12, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x69, 0x6e, 0x67, 0x50, 0x72,
0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x06, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00,
0x42, 0x0f, 0x5a, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -471,7 +576,7 @@ func file_protos_operation_proto_rawDescGZIP() []byte {
} }
var file_protos_operation_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_protos_operation_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_protos_operation_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_protos_operation_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_protos_operation_proto_goTypes = []interface{}{ var file_protos_operation_proto_goTypes = []interface{}{
(ProcessState)(0), // 0: ProcessState (ProcessState)(0), // 0: ProcessState
(*VersionAndArgs)(nil), // 1: VersionAndArgs (*VersionAndArgs)(nil), // 1: VersionAndArgs
@ -479,21 +584,24 @@ var file_protos_operation_proto_goTypes = []interface{}{
(*OperationQueryRequest)(nil), // 3: OperationQueryRequest (*OperationQueryRequest)(nil), // 3: OperationQueryRequest
(*ProcessDescription)(nil), // 4: ProcessDescription (*ProcessDescription)(nil), // 4: ProcessDescription
(*OperationQueryResponse)(nil), // 5: OperationQueryResponse (*OperationQueryResponse)(nil), // 5: OperationQueryResponse
nil, // 6: OperationQueryResponse.ArgsEntry (*DeployingProgress)(nil), // 6: DeployingProgress
(*Empty)(nil), // 7: Empty nil, // 7: OperationQueryResponse.ArgsEntry
(*Empty)(nil), // 8: Empty
} }
var file_protos_operation_proto_depIdxs = []int32{ var file_protos_operation_proto_depIdxs = []int32{
1, // 0: DeployedVersions.versions:type_name -> VersionAndArgs 1, // 0: DeployedVersions.versions:type_name -> VersionAndArgs
4, // 1: OperationQueryRequest.procs:type_name -> ProcessDescription 4, // 1: OperationQueryRequest.procs:type_name -> ProcessDescription
2, // 2: OperationQueryRequest.deploys:type_name -> DeployedVersions 2, // 2: OperationQueryRequest.deploys:type_name -> DeployedVersions
0, // 3: ProcessDescription.state:type_name -> ProcessState 0, // 3: ProcessDescription.state:type_name -> ProcessState
6, // 4: OperationQueryResponse.args:type_name -> OperationQueryResponse.ArgsEntry 7, // 4: OperationQueryResponse.args:type_name -> OperationQueryResponse.ArgsEntry
3, // 5: Operation.Query:input_type -> OperationQueryRequest 3, // 5: Operation.Query:input_type -> OperationQueryRequest
3, // 6: Operation.Refresh:input_type -> OperationQueryRequest 3, // 6: Operation.Refresh:input_type -> OperationQueryRequest
5, // 7: Operation.Query:output_type -> OperationQueryResponse 6, // 7: Operation.ReportDeployingProgress:input_type -> DeployingProgress
7, // 8: Operation.Refresh:output_type -> Empty 5, // 8: Operation.Query:output_type -> OperationQueryResponse
7, // [7:9] is the sub-list for method output_type 8, // 9: Operation.Refresh:output_type -> Empty
5, // [5:7] is the sub-list for method input_type 8, // 10: Operation.ReportDeployingProgress:output_type -> Empty
8, // [8:11] is the sub-list for method output_type
5, // [5:8] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name 5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee 5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name 0, // [0:5] is the sub-list for field type_name
@ -566,6 +674,18 @@ func file_protos_operation_proto_init() {
return nil return nil
} }
} }
file_protos_operation_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeployingProgress); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -573,7 +693,7 @@ func file_protos_operation_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_protos_operation_proto_rawDesc, RawDescriptor: file_protos_operation_proto_rawDesc,
NumEnums: 1, NumEnums: 1,
NumMessages: 6, NumMessages: 7,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@ -24,6 +24,7 @@ const _ = grpc.SupportPackageIsVersion7
type OperationClient interface { type OperationClient interface {
Query(ctx context.Context, opts ...grpc.CallOption) (Operation_QueryClient, error) Query(ctx context.Context, opts ...grpc.CallOption) (Operation_QueryClient, error)
Refresh(ctx context.Context, in *OperationQueryRequest, opts ...grpc.CallOption) (*Empty, error) Refresh(ctx context.Context, in *OperationQueryRequest, opts ...grpc.CallOption) (*Empty, error)
ReportDeployingProgress(ctx context.Context, in *DeployingProgress, opts ...grpc.CallOption) (*Empty, error)
} }
type operationClient struct { type operationClient struct {
@ -74,12 +75,22 @@ func (c *operationClient) Refresh(ctx context.Context, in *OperationQueryRequest
return out, nil return out, nil
} }
func (c *operationClient) ReportDeployingProgress(ctx context.Context, in *DeployingProgress, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/Operation/ReportDeployingProgress", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// OperationServer is the server API for Operation service. // OperationServer is the server API for Operation service.
// All implementations must embed UnimplementedOperationServer // All implementations must embed UnimplementedOperationServer
// for forward compatibility // for forward compatibility
type OperationServer interface { type OperationServer interface {
Query(Operation_QueryServer) error Query(Operation_QueryServer) error
Refresh(context.Context, *OperationQueryRequest) (*Empty, error) Refresh(context.Context, *OperationQueryRequest) (*Empty, error)
ReportDeployingProgress(context.Context, *DeployingProgress) (*Empty, error)
mustEmbedUnimplementedOperationServer() mustEmbedUnimplementedOperationServer()
} }
@ -93,6 +104,9 @@ func (UnimplementedOperationServer) Query(Operation_QueryServer) error {
func (UnimplementedOperationServer) Refresh(context.Context, *OperationQueryRequest) (*Empty, error) { func (UnimplementedOperationServer) Refresh(context.Context, *OperationQueryRequest) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Refresh not implemented") return nil, status.Errorf(codes.Unimplemented, "method Refresh not implemented")
} }
func (UnimplementedOperationServer) ReportDeployingProgress(context.Context, *DeployingProgress) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReportDeployingProgress not implemented")
}
func (UnimplementedOperationServer) mustEmbedUnimplementedOperationServer() {} func (UnimplementedOperationServer) mustEmbedUnimplementedOperationServer() {}
// UnsafeOperationServer may be embedded to opt out of forward compatibility for this service. // UnsafeOperationServer may be embedded to opt out of forward compatibility for this service.
@ -150,6 +164,24 @@ func _Operation_Refresh_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Operation_ReportDeployingProgress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeployingProgress)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OperationServer).ReportDeployingProgress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Operation/ReportDeployingProgress",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OperationServer).ReportDeployingProgress(ctx, req.(*DeployingProgress))
}
return interceptor(ctx, in, info, handler)
}
// Operation_ServiceDesc is the grpc.ServiceDesc for Operation service. // Operation_ServiceDesc is the grpc.ServiceDesc for Operation service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@ -161,6 +193,10 @@ var Operation_ServiceDesc = grpc.ServiceDesc{
MethodName: "Refresh", MethodName: "Refresh",
Handler: _Operation_Refresh_Handler, Handler: _Operation_Refresh_Handler,
}, },
{
MethodName: "ReportDeployingProgress",
Handler: _Operation_ReportDeployingProgress_Handler,
},
}, },
Streams: []grpc.StreamDesc{ Streams: []grpc.StreamDesc{
{ {