[AGENT][INIT] 优化启动流程代码

This commit is contained in:
zeaslity
2023-03-02 11:50:42 +08:00
parent cd5c1c3788
commit c3b2ce84a3
4 changed files with 35 additions and 3 deletions

View File

@@ -41,4 +41,7 @@
# 所有的主机
Phoenix-amd64-02,Phoenix-arm64-01,Phoenix-arm64-02,London-amd64-01,London-amd64-02,London-arm64-01,London-arm64-02
Tokyo-amd64-13-6e8a19, Tokyo-amd64-07-f66a41, Phoenix-arm64-01-52c2f4, Phoenix-amd64-02-2a45bb, Phoenix-arm64-02-7b95ac, London-arm64-02-9ee6ba, London-amd64-01-0b219f, London-amd64-02-c155d1, London-arm64-01-72519e
AllHosts=(Phoenix-arm64-01 Phoenix-arm64-02 London-arm64-02 London-amd64-01 London-amd64-02 London-arm64-01 Phoenix-amd64-02 Shanghai-amd64-01 Seoul-amd64-04)
Tokyo-amd64-13-6e8a19, Tokyo-amd64-07-f66a41, Phoenix-arm64-01-52c2f4, Phoenix-amd64-02-2a45bb, Phoenix-arm64-02-7b95ac, London-arm64-02-9ee6ba, London-amd64-01-0b219f, London-amd64-02-c155d1, London-arm64-01-72519e

View File

@@ -68,6 +68,14 @@ public class XrayDBOperator {
String serverCity = serverInfoVO
.getLocation()
.split(" ")[0];
// fix bug for Seoul的情况 tmd
if (!ALL_SERVER_CITY_INDEX.containsKey(serverCity)) {
serverCity = serverInfoVO
.getLocation()
.split(" ")[1];
}
int cityBitMapBase = ALL_SERVER_CITY_INDEX.get(serverCity) * 10;
int serverGraphNum = cityBitMapBase;
for (int index = cityBitMapBase; index < cityBitMapBase + 10; index++) {

View File

@@ -1,3 +1,15 @@
127.0.0.1 localhost
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
146.56.147.12 Seoul-arm64-01 seoul-0 s0
146.56.159.175 Seoul-arm64-02 seoul-5 s5

View File

@@ -133,7 +133,7 @@ FunctionEnd() {
echo ""
}
tmp () {
tmp() {
gcloud compute instances create tokyo-amd64-07 --project=compact-lacing-371804 --zone=asia-northeast1-b --machine-type=n2d-custom-2-4096 --network-interface=network-tier=PREMIUM,subnet=default --metadata=startup-script=wget\ https://happybirthday.107421.xyz/shell/agent-bootup.sh\ \&\&\ chmod\ \+x\ agent-bootup.sh\ \&\&\ /bin/bash\ agent-bootup.sh --can-ip-forward --maintenance-policy=MIGRATE --provisioning-model=STANDARD --service-account=172889627951-compute@developer.gserviceaccount.com --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --create-disk=auto-delete=yes,boot=yes,device-name=octopus-agent-2c-4g,image=projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221213,mode=rw,size=20,type=projects/compact-lacing-371804/zones/us-west4-b/diskTypes/pd1-ssd --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any
@@ -154,5 +154,14 @@ tmp () {
docker exec -it octopus-server /bin/bash -c "wget https://arthas.aliyun.com/arthas-boot.jar && java -jar arthas-boot.jar"
}
AllHosts=(Phoenix-arm64-01 Phoenix-arm64-02 London-arm64-02 London-amd64-01 London-amd64-02 London-arm64-01 Phoenix-amd64-02 Shanghai-amd64-01 Seoul-amd64-04)
for host in ${AllHosts[*]}; do
echo "当前主机为: ${host}"
ssh -p 22333 root@"$host" "systemctl restart octopus-agent"
done
}