datacenter = "dc1"
data_dir = "/opt/nomad/data"
plugin_dir = "/opt/nomad/plugins"
log_level = "INFO"
name = "hcp1"

bind_addr = "hcp1.tailnet-68f9.ts.net"

addresses {
  http = "hcp1.tailnet-68f9.ts.net"
  rpc  = "hcp1.tailnet-68f9.ts.net"
  serf = "hcp1.tailnet-68f9.ts.net"
}

advertise {
  http = "hcp1.tailnet-68f9.ts.net:4646"
  rpc  = "hcp1.tailnet-68f9.ts.net:4647"
  serf = "hcp1.tailnet-68f9.ts.net:4648"
}

ports {
  http = 4646
  rpc  = 4647
  serf = 4648
}

server {
  enabled = false
}

client {
  enabled = true
  network_interface = "tailscale0"
  
  # 配置七仙女服务器地址，使用完整FQDN
  servers = [
    "semaphore.tailnet-68f9.ts.net:4647",
    "ash1d.tailnet-68f9.ts.net:4647",
    "ash2e.tailnet-68f9.ts.net:4647",
    "ch2.tailnet-68f9.ts.net:4647",
    "ch3.tailnet-68f9.ts.net:4647",
    "onecloud1.tailnet-68f9.ts.net:4647",
    "de.tailnet-68f9.ts.net:4647"
  ]
  
  # 配置host volumes
  host_volume "fnsync" {
    path = "/mnt/fnsync"
    read_only = false
  }
  
  host_volume "vault-storage" {
    path = "/opt/nomad/data/vault-storage"
    read_only = false
  }
  
  # 禁用Docker驱动，只使用Podman
  options {
    "driver.raw_exec.enable" = "1"
    "driver.exec.enable" = "1"
  }
  
  # 配置节点元数据
  meta {
    consul = "true"
    consul_version = "1.21.5"
    consul_server = "true"
  }
  
  # 激进的垃圾清理策略
  gc_interval = "5m"
  gc_disk_usage_threshold = 80
  gc_inode_usage_threshold = 70
}

plugin "nomad-driver-podman" {
  config {
    socket_path = "unix:///run/podman/podman.sock"
    volumes {
      enabled = true
    }
  }
}

consul {
  enabled = false
  server_service_name = "nomad"
  client_service_name = "nomad-client"
  auto_advertise = true
  server_auto_join = true
  client_auto_join = true
}

vault {
  enabled = true
  address = "http://master.tailnet-68f9.ts.net:8200,http://ash3c.tailnet-68f9.ts.net:8200,http://hcp1.tailnet-68f9.ts.net:8200"
  token = "hvs.A5Fu4E1oHyezJapVllKPFsWg"
  create_from_role = "nomad-cluster"
  tls_skip_verify = true
}

telemetry {
  collection_interval = "1s"
  disable_hostname = false
  prometheus_metrics = true
  publish_allocation_metrics = true
  publish_node_metrics = true
}