[ 项目 ] 修改CI CD流程 - 2
This commit is contained in:
@@ -17,10 +17,10 @@ var P = g.G.P
|
||||
|
||||
var AgentServerInfoCache = ®ister.AgentServerInfo{}
|
||||
|
||||
func INIT() *register.AgentServerInfo {
|
||||
func INIT(agentServerInfoConf string) *register.AgentServerInfo {
|
||||
|
||||
// 获取系统的环境变量
|
||||
agentServerInfo := parseAgentServerInfo()
|
||||
agentServerInfo := parseAgentServerInfo(agentServerInfoConf)
|
||||
|
||||
agentConfig := g.G.AgentConfig
|
||||
|
||||
@@ -164,13 +164,11 @@ func shutdownRegisterQueueConnection(initFromServerQueue *rabbitmq.RabbitQueue,
|
||||
log.InfoF("Pretend to Shutdown register queue connection !")
|
||||
}
|
||||
|
||||
func parseAgentServerInfo() *register.AgentServerInfo {
|
||||
func parseAgentServerInfo(agentServerInfoConf string) *register.AgentServerInfo {
|
||||
|
||||
// 约定文件地址为 /etc/environment.d/octopus-agent.conf
|
||||
// 目前使用
|
||||
// 约定文件地址为 /octopus-agent/octopus-agent.conf
|
||||
var agentServerInfo *register.AgentServerInfo
|
||||
//yamlFile, err := ioutil.ReadFile("C:\\Users\\wdd\\IdeaProjects\\ProjectOctopus\\agent-go\\server-env.yaml")
|
||||
yamlFile, err := ioutil.ReadFile("server-env.yaml")
|
||||
yamlFile, err := ioutil.ReadFile(agentServerInfoConf)
|
||||
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("failed to read YAML file: %v", err))
|
||||
|
||||
@@ -14,18 +14,19 @@ func main() {
|
||||
|
||||
// 解析命令行参数
|
||||
var version string
|
||||
var agentInfoConf string
|
||||
var agentServerInfoConf string
|
||||
flag.StringVar(&version, "version", "", "config file version")
|
||||
flag.StringVar(&agentInfoConf, "agentInfoConf", "", "agent server info conf file")
|
||||
flag.StringVar(&agentServerInfoConf, "agentServerInfoConf", "", "agent server info conf file")
|
||||
flag.Parse()
|
||||
// 读取对应版本的配置文件
|
||||
filename := fmt.Sprintf("octopus-agent-%s.yaml", version)
|
||||
println("config file name is => " + filename)
|
||||
println("agent server info file is => " + agentServerInfoConf)
|
||||
|
||||
// 初始化Nacos的连接配置
|
||||
g.G.AgentConfig = register.ParseConfiguration(filename)
|
||||
|
||||
// 执行初始化之策工作
|
||||
AgentServerInfoCache = INIT()
|
||||
AgentServerInfoCache = INIT(agentServerInfoConf)
|
||||
|
||||
}
|
||||
|
||||
91
agent-go/octopus-agent-shanghai.yaml
Normal file
91
agent-go/octopus-agent-shanghai.yaml
Normal file
@@ -0,0 +1,91 @@
|
||||
server:
|
||||
port: 8000
|
||||
|
||||
logging:
|
||||
level:
|
||||
web: info
|
||||
|
||||
octopus:
|
||||
message:
|
||||
# agent boot up default common exchange
|
||||
init_exchange: InitExchange
|
||||
# server will send message to agent using this common queue
|
||||
init_to_server: InitToServer
|
||||
# agent boot up default common exchange routing key
|
||||
init_to_server_key: InitToServerKey
|
||||
# server will receive message from agent using this common queue
|
||||
init_from_server: InitFromServer
|
||||
# agent boot up default common exchange routing key
|
||||
init_from_server_key: InitFromServerKey
|
||||
# initialization register time out (unit ms) default is 5 min
|
||||
init_ttl: "3000000"
|
||||
# Octopus Exchange Name == server comunicate with agent
|
||||
octopus_exchange: OctopusExchange
|
||||
# Octopus Message To Server == all agent send info to server queue and topic
|
||||
octopus_to_server: OctopusToServer
|
||||
executor:
|
||||
name: executor-functions
|
||||
status:
|
||||
name: octopus-agent
|
||||
healthy:
|
||||
type: cron
|
||||
cron: 10 */1 * * * ? *
|
||||
start-delay: 30
|
||||
metric:
|
||||
pinch: 20
|
||||
agent:
|
||||
executor:
|
||||
# agent执行一条Command的最长超时时间
|
||||
processMaxTimeOut: 60
|
||||
status:
|
||||
app:
|
||||
- Nginx/nginx
|
||||
- MySQL/mysql
|
||||
- Xray/xray
|
||||
- OctopusAgent/octopus-agent
|
||||
- Redis/redis
|
||||
- RabbitMQ/rabbitmq
|
||||
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
allow-bean-definition-overriding: true
|
||||
rabbitmq:
|
||||
host: 42.192.52.227
|
||||
# host: 192.168.35.71
|
||||
port: 20672
|
||||
username: boge
|
||||
password: boge8tingH
|
||||
virtual-host: /
|
||||
listener:
|
||||
simple:
|
||||
retry:
|
||||
# ack failed will reentrant the Rabbit Listener
|
||||
max-attempts: 2
|
||||
enabled: true
|
||||
# retry interval unit ms
|
||||
max-interval: 65000
|
||||
initial-interval: 65000
|
||||
|
||||
#spring:
|
||||
# application:
|
||||
# name: octopus-agent
|
||||
# profiles:
|
||||
# active: dev
|
||||
# cloud:
|
||||
# nacos:
|
||||
# config:
|
||||
# group: dev
|
||||
# config-retry-time: 3000
|
||||
# file-extension: yaml
|
||||
# max-retry: 3
|
||||
# # server-addr: "150.230.198.103:21060"
|
||||
# server-addr: "42.192.52.227:21060"
|
||||
# timeout: 5000
|
||||
# config-long-poll-timeout: 5000
|
||||
# extension-configs:
|
||||
# - group: dev
|
||||
# data-id: "common-dev.yaml"
|
||||
#
|
||||
#server:
|
||||
# port: 8000
|
||||
Reference in New Issue
Block a user