我是Noamd的新手。我想部署用Node.js编写的微服务之一。我的本地计算机中有微服务。从Nomad Docs了解到,我可以运行exec驱动程序来执行二进制文件。 我已经在startNotificationService.sh文件中编写了外壳脚本,该脚本启动了我的microservice.shell脚本文件(startNotificationService.sh)的位置是/home/medium/startNotificationService.sh
我的example.nomad文件看起来像这样。
job "microservices" {
datacenters = ["dc1"]
type = "service"
# constraint {
# attribute = "${attr.kernel.name}"
# value = "linux"
# }
update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "3m"
progress_deadline = "10m"
auto_revert = false
canary = 0
}
migrate {
max_parallel = 1
health_check = "checks"
min_healthy_time = "10s"
healthy_deadline = "5m"
}
group "Medium" {
count = 1
restart {
attempts = 2
interval = "30m"
delay = "15s"
mode = "fail"
}
ephemeral_disk {
size = 300
}
task "NotificationService" {
driver = "exec
config {
command = "/home/medium/startNotificationService.sh"
}
resources {
cpu = 500 # 500 MHz
memory = 256 # 256MB
network {
mbits = 10
port "http" {
static = 3200
}
}
}
}
}
}
客户端文件的配置为 log_level =“调试”
# Setup data dir
data_dir = "/tmp/client"
# Give the agent a unique name. Defaults to hostname
name = "Nomadclient"
# Enable the client
client {
enabled = true
# For demo assume we are talking to server1. For production,
# this should be like "nomad.service.consul:4647" and a system
# like Consul used for service discovery.
servers = ["172.16.18.114:4647"]
}
# Modify our port to avoid a collision with server1
ports {
http = 5656
}
服务器文件配置
# Increase log verbosity
log_level = "DEBUG"
# Setup data dir
data_dir = "/tmp/server1"
bind_addr = "0.0.0.0"
# Give the agent a unique name. Defaults to hostname
name = "server"
# Enable the server
server {
enabled = true
# Self-elect, should be 3 or 5 for production
bootstrap_expect = 2
}
我的评估和任务分配已成功完成,但是部署问题来了。请帮助