nomad to the max

This commit is contained in:
2023-09-19 19:49:36 +02:00
commit e6d03c8589
15 changed files with 572 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
job "apt-cacher-ng" {
datacenters = ["nummer5"]
group "system" {
count = 1
network {
port "http"{
to = 3142
}
}
service {
name = "apt-cache"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.http.rule=Host(`apt-cache.service.consul`)",
]
}
volume "apt-cacher-data" {
type = "csi"
read_only = false
source = "apt-cacher-data"
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
task "server" {
env {
PORT = "${NOMAD_PORT_http}"
NODE_IP = "${NOMAD_IP_http}"
}
driver = "podman"
config {
image = "cr.wks/apt-cacher-ng"
ports = ["http"]
}
volume_mount {
volume = "apt-cacher-data"
destination = "/var/cache/apt-cacher-ng"
}
}
}
}

View File

@@ -0,0 +1,21 @@
type = "csi"
id = "apt-cacher-data"
name = "apt-cacher-data"
plugin_id = "nfs"
external_id = "apt-cacher-data"
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
context {
server = "ebin02.wks"
share = "/data/raid1-ssd/app-data/apt-cacher-ng"
mountPermissions = "0"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "timeo=30", "vers=3", "_netdev" , "nolock" ]
}

83
apps/gitea/live.hcl Normal file
View File

@@ -0,0 +1,83 @@
job "gitea" {
datacenters = [
"nummer5",
]
type = "service"
group "gitea" {
count = 1
network {
port "http" {
to = 3000
}
port "ssh" {
static = 2222
to = 22
}
}
volume "gitea-data" {
type = "csi"
source = "gitea-data"
read_only = false
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
restart {
attempts = 5
delay = "30s"
}
task "gitea" {
driver = "podman"
volume_mount {
volume = "gitea-data"
destination = "/data"
read_only = false
}
config {
image = "docker.io/gitea/gitea:latest"
ports = ["ssh", "http"]
}
env {
APP_NAME = "Gitea: Git with a cup of tea"
RUN_MODE = "prod"
SSH_DOMAIN = "consul"
SSH_PORT = "2222"
ROOT_URL = "http://gitea.service.consul"
TZ = "Europe/Berlin"
USER_UID = "1000"
USER_GID = "1000"
DB_TYPE = "postgres"
DB_HOST = "postgres.service.consul"
DB_USER = "gitea"
DB_PASSWORD = "giteaEu94XSS4gKpheSBoMsIs"
GITEA__lfs__PATH = "/data/git/lfs"
GITEA__server__START_SSH_SERVER = "true"
GITEA__packages__ENABLED = "true"
GITEA__log__LEVEL = "warn"
}
resources {
cpu = 200
memory = 512
}
service {
name = "gitea"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.gitea.rule=Host(`gitea.service.consul`)",
]
}
}
}
}

21
apps/gitea/volume.hcl Normal file
View File

@@ -0,0 +1,21 @@
type = "csi"
id = "gitea-data"
name = "gitea-data"
plugin_id = "nfs"
external_id = "gitea-data"
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
context {
server = "ebin02.wks"
share = "/data/raid1-ssd/app-data/gitea-data"
mountPermissions = "0"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "timeo=30", "vers=3", "_netdev" , "nolock" ]
}

82
apps/postgresql/live.hcl Normal file
View File

@@ -0,0 +1,82 @@
#To Configure vault
# vault secrets enable database
# vault write database/config/postgresql plugin_name=postgresql-database-plugin connection_url="postgresql://{{username}}:{{password}}@postgres.service.consul:5432/postgres?sslmode=disable" allowed_roles="*" username="root" password="rootpassword"
# vault write database/roles/readonly db_name=postgresql creation_statements=@readonly.sql default_ttl=1h max_ttl=24h
job "postgres" {
datacenters = ["nummer5"]
type = "service"
group "service" {
count = 1
volume "postgres-data" {
type = "csi"
read_only = false
source = "postgresql"
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
task "postgres" {
driver = "podman"
config {
image = "docker.io/postgres:13"
network_mode = "host"
port_map {
db = 5432
}
}
volume_mount {
volume = "postgres-data"
destination = "/var/lib/postgresql/data"
}
env {
POSTGRES_USER="root"
POSTGRES_PASSWORD="pg2020"
}
logs {
max_files = 5
max_file_size = 15
}
resources {
cpu = 1000
memory = 1024
network {
mbits = 10
port "db" {
static = 5432
}
}
}
service {
name = "postgres"
tags = ["postgres for vault"]
port = "db"
check {
name = "alive"
type = "tcp"
interval = "60s"
timeout = "2s"
}
}
}
restart {
attempts = 10
interval = "5m"
delay = "25s"
mode = "delay"
}
}
update {
max_parallel = 1
min_healthy_time = "5s"
healthy_deadline = "9m"
auto_revert = false
canary = 0
}
}

View File

@@ -0,0 +1,21 @@
type = "csi"
id = "postgresql"
name = "postgresql"
plugin_id = "nfs"
external_id = "psotgresql"
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
context {
server = "ebin01.wks"
share = "/data/raid1-ssd/app-data/postgres-data"
mountPermissions = "0"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "timeo=30", "vers=3", "_netdev" , "nolock" ]
}