Commit 972d4f23 authored by jinliang's avatar jinliang

add vps feature

parent c04edc45
scp ./target/browser-backend-0.0.1-SNAPSHOT.jar root@47.119.25.86:/opt/project/
# pwd: i54EDNbD#ehbnl$4
......@@ -16,6 +16,7 @@ public enum Vendor {
awscn("亚马逊中国"),
tencent("腾讯云"),
isp("住宅"),
remote("远程设备"),
/**
* 本地ip,即 ip 地址没有设置任何代理
......
......@@ -303,7 +303,7 @@ public class BrowserTask {
return;
}
CloudPlatformConfig config = cloudPlatformConfigRepository.findByPlatformAndRegionId(
"ali",
"remote",
aliRegion);
if (Objects.isNull(config)) {
log.error(
......@@ -766,7 +766,7 @@ public class BrowserTask {
cloudPlatformOrder.getPlatformOrderId(),
cloudPlatformOrder.getRegionId());
CloudPlatformConfig config = cloudPlatformConfigRepository.findByPlatformAndRegionId(
"ali",
"remote",
cloudPlatformOrder.getRegionId());
RunInstancesResponse response1 = AliEcsRemoteClient.runInstances(
ipResource.getOwner(), ipResource.getUsername(),
......
......@@ -35,28 +35,40 @@ public class AliEcsRemoteClient {
//access_key_id
private static String getAccessKeyId() {
return "LTAI5tEdz1DY4A4oYUawUuNH";
return "LTAI5tKAfESNNtYqtnE3FRvf";
}
//access_key_secret
private static String getAccessKeySecret() {
return "8KWmYgO0QIicZpyulhEwUhZqStrTwe";
return "mcYJAxCHqMAWKRlY3dZs55AUqOpXIb";
}
//launch_template_id
//脚本userData
// PowerShell UserData for Windows ECS
private static String getUserData() {
return "#!/bin/sh\n"
+ "echo \"users %s:CL:%s\n"
+ "allow %s *\n"
+ "auth strong\n"
+ "proxy -p8880\n"
+ "proxy -p8881 -a\n"
+ "socks -p8882\n"
+ "flush\" | tee /etc/3proxy.cfg\n"
+ "systemctl restart 3proxy";
return "$script = @\"\n"
+ "Set-ExecutionPolicy Bypass -Scope Process -Force;\n"
+ "$ErrorActionPreference = 'Stop';\n"
+ "# Configure 3proxy\n"
+ "$configContent = @\"\n"
+ "users %s:CL:%s\n"
+ "allow %s *\n"
+ "auth strong\n"
+ "proxy -p8880\n"
+ "proxy -p8881 -a\n"
+ "socks -p8882\n"
+ "flush\n"
+ "\";\n"
+ "Set-Content -Path 'C:\\3proxy-0.9.4-x64\\bin64\\3proxy.cfg' -Value $configContent -Force;\n"
+ "\n"
+ "# Start 3proxy service\n"
+ "Start-Process 'net' -ArgumentList 'start 3proxy' -NoNewWindow -Wait;\n"
+ "\"@;\n"
+ "$script | Out-File -FilePath 'C:\\Windows\\Temp\\userdata.ps1' -Force;\n"
+ "Start-Process PowerShell -ArgumentList 'C:\\Windows\\Temp\\userdata.ps1' -NoNewWindow -Wait;";
}
/*
* @Description //创建链接
* @Date 2024/7/25 10:32
......
......@@ -82,7 +82,7 @@ public enum RegionMappingEnum {
Random random = new Random();
int randomNumber = random.nextInt(2);
if(randomNumber == 0){
return RegionMappingEnum.US_CALIFORNIA;
return RegionMappingEnum.SILICON;
}else {
return RegionMappingEnum.US_VIRGINIA;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment