This commit is contained in:
Daniel Berteaud 2024-01-26 22:16:47 +01:00
parent c3b6ceaf99
commit e2f8a32d1c
6 changed files with 34 additions and 39 deletions

View File

@ -1,4 +1,4 @@
FROM danielberteaud/alpine:24.1-6
FROM danielberteaud/alpine:24.1-8
MAINTAINER Daniel Berteaud <dbd@ehtrace.com>
ARG MINIFLUX_VERSION=2.0.51

View File

@ -22,7 +22,6 @@ job "miniflux" {
connect {
sidecar_service {
proxy {
@ -33,6 +32,18 @@ job "miniflux" {
}
}
sidecar_task {
config {
args = [
"-c",
"${NOMAD_SECRETS_DIR}/envoy_bootstrap.json",
"-l",
"${meta.connect.log_level}",
"--concurrency",
"${meta.connect.proxy_concurrency}",
"--disable-hot-restart"
]
}
resources {
cpu = 50
memory = 64
@ -63,6 +74,9 @@ job "miniflux" {
]
}
# wait for required services tp be ready before starting the main task
task "wait-for" {
@ -94,7 +108,6 @@ job "miniflux" {
task "miniflux" {
driver = "docker"

View File

@ -1,19 +0,0 @@
#!/bin/sh
set -eu
if [ "miniflux" != "miniflux" ]; then
for DIR in vault consul nomad; do
if [ -d output/${DIR} ]; then
for FILE in $(find output/${DIR} -name "*miniflux*.hcl" -type f); do
NEW_FILE=$(echo "${FILE}" | sed -E "s/miniflux/miniflux/g")
mv "${FILE}" "${NEW_FILE}"
done
fi
done
fi

View File

@ -1,6 +1,6 @@
[[- $c := merge .miniflux . -]]
job [[ .instance | toJSON ]] {
job "[[ .instance ]]" {
[[ template "common/job_start" $c ]]
@ -24,7 +24,6 @@ job [[ .instance | toJSON ]] {
port = 8085
[[ template "common/prometheus_meta" $c ]]
[[ template "common/connect" $c ]]
check {
@ -41,32 +40,30 @@ job [[ .instance | toJSON ]] {
}
tags = [
[[- if $c.traefik.enabled ]]
"[[ $c.traefik.instance ]].enable=true",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].rule=Host(`[[ (urlParse .miniflux.public_url).Hostname ]]`)
[[- if not (regexp.Match "^/?$" (urlParse .miniflux.public_url).Path) ]] && PathPrefix(`[[ (urlParse .miniflux.public_url).Path ]]`)[[ end ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].entrypoints=[[ join $c.traefik.entrypoints "," ]]",
[[- if not (regexp.Match "^/?$" (urlParse .miniflux.public_url).Path) ]]
[[- if not (regexp.Match "^/?$" (urlParse .miniflux.public_url).Path) ]]
"[[ $c.traefik.instance ]].http.middlewares.[[ .instance ]][[ .consul.suffix ]]-prefix.stripprefix.prefixes=[[ (urlParse .miniflux.public_url).Path ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ .instance ]][[ .consul.suffix ]]-prefix,[[ template "common/traefik_middlewares" $c.traefik ]]",
[[- else ]]
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ template "common/traefik_middlewares" $c.traefik ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ .instance ]][[ .consul.suffix ]]-prefix,[[ template "common/traefik_middlewares" $c ]]",
[[- else ]]
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ template "common/traefik_middlewares" $c ]]",
[[- end ]]
[[- end ]]
]
}
[[- if $c.prometheus.enabled ]]
[[ template "common/task.metrics_proxy" $c ]]
[[- end ]]
[[ template "common/task.wait_for" $c ]]
[[ template "common/task.pgpooler" $c ]]
task "miniflux" {
driver = [[ $c.nomad.driver | toJSON ]]
driver = "[[ $c.nomad.driver ]]"
config {
image = [[ .miniflux.image | toJSON ]]
image = "[[ .miniflux.image ]]"
pids_limit = 100
readonly_rootfs = true
}
@ -75,7 +72,7 @@ job [[ .instance | toJSON ]] {
env {
LISTEN_ADDR = "127.0.0.1:8085"
BASE_URL = [[ .miniflux.public_url | toJSON ]]
BASE_URL = "[[ .miniflux.public_url ]]"
[[- if $c.prometheus.enabled ]]
METRICS_COLLECTOR = 1
[[- end ]]
@ -96,9 +93,8 @@ _EOT
env = true
}
[[ template "common/file_env" $c.env ]]
[[ template "common/resources" .miniflux.resources ]]
[[ template "common/file_env" $c ]]
[[ template "common/resources" $c ]]
}
}
}

View File

@ -1 +0,0 @@
[[ template "common/mv_conf.sh" dict "ctx" . "services" (dict "miniflux" .instance) ]]

View File

@ -39,6 +39,12 @@ miniflux:
# Public URL of the service
public_url: https://flux.example.org
# Traefik settings
traefik:
middlewares:
- compression@file
- csp-relaxed@file
# Prometheus configuration
prometheus:
metrics_url: http://localhost:8085/metrics