Skip to content

Commit d51ef71

Browse files
author
liuminjian
committed
1.add http deployment method
Signed-off-by: liuminjian <[email protected]>
1 parent 28372fe commit d51ef71

File tree

8 files changed

+16
-11
lines changed

8 files changed

+16
-11
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ GO := go
2121

2222
# output
2323
OUTPUT := bin/curveadm
24-
SERVER_OUTPUT := bin/pigeon
2524

2625
# build flags
2726
LDFLAGS := -s -w
@@ -53,7 +52,6 @@ TEST_FLAGS += -run $(CASE)
5352

5453
# packages
5554
PACKAGES := $(PWD)/cmd/curveadm/main.go
56-
SERVER_PACKAGES := $(PWD)/cmd/service/main.go
5755

5856
# tar
5957
VERSION := "unknown"

cli/command/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func addSubCommands(cmd *cobra.Command, curveadm *cli.CurveAdm) {
6767
target.NewTargetCommand(curveadm), // curveadm target ...
6868
pfs.NewPFSCommand(curveadm), // curveadm pfs ...
6969
monitor.NewMonitorCommand(curveadm), // curveadm monitor ...
70-
daemon.NewDaemonCommand(curveadm), // curveadm http
70+
daemon.NewDaemonCommand(curveadm), // curveadm deamon ...
7171

7272
NewAuditCommand(curveadm), // curveadm audit
7373
NewCleanCommand(curveadm), // curveadm clean

cli/command/daemon/cmd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
/*
1818
* Project: Curveadm
19-
* Created Date: 2023-03-31
20-
* Author: wanghai (SeanHai)
19+
* Created Date: 2023-12-13
20+
* Author: liuminjian
2121
*/
2222

2323
package daemon
@@ -31,7 +31,7 @@ import (
3131
func NewDaemonCommand(curveadm *cli.CurveAdm) *cobra.Command {
3232
cmd := &cobra.Command{
3333
Use: "daemon",
34-
Short: "Manage http service",
34+
Short: "Manage curveadm deamon service",
3535
Args: cliutil.NoArgs,
3636
RunE: cliutil.ShowHelp(curveadm.Err()),
3737
}

internal/configure/hosts/hc_get.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ func (hc *HostConfig) GetConnectConfig() *module.ConnectConfig {
141141
BecomeUser: hc.GetBecomeUser(),
142142
ConnectTimeoutSec: curveadm.GlobalCurveAdmConfig.GetSSHTimeout(),
143143
ConnectRetries: curveadm.GlobalCurveAdmConfig.GetSSHRetries(),
144+
Protocol: hc.GetProtocol(),
144145
}
145146
}
146147

internal/configure/hosts/hosts.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/opencurve/curveadm/internal/configure/os"
3333
"github.com/opencurve/curveadm/internal/errno"
3434
"github.com/opencurve/curveadm/internal/utils"
35+
"github.com/opencurve/curveadm/pkg/module"
3536
"github.com/spf13/viper"
3637
)
3738

@@ -158,7 +159,7 @@ func (hc *HostConfig) Build() error {
158159
F("hosts[%d].private_key_file = %s", hc.sequence, privateKeyFile)
159160
}
160161

161-
if hc.GetForwardAgent() == false {
162+
if hc.GetForwardAgent() == false && hc.GetProtocol() == module.SSH_PROTOCOL {
162163
if !utils.PathExist(privateKeyFile) {
163164
return errno.ERR_PRIVATE_KEY_FILE_NOT_EXIST.
164165
F("%s: no such file", privateKeyFile)

internal/task/task/checker/ssh.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"github.com/opencurve/curveadm/internal/task/step"
3636
"github.com/opencurve/curveadm/internal/task/task"
3737
"github.com/opencurve/curveadm/internal/utils"
38+
"github.com/opencurve/curveadm/pkg/module"
3839
)
3940

4041
const (
@@ -51,7 +52,7 @@ func doNothing() step.LambdaType {
5152
func checkHost(hc *hosts.HostConfig) step.LambdaType {
5253
return func(ctx *context.Context) error {
5354
privateKeyFile := hc.GetPrivateKeyFile()
54-
if hc.GetForwardAgent() == false {
55+
if hc.GetForwardAgent() == false && hc.GetProtocol() == module.SSH_PROTOCOL {
5556
if !utils.PathExist(privateKeyFile) {
5657
return errno.ERR_PRIVATE_KEY_FILE_NOT_EXIST.
5758
F("%s: no such file", privateKeyFile)

pkg/module/remote_client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ type RemoteClient interface {
5353
}
5454

5555
func NewRemoteClient(cfg *ConnectConfig) (client RemoteClient, err error) {
56+
if cfg == nil {
57+
return
58+
}
59+
5660
if cfg.Protocol == SSH_PROTOCOL {
5761
client, err = NewSSHClient(*cfg.GetSSHConfig())
5862
if err != nil {

scripts/install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ backup() {
4747
}
4848

4949
setup() {
50-
mkdir -p "${g_curveadm_home}"/{bin,data,module,logs,conf,temp}
51-
50+
mkdir -p "${g_curveadm_home}"/{bin,data,module,logs,temp}
51+
mkdir -p "${g_curveadm_home}"/daemon/{logs,conf}
5252
# generate config file
5353
local confpath="${g_curveadm_home}/curveadm.cfg"
5454
if [ ! -f "${confpath}" ]; then
@@ -70,7 +70,7 @@ __EOF__
7070

7171

7272
# generate http service config file
73-
local httpConfpath="${g_curveadm_home}/conf/pigeon.yaml"
73+
local httpConfpath="${g_curveadm_home}/daemon/conf/pigeon.yaml"
7474
if [ ! -f $httpConfpath ]; then
7575
cat << __EOF__ > $httpConfpath
7676
servers:

0 commit comments

Comments
 (0)