Skip to content

Commit 1ab4aac

Browse files
committed
support deploy website
Signed-off-by: wanghai01 <[email protected]>
1 parent c896257 commit 1ab4aac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1970
-292
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Go
1515
uses: actions/setup-go@v3
1616
with:
17-
go-version: 1.18
17+
go-version: 1.19
1818
- name: Generate SSH key
1919
run: ssh-keygen -f ~/.ssh/id_rsa -P ""
2020
- name: Test
@@ -28,7 +28,7 @@ jobs:
2828
- name: Set up Go
2929
uses: actions/setup-go@v3
3030
with:
31-
go-version: 1.18
31+
go-version: 1.19
3232
- name: Set dependencies
3333
run: sudo apt update && sudo apt install musl-tools
3434
- name: Build

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ build:
6262

6363
debug:
6464
$(GOENV) $(GO) build -o $(OUTPUT) $(DEBUG_FLAGS) $(PACKAGES)
65+
$(GOENV) $(GO) build -o $(SERVER_OUTPUT) $(DEBUG_FLAGS) $(SERVER_PACKAGES)
6566

6667
test:
6768
$(GO_TEST) $(TEST_FLAGS) ./...

cli/cli/cli.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ func (curveadm *CurveAdm) GetServiceId(dcId string) string {
377377
return utils.MD5Sum(serviceId)[:12]
378378
}
379379

