pretix: limit RAM usage, cleanup
This commit is contained in:
parent
f0bad6ce1a
commit
c09c01a8bf
1 changed files with 23 additions and 40 deletions
|
@ -1,8 +1,12 @@
|
||||||
job "pretix" {
|
job "dcusr-pretix" {
|
||||||
datacenters = ["aperture"]
|
datacenters = ["aperture"]
|
||||||
|
|
||||||
type = "service"
|
type = "service"
|
||||||
|
|
||||||
|
meta {
|
||||||
|
domain = "tickets.solarracing.ie"
|
||||||
|
}
|
||||||
|
|
||||||
group "web" {
|
group "web" {
|
||||||
network {
|
network {
|
||||||
# mode = "bridge"
|
# mode = "bridge"
|
||||||
|
@ -12,7 +16,6 @@ job "pretix" {
|
||||||
|
|
||||||
port "db" {
|
port "db" {
|
||||||
to = 5432
|
to = 5432
|
||||||
static = 5432
|
|
||||||
}
|
}
|
||||||
|
|
||||||
port "redis" {
|
port "redis" {
|
||||||
|
@ -21,26 +24,20 @@ job "pretix" {
|
||||||
}
|
}
|
||||||
|
|
||||||
service {
|
service {
|
||||||
name = "pretix"
|
name = "pretix-web"
|
||||||
port = "http"
|
port = "http"
|
||||||
|
|
||||||
# check {
|
|
||||||
# type = "http"
|
|
||||||
# path = "/"
|
|
||||||
# interval = "10s"
|
|
||||||
# timeout = "2s"
|
|
||||||
# }
|
|
||||||
|
|
||||||
tags = [
|
tags = [
|
||||||
"traefik.enable=true",
|
"traefik.enable=true",
|
||||||
"traefik.port=${NOMAD_PORT_http}",
|
"traefik.port=${NOMAD_PORT_http}",
|
||||||
"traefik.http.routers.pretix.rule=Host(`tickets.solarracing.ie`)",
|
"traefik.http.routers.pretix.entrypoints=web,websecure",
|
||||||
|
"traefik.http.routers.pretix.rule=Host(`${NOMAD_META_domain}`)",
|
||||||
"traefik.http.routers.pretix.tls=true",
|
"traefik.http.routers.pretix.tls=true",
|
||||||
"traefik.http.routers.pretix.tls.certresolver=lets-encrypt",
|
"traefik.http.routers.pretix.tls.certresolver=lets-encrypt",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
task "app" {
|
task "pretix" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
|
@ -49,25 +46,28 @@ job "pretix" {
|
||||||
|
|
||||||
volumes = [
|
volumes = [
|
||||||
"local/pretix.cfg:/etc/pretix/pretix.cfg",
|
"local/pretix.cfg:/etc/pretix/pretix.cfg",
|
||||||
"/storage/nomad/pretix/data:/data"
|
"/storage/nomad/pretix/data:/data",
|
||||||
|
"/etc/timezone:/etc/timezone:ro",
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resources {
|
resources {
|
||||||
memory = 15000
|
memory = 5000
|
||||||
|
cores = 1
|
||||||
|
}
|
||||||
|
env {
|
||||||
|
NUM_WORKERS = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
data = <<EOH
|
data = <<EOH
|
||||||
[pretix]
|
[pretix]
|
||||||
instance_name=DCU Solar Racing
|
instance_name=DCU Solar Racing
|
||||||
url=https://tickets.solarracing.ie
|
url=https://{{ env "NOMAD_META_domain" }}
|
||||||
currency=EUR
|
currency=EUR
|
||||||
; DO NOT change the following value, it has to be set to the location of the
|
|
||||||
; directory *inside* the docker container
|
|
||||||
datadir=/data
|
datadir=/data
|
||||||
registration=on
|
registration=off
|
||||||
|
|
||||||
[locale]
|
[locale]
|
||||||
timezone=Europe/Dublin
|
timezone=Europe/Dublin
|
||||||
|
@ -78,26 +78,25 @@ name={{ key "pretix/db/name" }}
|
||||||
user={{ key "pretix/db/user" }}
|
user={{ key "pretix/db/user" }}
|
||||||
password={{ key "pretix/db/password" }}
|
password={{ key "pretix/db/password" }}
|
||||||
host={{ env "NOMAD_IP_db" }}
|
host={{ env "NOMAD_IP_db" }}
|
||||||
port={{ env "NOMAD_PORT_db" }}
|
port={{ env "NOMAD_HOST_PORT_db" }}
|
||||||
|
|
||||||
[mail]
|
[mail]
|
||||||
from={{ key "pretix/mail/from" }}
|
from={{ key "pretix/mail/from" }}
|
||||||
host={{ key "pretix/mail/host" }}
|
host={{ key "pretix/mail/host" }}
|
||||||
user={{ key "pretix/mail/user" }}
|
user={{ key "pretix/mail/user" }}
|
||||||
password={{ key "pretix/mail/password" }}
|
password={{ key "pretix/mail/password" }}
|
||||||
port=465
|
port=587
|
||||||
tls=on
|
tls=on
|
||||||
ssl=off
|
ssl=off
|
||||||
|
|
||||||
[redis]
|
[redis]
|
||||||
location=redis://{{ env "NOMAD_ADDR_redis" }}/0
|
location=redis://{{ env "NOMAD_ADDR_redis" }}/0
|
||||||
; Remove the following line if you are unsure about your redis'security
|
|
||||||
; to reduce impact if redis gets compromised.
|
|
||||||
sessions=true
|
sessions=true
|
||||||
|
|
||||||
[celery]
|
[celery]
|
||||||
backend=redis://{{ env "NOMAD_ADDR_redis" }}/1
|
backend=redis://{{ env "NOMAD_ADDR_redis" }}/1
|
||||||
broker=redis://{{ env "NOMAD_ADDR_redis" }}/2
|
broker=redis://{{ env "NOMAD_ADDR_redis" }}/2
|
||||||
|
worker_prefetch_multiplier = 0
|
||||||
EOH
|
EOH
|
||||||
destination = "local/pretix.cfg"
|
destination = "local/pretix.cfg"
|
||||||
}
|
}
|
||||||
|
@ -113,7 +112,6 @@ EOH
|
||||||
|
|
||||||
volumes = [
|
volumes = [
|
||||||
"/storage/nomad/pretix/db:/var/lib/postgresql/data",
|
"/storage/nomad/pretix/db:/var/lib/postgresql/data",
|
||||||
"local/pg_hba.conf:/pg_hba.conf",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,21 +123,6 @@ EOH
|
||||||
destination = "local/db.env"
|
destination = "local/db.env"
|
||||||
env = true
|
env = true
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
|
||||||
data = <<EOH
|
|
||||||
local all all trust
|
|
||||||
host all all 127.0.0.1/32 trust
|
|
||||||
host all all 172.17.0.1/32 trust
|
|
||||||
host all all ::1/128 trust
|
|
||||||
local replication all trust
|
|
||||||
host replication all 127.0.0.1/32 trust
|
|
||||||
host replication all ::1/128 trust
|
|
||||||
host all all all scram-sha-256
|
|
||||||
EOH
|
|
||||||
|
|
||||||
destination = "local/pg_hba.conf"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task "redis" {
|
task "redis" {
|
Loading…
Reference in a new issue