Created
March 3, 2023 08:22
-
-
Save langerma/813d445e08d1c7c5bee1a543a4c9249a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# There can only be a single job definition per file. | |
# Create a job with ID and Name 'example' | |
job "postgres" { | |
datacenters = ["hetzner"] | |
constraint { | |
attribute = "${attr.kernel.name}" | |
value = "linux" | |
} | |
update { | |
stagger = "10s" | |
max_parallel = 1 | |
} | |
group "database" { | |
network { | |
#mode = "host" | |
port "db" { | |
static = 5432 | |
} | |
} | |
restart { | |
attempts = 2 | |
interval = "1m" | |
delay = "10s" | |
mode = "fail" | |
} | |
ephemeral_disk { | |
migrate = true | |
# size = "200" | |
sticky = true | |
} | |
# volume "postgres" { | |
# type = "csi" | |
# read_only = false | |
# source = "postgres-data" | |
# access_mode = "multi-node-multi-writer" | |
# attachment_mode = "file-system" | |
#} | |
task "postgres" { | |
driver = "docker" | |
#volume_mount { | |
# volume = "postgres" | |
# destination = "/var/lib/postgresql/data" | |
# read_only = false | |
#} | |
config { | |
hostname = "postgres" | |
image = "postgres:12" | |
ports = ["db"] | |
network_mode = "host" | |
#args = [ | |
# "--user 1000:1000" | |
#] | |
#volumes = [ "/nfs/postgres:/var/lib/postgresql/data" ] | |
} | |
service { | |
name = "${TASKGROUP}-postgres" | |
tags = [ | |
"global", | |
"database", | |
] | |
port = "db" | |
check { | |
name = "alive" | |
type = "tcp" | |
interval = "10s" | |
timeout = "2s" | |
} | |
} | |
env { | |
PGDATA = "/local/pgdata" | |
POSTGRES_PASSWORD = "druidpassword" | |
POSTGRES_USER = "druid" | |
POSTGRES_DB = "druid" | |
} | |
resources { | |
cpu = 200 # 500 MHz | |
memory = 256 # 256MB | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment