So we have noticed that once a nomad job completes the data directory vanishes after some time . Is there a way for a particular job(not all) to be persistent for say a week or 2 days or a specified time ? Is this configurable in the job definition and if anyone has used this with success ?
Host volumes. You can define a host volume in your Nomad client configuration:
client {
host_volume "persistent-data" {
path = "/opt/nomad/data"
read_only = false
}
}
And after that in your nomad job file:
volume_mount {
volume = "persistent-data"
destination = "/path/in/container"
}
References: Stateful workloads with Nomad host volumes | Nomad | HashiCorp Developer
Thanks @dvlpmike .Will try it out