380+
// website is cluster-independent
381+
func (curveadm *CurveAdm) GetWebsiteServiceId(wcId string) string {
382+
return utils.MD5Sum(wcId)[:12]
383+
}
384+
380385
func (curveadm *CurveAdm) GetContainerId(serviceId string) (string, error) {
381386
containerId, err := curveadm.Storage().GetContainerId(serviceId)
382387
if err != nil {

cli/command/cmd.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ import (
3333
"github.com/opencurve/curveadm/cli/command/config"
3434
"github.com/opencurve/curveadm/cli/command/disks"
3535
"github.com/opencurve/curveadm/cli/command/hosts"
36-
"github.com/opencurve/curveadm/cli/command/monitor"
3736
"github.com/opencurve/curveadm/cli/command/http"
37+
"github.com/opencurve/curveadm/cli/command/monitor"
3838
"github.com/opencurve/curveadm/cli/command/pfs"
3939
"github.com/opencurve/curveadm/cli/command/playground"
4040
"github.com/opencurve/curveadm/cli/command/target"
41+
"github.com/opencurve/curveadm/cli/command/website"
4142
"github.com/opencurve/curveadm/internal/errno"
4243
tools "github.com/opencurve/curveadm/internal/tools/upgrade"
4344
cliutil "github.com/opencurve/curveadm/internal/utils"
@@ -70,6 +71,7 @@ func addSubCommands(cmd *cobra.Command, curveadm *cli.CurveAdm) {
7071
pfs.NewPFSCommand(curveadm), // curveadm pfs ...
7172
monitor.NewMonitorCommand(curveadm), // curveadm monitor ...
7273
http.NewHttpCommand(curveadm), // curveadm http
74+
website.NewWebsiteCommand(curveadm), // curveadm website ...
7375

7476
NewAuditCommand(curveadm), // curveadm audit
7577
NewCleanCommand(curveadm), // curveadm clean

cli/command/disks/commit.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ func syncDiskRecords(data string, dcs []*disks.DiskConfig,
174174
if !slient {
175175
diff := utils.Diff(oldDiskRecordsString, newDiskRecordsString)
176176
curveadm.WriteOutln(diff)
177-
}
178177

179-
pass := tuicomm.ConfirmYes("Disk changes are showing above. Do you want to continue?")
180-
if !pass {
181-
curveadm.WriteOut(tuicomm.PromptCancelOpetation("commit disk table"))
182-
return errno.ERR_CANCEL_OPERATION
178+
pass := tuicomm.ConfirmYes("Disk changes are showing above. Do you want to continue?")
179+
if !pass {
180+
curveadm.WriteOut(tuicomm.PromptCancelOpetation("commit disk table"))
181+
return errno.ERR_CANCEL_OPERATION
182+
}
183183
}
184184
}
185185

cli/command/monitor/deploy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const (
4242
)
4343

4444
var (
45-
MONITOR_DEPLOY_STEPS = []int{
45+
DEPLOY_PLAYBOOK_STEPS = []int{
4646
playbook.PULL_MONITOR_IMAGE,
4747
playbook.CREATE_MONITOR_CONTAINER,
4848
playbook.SYNC_MONITOR_CONFIG,
@@ -86,7 +86,7 @@ func NewDeployCommand(curveadm *cli.CurveAdm) *cobra.Command {
8686

8787
func genDeployPlaybook(curveadm *cli.CurveAdm,
8888
mcs []*configure.MonitorConfig) (*playbook.Playbook, error) {
89-
steps := MONITOR_DEPLOY_STEPS
89+
steps := DEPLOY_PLAYBOOK_STEPS
9090
pb := playbook.NewPlaybook(curveadm)
9191
for _, step := range steps {
9292
if step == playbook.CLEAN_CONFIG_CONTAINER {

cli/command/monitor/reload.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ import (
3434
)
3535

3636
var (
37-
MONITOR_RELOAD_STEPS = []int{
37+
RELOAD_PLAYBOOK_STEPS = []int{
38+
playbook.PULL_MONITOR_IMAGE,
3839
playbook.CREATE_MONITOR_CONTAINER,
3940
playbook.SYNC_MONITOR_CONFIG,
4041
playbook.CLEAN_CONFIG_CONTAINER,
@@ -80,7 +81,7 @@ func genReloadPlaybook(curveadm *cli.CurveAdm,
8081
return nil, errno.ERR_NO_SERVICES_MATCHED
8182
}
8283

83-
steps := MONITOR_RELOAD_STEPS
84+
steps := RELOAD_PLAYBOOK_STEPS
8485
pb := playbook.NewPlaybook(curveadm)
8586
for _, step := range steps {
8687
if step == playbook.CREATE_MONITOR_CONTAINER || step == playbook.CLEAN_CONFIG_CONTAINER {

cli/command/monitor/restart.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
)
3434

3535
var (
36-
MONITOR_RESTART_STEPS = []int{
36+
RESTART_PLAYBOOK_STEPS = []int{
3737
playbook.RESTART_MONITOR_SERVICE,
3838
}
3939
)
@@ -76,7 +76,7 @@ func genRestartPlaybook(curveadm *cli.CurveAdm,
7676
return nil, errno.ERR_NO_SERVICES_MATCHED
7777
}
7878

79-
steps := MONITOR_RESTART_STEPS
79+
steps := RESTART_PLAYBOOK_STEPS
8080
pb := playbook.NewPlaybook(curveadm)
8181
for _, step := range steps {
8282
pb.AddStep(&playbook.PlaybookStep{

cli/command/monitor/start.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
)
3434

3535
var (
36-
MONITOR_START_STEPS = []int{
36+
START_PLAYBOOK_STEPS = []int{
3737
playbook.START_MONITOR_SERVICE,
3838
}
3939
)
@@ -76,7 +76,7 @@ func genStartPlaybook(curveadm *cli.CurveAdm,
7676
return nil, errno.ERR_NO_SERVICES_MATCHED
7777
}
7878

79-
steps := MONITOR_START_STEPS
79+
steps := START_PLAYBOOK_STEPS
8080
pb := playbook.NewPlaybook(curveadm)
8181
for _, step := range steps {
8282
pb.AddStep(&playbook.PlaybookStep{

cli/command/monitor/status.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
)
3636

3737
var (
38-
GET_MONITOR_STATUS_PLAYBOOK_STEPS = []int{
38+
STATUS_PLAYBOOK_STEPS = []int{
3939
playbook.INIT_MONITOR_STATUS,
4040
playbook.GET_MONITOR_STATUS,
4141
}
@@ -93,7 +93,7 @@ func genStatusPlaybook(curveadm *cli.CurveAdm,
9393
return nil, errno.ERR_NO_SERVICES_MATCHED
9494
}
9595

96-
steps := GET_MONITOR_STATUS_PLAYBOOK_STEPS
96+
steps := STATUS_PLAYBOOK_STEPS
9797
pb := playbook.NewPlaybook(curveadm)
9898
for _, step := range steps {
9999
pb.AddStep(&playbook.PlaybookStep{
@@ -109,7 +109,7 @@ func genStatusPlaybook(curveadm *cli.CurveAdm,
109109
return pb, nil
110110
}
111111

112-
func displayStatus(curveadm *cli.CurveAdm, dcs []*configure.MonitorConfig, options statusOptions) {
112+
func displayStatus(curveadm *cli.CurveAdm, mcs []*configure.MonitorConfig, options statusOptions) {
113113
statuses := []monitor.MonitorStatus{}
114114
value := curveadm.MemStorage().Get(comm.KEY_MONITOR_STATUS)
115115
if value != nil {
@@ -122,7 +122,7 @@ func displayStatus(curveadm *cli.CurveAdm, dcs []*configure.MonitorConfig, optio
122122
output := tui.FormatMonitorStatus(statuses, options.verbose)
123123
curveadm.WriteOutln("")
124124
curveadm.WriteOutln("cluster name : %s", curveadm.ClusterName())
125-
curveadm.WriteOutln("cluster kind : %s", dcs[0].GetKind())
125+
curveadm.WriteOutln("cluster kind : %s", mcs[0].GetKind())
126126
curveadm.WriteOutln("")
127127
curveadm.WriteOut("%s", output)
128128
}

0 commit comments

Comments
 (0)