mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-06 23:56:37 +08:00
feat: 更新 agent.json 配置,确保主配置路径为绝对路径,并添加 agent 状态文件
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"server_url": "http://127.0.0.1:3000",
|
"server_url": "http://127.0.0.1:3000",
|
||||||
"agent_token": "2bae8c0eef58c3d7cf84464d983052ca",
|
"agent_token": "d873f8084cb7539a2d2f6273ba7fbebe",
|
||||||
"data_dir": "./data",
|
"data_dir": "./data-v5test",
|
||||||
"openresty_container_name": "atsflare-openresty",
|
"openresty_container_name": "atsflare-openresty",
|
||||||
"openresty_docker_image": "openresty/openresty:alpine",
|
"openresty_docker_image": "openresty/openresty:alpine",
|
||||||
"heartbeat_interval": 30000,
|
"heartbeat_interval": 30000,
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"node_id": "node-f79896cc731413b3",
|
||||||
|
"current_version": "",
|
||||||
|
"current_checksum": "",
|
||||||
|
"last_error": "docker openresty -t failed: exit status 1: 2026/03/12 14:59:57 [emerg] 1#1: open() \"/usr/local/openresty/nginx/conf/data-v5test/etc/nginx/conf.d/atsflare_routes.conf\" failed (2: No such file or directory) in /usr/local/openresty/nginx/conf/nginx.conf:31\nnginx: [emerg] open() \"/usr/local/openresty/nginx/conf/data-v5test/etc/nginx/conf.d/atsflare_routes.conf\" failed (2: No such file or directory) in /usr/local/openresty/nginx/conf/nginx.conf:31\nnginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed\n",
|
||||||
|
"openresty_status": "unhealthy",
|
||||||
|
"openresty_message": "docker openresty -t failed: exit status 1: 2026/03/12 14:59:57 [emerg] 1#1: open() \"/usr/local/openresty/nginx/conf/data-v5test/etc/nginx/conf.d/atsflare_routes.conf\" failed (2: No such file or directory) in /usr/local/openresty/nginx/conf/nginx.conf:31\nnginx: [emerg] open() \"/usr/local/openresty/nginx/conf/data-v5test/etc/nginx/conf.d/atsflare_routes.conf\" failed (2: No such file or directory) in /usr/local/openresty/nginx/conf/nginx.conf:31\nnginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed\n"
|
||||||
|
}
|
||||||
@@ -315,6 +315,10 @@ func NewExecutor(options ExecutorOptions) Executor {
|
|||||||
Runner: runner,
|
Runner: runner,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mainConfigPath := options.MainConfigPath
|
||||||
|
if absPath, err := filepath.Abs(mainConfigPath); err == nil {
|
||||||
|
mainConfigPath = absPath
|
||||||
|
}
|
||||||
routeConfigDir := filepath.Dir(options.RouteConfigPath)
|
routeConfigDir := filepath.Dir(options.RouteConfigPath)
|
||||||
if absDir, err := filepath.Abs(routeConfigDir); err == nil {
|
if absDir, err := filepath.Abs(routeConfigDir); err == nil {
|
||||||
routeConfigDir = absDir
|
routeConfigDir = absDir
|
||||||
@@ -327,7 +331,7 @@ func NewExecutor(options ExecutorOptions) Executor {
|
|||||||
DockerBinary: options.DockerBinary,
|
DockerBinary: options.DockerBinary,
|
||||||
ContainerName: options.ContainerName,
|
ContainerName: options.ContainerName,
|
||||||
Image: options.Image,
|
Image: options.Image,
|
||||||
MainConfigPath: options.MainConfigPath,
|
MainConfigPath: mainConfigPath,
|
||||||
RouteConfigDir: routeConfigDir,
|
RouteConfigDir: routeConfigDir,
|
||||||
CertDir: certDir,
|
CertDir: certDir,
|
||||||
NginxCertDir: options.NginxCertDir,
|
NginxCertDir: options.NginxCertDir,
|
||||||
|
|||||||
@@ -291,9 +291,15 @@ func TestNewExecutorUsesAbsoluteDockerMountPath(t *testing.T) {
|
|||||||
if !filepath.IsAbs(dockerExecutor.RouteConfigDir) {
|
if !filepath.IsAbs(dockerExecutor.RouteConfigDir) {
|
||||||
t.Fatalf("expected absolute route config dir, got %s", dockerExecutor.RouteConfigDir)
|
t.Fatalf("expected absolute route config dir, got %s", dockerExecutor.RouteConfigDir)
|
||||||
}
|
}
|
||||||
|
if !filepath.IsAbs(dockerExecutor.MainConfigPath) {
|
||||||
|
t.Fatalf("expected absolute main config path, got %s", dockerExecutor.MainConfigPath)
|
||||||
|
}
|
||||||
if !strings.HasSuffix(dockerExecutor.RouteConfigDir, filepath.Clean("data/etc/nginx/conf.d")) {
|
if !strings.HasSuffix(dockerExecutor.RouteConfigDir, filepath.Clean("data/etc/nginx/conf.d")) {
|
||||||
t.Fatalf("unexpected route config dir: %s", dockerExecutor.RouteConfigDir)
|
t.Fatalf("unexpected route config dir: %s", dockerExecutor.RouteConfigDir)
|
||||||
}
|
}
|
||||||
|
if !strings.HasSuffix(dockerExecutor.MainConfigPath, filepath.Clean("data/etc/nginx/nginx.conf")) {
|
||||||
|
t.Fatalf("unexpected main config path: %s", dockerExecutor.MainConfigPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDetectVersionFromBinary(t *testing.T) {
|
func TestDetectVersionFromBinary(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user