2022-05-26 12:19:32 +00:00
|
|
|
job "crowdsec-api" {
|
|
|
|
datacenters = ["homelab"]
|
2022-10-29 08:40:01 +00:00
|
|
|
type = "service"
|
2022-05-26 12:19:32 +00:00
|
|
|
meta {
|
|
|
|
forcedeploy = "-1"
|
|
|
|
}
|
2022-10-29 08:40:01 +00:00
|
|
|
vault {
|
2022-05-26 12:19:32 +00:00
|
|
|
policies = ["access-tables"]
|
|
|
|
}
|
|
|
|
group "crowdsec-api" {
|
|
|
|
network {
|
|
|
|
mode = "host"
|
|
|
|
port "http" {
|
2022-05-26 16:24:51 +00:00
|
|
|
static = 8898
|
2022-10-29 08:40:01 +00:00
|
|
|
to = 8080
|
2022-05-26 12:19:32 +00:00
|
|
|
}
|
2022-10-29 08:40:01 +00:00
|
|
|
port "metric" {
|
2022-05-26 12:19:32 +00:00
|
|
|
to = 6060
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task "crowdsec-api" {
|
2022-10-29 08:40:01 +00:00
|
|
|
service {
|
|
|
|
name = "crowdsec-metrics"
|
2022-05-26 12:19:32 +00:00
|
|
|
port = "metric"
|
|
|
|
tags = [
|
|
|
|
]
|
|
|
|
}
|
2022-10-29 08:40:01 +00:00
|
|
|
driver = "docker"
|
2022-05-26 12:19:32 +00:00
|
|
|
service {
|
2022-10-29 08:40:01 +00:00
|
|
|
name = "crowdsec-api"
|
2022-05-26 12:19:32 +00:00
|
|
|
port = "http"
|
|
|
|
tags = [
|
|
|
|
|
|
|
|
]
|
|
|
|
}
|
|
|
|
config {
|
2022-10-29 08:40:01 +00:00
|
|
|
image = "crowdsecurity/crowdsec"
|
|
|
|
ports = ["http", "metric"]
|
2022-05-26 12:19:32 +00:00
|
|
|
volumes = [
|
|
|
|
"/mnt/diskstation/nomad/crowdsec/db:/var/lib/crowdsec/data",
|
|
|
|
"/mnt/diskstation/nomad/crowdsec/data:/etc/crowdsec_data",
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
template {
|
2022-10-29 08:40:01 +00:00
|
|
|
data = <<EOH
|
2022-05-26 12:19:32 +00:00
|
|
|
DISABLE_AGENT = "true"
|
|
|
|
{{with secret "secrets/data/crowdsec"}}
|
|
|
|
AGENT_USERNAME = "{{.Data.data.AGENT_USERNAME}}"
|
|
|
|
AGENT_PASSWORD = "{{.Data.data.AGENT_PASSWORD}}"
|
|
|
|
{{end}}
|
|
|
|
EOH
|
2022-10-29 08:40:01 +00:00
|
|
|
destination = "secret/api.env"
|
|
|
|
env = "true"
|
2022-05-26 12:19:32 +00:00
|
|
|
}
|
|
|
|
resources {
|
|
|
|
memory = 99
|
|
|
|
}
|
|
|
|
}
|
2022-10-29 08:40:01 +00:00
|
|
|
|
2022-05-26 12:19:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|