Database
In this example, we will use a Valkey server as the storage database. The Redis data will be stored in the directory /data/valkey-data
.
Valkey Job Configuration
Below is the Nomad job specification for deploying the Valkey server:
valkey.hcl
job "valkey" {
group "cache" {
network {
port "valkey" {
to = 6379
static = 6379
}
}
task "valkey" {
driver = "docker"
config {
image = "valkey/valkey:8.1"
ports = [ "valkey" ]
mounts {
type = "bind"
source = "/data/valkey-data"
target = "/data"
}
}
}
service {
name = "valkey"
port = "valkey"
check {
name = "valkey_check"
type = "tcp"
interval = "10s"
timeout = "5s"
}
}
}
}
Steps to Deploy
Create the Data Directory Ensure the directory for storing Valkey data exists by running:
mkdir -p /data/valkey-data
Deploy the Job to Nomad Use the following command to deploy the Valkey job:
nomad run valkey.hcl