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
|
USE_HTTPS=0
|
||||||
ROCKET_ADDRESS=::
|
ROCKET_ADDRESS=::
|
||||||
ROCKET_PORT={{ env "NOMAD_PORT_web_port" }}
|
ROCKET_PORT={{ env "NOMAD_PORT_back_port" }}
|
||||||
|
|
||||||
MEDIA_UPLOAD_DIRECTORY=/app/static/media
|
MEDIA_UPLOAD_DIRECTORY=/app/static/media
|
||||||
SEARCH_INDEX=/app/search_index
|
SEARCH_INDEX=/app/search_index
|
||||||
|
|
|
@ -6,7 +6,45 @@ job "plume-blog" {
|
||||||
count = 1
|
count = 1
|
||||||
|
|
||||||
network {
|
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" {
|
task "plume" {
|
||||||
|
@ -14,9 +52,9 @@ job "plume-blog" {
|
||||||
config {
|
config {
|
||||||
image = "lxpz/plume_s3:v1"
|
image = "lxpz/plume_s3:v1"
|
||||||
network_mode = "host"
|
network_mode = "host"
|
||||||
ports = [ "web_port" ]
|
ports = [ "back_port" ]
|
||||||
command = "sh"
|
command = "sh"
|
||||||
args = [ "-c", "plm search init; plm search refill; plume" ]
|
args = [ "-c", "plm search init; plume" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
|
@ -26,24 +64,22 @@ job "plume-blog" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resources {
|
resources {
|
||||||
memory = 1024
|
memory = 512
|
||||||
memory_max = 1024
|
memory_max = 512
|
||||||
cpu = 100
|
cpu = 100
|
||||||
}
|
}
|
||||||
|
|
||||||
service {
|
service {
|
||||||
name = "plume"
|
name = "plume-back"
|
||||||
tags = [
|
tags = [
|
||||||
"plume",
|
"plume",
|
||||||
"tricot plume.deuxfleurs.fr",
|
|
||||||
"d53-cname plume.deuxfleurs.fr",
|
|
||||||
]
|
]
|
||||||
port = "web_port"
|
port = "back_port"
|
||||||
address_mode = "host"
|
address_mode = "host"
|
||||||
check {
|
check {
|
||||||
type = "http"
|
type = "http"
|
||||||
protocol = "http"
|
protocol = "http"
|
||||||
port = "web_port"
|
port = "back_port"
|
||||||
path = "/"
|
path = "/"
|
||||||
interval = "60s"
|
interval = "60s"
|
||||||
timeout = "5s"
|
timeout = "5s"
|
||||||
|
@ -55,7 +91,7 @@ job "plume-blog" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
restart {
|
restart {
|
||||||
interval = "30m"
|
interval = "20m"
|
||||||
attempts = 20
|
attempts = 20
|
||||||
delay = "15s"
|
delay = "15s"
|
||||||
mode = "delay"
|
mode = "delay"
|
||||||
|
|
Loading…
Add table
Reference in a new issue