This commit is contained in:
Daniel Berteaud 2024-04-22 14:22:11 +02:00
parent 88352dec8b
commit 594cae279d
3 changed files with 35 additions and 21 deletions

View File

@ -4,13 +4,7 @@ job "[[ .instance ]]" {
group "server" {
[[ $c := merge .elasticsearch.server .elasticsearch . ]]
count = [[ $c.count ]]
[[ template "common/constraints" $c ]]
# Wait a few seconds between service deregistration from consul catalog and task kill
shutdown_delay = "6s"
[[ template "common/group_start" $c ]]
network {
mode = "bridge"
@ -40,8 +34,8 @@ job "[[ .instance ]]" {
"-c",
"set -e; STATUS=$(curl localhost:9200/_cluster/health?local=true | jq -r .status); if [ \"$STATUS\" == \"green\" ]; then exit 0; elif [ \"$STATUS\" == \"yellow\" ]; then exit 1; else exit 2; fi"
]
interval = "30s"
timeout = "8s"
interval = "[[ $c.consul.check.interval ]]"
timeout = "[[ $c.consul.check.timeout ]]"
}
tags = [
@ -68,9 +62,8 @@ job "[[ .instance ]]" {
kill_timeout = "120s"
config {
image = "[[ $c.image ]]"
[[ template "common/image" $c ]]
pids_limit = 1024
readonly_rootfs = true
volumes = [
"secrets/entrypoint.env:/entrypoint.d/94-elasticsearch-users.env"
]
@ -184,6 +177,8 @@ _EOT
[[- if conv.ToBool $c.prometheus.enabled ]]
[[- $e := merge .elasticsearch.exporter .elasticsearch . ]]
[[ template "common/task.metrics_proxy" $e ]]
# Prometheus exporter
task "exporter" {
driver = "[[ $e.nomad.driver ]]"
@ -194,9 +189,8 @@ _EOT
}
config {
image = "[[ $e.image ]]"
[[ template "common/image" $e ]]
pids_limit = 100
readonly_rootfs = true
command = "elasticsearch_exporter"
args = [
"--web.listen-address=127.0.0.1:9114"
@ -208,8 +202,6 @@ _EOT
[[ template "common/resources" $e ]]
}
[[ template "common/task.metrics_proxy" $e ]]
[[- end ]]
}
}

View File

@ -8,8 +8,8 @@ job "elasticsearch" {
group "server" {
count = 3
count = 3
shutdown_delay = "6s"
constraint {
@ -18,8 +18,11 @@ job "elasticsearch" {
}
# Wait a few seconds between service deregistration from consul catalog and task kill
shutdown_delay = "6s"
ephemeral_disk {
# Use minimal ephemeral disk
size = 101
}
network {
mode = "bridge"
@ -89,7 +92,7 @@ job "elasticsearch" {
"set -e; STATUS=$(curl localhost:9200/_cluster/health?local=true | jq -r .status); if [ \"$STATUS\" == \"green\" ]; then exit 0; elif [ \"$STATUS\" == \"yellow\" ]; then exit 1; else exit 2; fi"
]
interval = "30s"
timeout = "8s"
timeout = "5s"
}
tags = [
@ -118,8 +121,9 @@ job "elasticsearch" {
config {
image = "danielberteaud/elasticsearch:8.13.2-1"
pids_limit = 1024
readonly_rootfs = true
pids_limit = 1024
volumes = [
"secrets/entrypoint.env:/entrypoint.d/94-elasticsearch-users.env"
]

View File

@ -342,6 +342,23 @@ function build_sqlite {
fi
IMAGE_SQLITE_AVAILABLE=1
}
function build_valkey {
if [ "${IMAGE_VALKEY_AVAILABLE:-0}" = "1" ]; then
echo "Image danielberteaud/valkey:24.4-1 already available"
return
fi
if ! docker manifest inspect danielberteaud/valkey:24.4-1 > /dev/null 2>&1; then
echo "Building valkey:24.4-1"
export BUILDKIT_PROGRESS=plain
docker build -t danielberteaud/valkey:24.4-1 -t danielberteaud/valkey:latest output/images/valkey &&\
docker push danielberteaud/valkey:24.4-1 &&\
docker push danielberteaud/valkey:latest &&\
echo "danielberteaud/valkey:24.4-1 pushed to remote repo"
else
echo "Image danielberteaud/valkey:24.4-1 already available"
fi
IMAGE_VALKEY_AVAILABLE=1
}
function build_wait_for {
if [ "${IMAGE_WAIT_FOR_AVAILABLE:-0}" = "1" ]; then
echo "Image danielberteaud/wait-for:24.4-1 already available"
@ -396,6 +413,7 @@ build_php83
build_postgres15
build_postgres16
build_sqlite
build_valkey
build_wait_for
build_wkhtmltopdf