mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-29 03:26:14 +01:00
1c279ddd5b
Signed-off-by: Magic_RB <magic_rb@redalder.org>
171 lines
3 KiB
HCL
171 lines
3 KiB
HCL
job "nextcloud" {
|
|
datacenters = [ "homelab-1" ]
|
|
type = "service"
|
|
|
|
constraint {
|
|
attribute = "${attr.unique.hostname}"
|
|
value = "blowhole"
|
|
}
|
|
|
|
group "nextcloud" {
|
|
count = 1
|
|
|
|
volume "nextcloud-db" {
|
|
type = "csi"
|
|
source = "nextcloud-db"
|
|
read_only = false
|
|
|
|
attachment_mode = "file-system"
|
|
access_mode = "single-node-writer"
|
|
}
|
|
|
|
volume "nextcloud-data" {
|
|
type = "csi"
|
|
source = "nextcloud-data"
|
|
read_only = false
|
|
|
|
attachment_mode = "file-system"
|
|
access_mode = "single-node-writer"
|
|
}
|
|
|
|
network {
|
|
mode = "bridge"
|
|
}
|
|
|
|
service {
|
|
name = "nextcloud"
|
|
port = "80"
|
|
|
|
check {
|
|
type = "http"
|
|
address_mode = "alloc"
|
|
path = "/"
|
|
port = "80"
|
|
interval = "10s"
|
|
timeout = "10s"
|
|
}
|
|
|
|
connect {
|
|
sidecar_service {}
|
|
}
|
|
}
|
|
|
|
task "apache" {
|
|
driver = "docker"
|
|
|
|
volume_mount {
|
|
volume = "nextcloud-data"
|
|
destination = "/var/www/html/"
|
|
read_only = false
|
|
}
|
|
|
|
config {
|
|
image = "nextcloud:21.0.1-apache"
|
|
|
|
volumes = [
|
|
"local/10-opcache.ini:/usr/local/etc/php/conf.d/10-opcache.ini",
|
|
"local/nextcloud-upload-limit.ini:/usr/local/etc/php/conf.d/nextcloud-upload-limit.ini"
|
|
]
|
|
}
|
|
|
|
template {
|
|
# REDIS_HOST={{ env "NOMAD_HOST_IP_redis" }}
|
|
# REDIS_HOST_PORT={{ env "NOMAD_HOST_PORT_redis" }}
|
|
data = <<EOF
|
|
{{ with secret "kv/data/nextcloud" }}
|
|
MYSQL_USER={{ .Data.data.mysql_user }}
|
|
MYSQL_PASSWORD={{ .Data.data.mysql_password }}
|
|
MYSQL_DATABASE={{ .Data.data.mysql_database }}
|
|
{{ end }}
|
|
MYSQL_HOST=127.0.0.1:3306
|
|
EOF
|
|
destination = "local/env"
|
|
env = true
|
|
}
|
|
|
|
template {
|
|
data = <<EOF
|
|
opcache.enable=1
|
|
opcache.enable_cli=1
|
|
opcache.interned_strings_buffer=8
|
|
opcache.max_accelerated_files=10000
|
|
opcache.memory_consumption=128
|
|
opcache.save_comments=1
|
|
opcache.revalidate_freq=1
|
|
EOF
|
|
destination = "local/10-opcache.ini"
|
|
}
|
|
|
|
template {
|
|
data = <<EOF
|
|
upload_max_filesize=512M
|
|
post_max_size=550M
|
|
memory_limit=1G
|
|
EOF
|
|
destination = "local/nextcloud-upload-limit.ini"
|
|
}
|
|
|
|
resources {
|
|
cpu = 100
|
|
memory = 256
|
|
}
|
|
|
|
vault {
|
|
policies = ["nextcloud-policy"]
|
|
}
|
|
}
|
|
|
|
task "mariadb" {
|
|
driver = "docker"
|
|
|
|
volume_mount {
|
|
volume = "nextcloud-db"
|
|
destination = "/var/lib/mysql/"
|
|
read_only = false
|
|
}
|
|
|
|
config {
|
|
image = "mariadb:10.6.0"
|
|
|
|
command = "--innodb-read-only-compressed=OFF"
|
|
# command = [ "--transaction-isolation=READ-COMMITTED", "--binlog-format=ROW" ]
|
|
}
|
|
|
|
template {
|
|
data = <<EOF
|
|
{{ with secret "kv/data/nextcloud" }}
|
|
MYSQL_ROOT_PASSWORD={{ .Data.data.mysql_root_pass }}
|
|
MYSQL_USER={{ .Data.data.mysql_user }}
|
|
MYSQL_PASSWORD={{ .Data.data.mysql_password }}
|
|
MYSQL_DATABASE={{ .Data.data.mysql_database }}
|
|
{{ end }}
|
|
EOF
|
|
destination = "local/env"
|
|
env = true
|
|
}
|
|
|
|
resources {
|
|
cpu = 100
|
|
memory = 256
|
|
}
|
|
|
|
vault {
|
|
policies = ["nextcloud-policy"]
|
|
}
|
|
}
|
|
|
|
task "redis" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "redis:6.0.9-alpine"
|
|
}
|
|
|
|
resources {
|
|
cpu = 100
|
|
memory = 256
|
|
}
|
|
}
|
|
}
|
|
}
|