# Example PostgreSQL job file: https://github.com/GuyBarros/nomad_jobs/blob/master/postgresSQL.nomad job "postgres" { datacenters = ["dc1"] type = "service" group "postgres" { count = 1 volume "postgres-data" { type = "host" read_only = false source = "postgres-data" } network { mode = "bridge" # port "db" { # static = 5432 # to = 5432 # } } service { name = "postgres" port = "5432" # check { # name = "alive" # type = "tcp" # interval = "10s" # timeout = "2s" # } connect { sidecar_service {} } } task "postgres" { driver = "docker" config { # ports = ["db"] image = "postgres" } volume_mount { volume = "postgres-data" destination = "/var/lib/postgresql/data" read_only = false } template { # Consul Template only works in template stanza. # We need it to fetch secret values from Consul. # The "env = true" parameter sets the environment with the data. # "destination" key is required but its value doesn't matter. data = <