51 lines
897 B
HCL
51 lines
897 B
HCL
job "nfs-app-example" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
group "app" {
|
|
count = 1
|
|
|
|
# 使用NFS存储卷
|
|
volume "nfs-storage" {
|
|
type = "host"
|
|
read_only = false
|
|
source = "nfs-fnsync"
|
|
}
|
|
|
|
task "web-app" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "nginx:alpine"
|
|
ports = ["http"]
|
|
|
|
# 挂载NFS卷到容器
|
|
mount {
|
|
type = "volume"
|
|
target = "/usr/share/nginx/html"
|
|
source = "nfs-storage"
|
|
readonly = false
|
|
}
|
|
}
|
|
|
|
resources {
|
|
cpu = 100
|
|
memory = 128
|
|
}
|
|
|
|
service {
|
|
name = "nfs-web-app"
|
|
port = "http"
|
|
|
|
tags = ["nfs", "web"]
|
|
|
|
check {
|
|
type = "http"
|
|
path = "/"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |