A simple container running Postgres and Patroni useful for dropping directly into a Hashicorp environment (Nomad + Consul + Vault)
It also comes pre-baked with some tools and extensions
Still running an older Postgres version?
These branches are mostly supported containing older versions. If I get behind on a point release feel free to raise an issue 👍
job "postgres-16" {
type = "service"
datacenters = ["dc1"]
group "group" {
count = 1
network {
port api { to = 8080 }
port pg { to = 5432 }
}
task "db" {
driver = "docker"
template {
data = <<EOL
scope: postgres
name: pg-{{env "node.unique.name"}}
namespace: /nomad
restapi:
listen: 0.0.0.0:{{env "NOMAD_PORT_api"}}
connect_address: {{env "NOMAD_ADDR_api"}}
consul:
host: localhost
register_service: true
# bootstrap config
EOL
destination = "/secrets/patroni.yml"
}
config {
image = "ghcr.io/ccakes/nomad-pgsql-patroni:16.2-1.tsdb_gis"
ports = ["api", "pg"]
}
resources {
memory = 1024
}
}
}
}
An example docker-compose file and patroni config is included to see this running.
$ docker-compose -f docker-compose.test.yml up