add varnish cache between tricot and plume
This commit is contained in:
parent
f21ec907a6
commit
f37623821d
2 changed files with 48 additions and 12 deletions
|
@ -28,7 +28,7 @@ MIGRATION_DIRECTORY=migrations/postgres
|
|||
|
||||
USE_HTTPS=0
|
||||
ROCKET_ADDRESS=::
|
||||
ROCKET_PORT={{ env "NOMAD_PORT_web_port" }}
|
||||
ROCKET_PORT={{ env "NOMAD_PORT_back_port" }}
|
||||
|
||||
MEDIA_UPLOAD_DIRECTORY=/app/static/media
|
||||
SEARCH_INDEX=/app/search_index
|
||||
|
|
|
@ -6,7 +6,45 @@ job "plume-blog" {
|
|||
count = 1
|
||||
|
||||
network {
|
||||
port "web_port" { }
|
||||
port "back_port" { }
|
||||
port "cache_port" { }
|
||||
}
|
||||
|
||||
task "varnish" {
|
||||
driver = "docker"
|
||||
config {
|
||||
image = "varnish:7.6.1"
|
||||
network_mode = "host"
|
||||
ports = [ "cache_port" ]
|
||||
|
||||
# cache
|
||||
mount {
|
||||
type = "tmpfs"
|
||||
target = "/var/lib/varnish/varnishd:exec"
|
||||
readonly = false
|
||||
tmpfs_options {
|
||||
size = 2684354559 # 2.5GB in bytes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
env {
|
||||
VARNISH_SIZE = "2G"
|
||||
VARNISH_BACKEND_HOST = "localhost"
|
||||
VARNISH_BACKEND_PORT = "${NOMAD_PORT_back_port}"
|
||||
VARNISH_HTTP_PORT = "${NOMAD_PORT_cache_port}"
|
||||
}
|
||||
|
||||
service {
|
||||
name = "plume-cache"
|
||||
tags = [
|
||||
"plume",
|
||||
"tricot plume.deuxfleurs.fr",
|
||||
"d53-cname plume.deuxfleurs.fr",
|
||||
]
|
||||
port = "cache_port"
|
||||
address_mode = "host"
|
||||
}
|
||||
}
|
||||
|
||||
task "plume" {
|
||||
|
@ -14,9 +52,9 @@ job "plume-blog" {
|
|||
config {
|
||||
image = "lxpz/plume_s3:v1"
|
||||
network_mode = "host"
|
||||
ports = [ "web_port" ]
|
||||
ports = [ "back_port" ]
|
||||
command = "sh"
|
||||
args = [ "-c", "plm search init; plm search refill; plume" ]
|
||||
args = [ "-c", "plm search init; plume" ]
|
||||
}
|
||||
|
||||
template {
|
||||
|
@ -26,24 +64,22 @@ job "plume-blog" {
|
|||
}
|
||||
|
||||
resources {
|
||||
memory = 1024
|
||||
memory_max = 1024
|
||||
memory = 512
|
||||
memory_max = 512
|
||||
cpu = 100
|
||||
}
|
||||
|
||||
service {
|
||||
name = "plume"
|
||||
name = "plume-back"
|
||||
tags = [
|
||||
"plume",
|
||||
"tricot plume.deuxfleurs.fr",
|
||||
"d53-cname plume.deuxfleurs.fr",
|
||||
]
|
||||
port = "web_port"
|
||||
port = "back_port"
|
||||
address_mode = "host"
|
||||
check {
|
||||
type = "http"
|
||||
protocol = "http"
|
||||
port = "web_port"
|
||||
port = "back_port"
|
||||
path = "/"
|
||||
interval = "60s"
|
||||
timeout = "5s"
|
||||
|
@ -55,7 +91,7 @@ job "plume-blog" {
|
|||
}
|
||||
}
|
||||
restart {
|
||||
interval = "30m"
|
||||
interval = "20m"
|
||||
attempts = 20
|
||||
delay = "15s"
|
||||
mode = "delay"
|
||||
|
|
Loading…
Add table
Reference in a new issue