mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-22 08:04:20 +01:00
Add terranix config for website container
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
9b1c305c3b
commit
1e67b634a6
15
terranix/containers/website/default.nix
Normal file
15
terranix/containers/website/default.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ pkgs, elib, vars, ... }:
|
||||
let
|
||||
inherit (elib)
|
||||
nfsVolume
|
||||
nomadJob;
|
||||
in
|
||||
{
|
||||
resource."nomad_job"."website" = nomadJob {
|
||||
jobspec = ./job.hcl;
|
||||
vars = {
|
||||
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";
|
||||
flake_sha = vars.flake_sha;
|
||||
};
|
||||
};
|
||||
}
|
74
terranix/containers/website/job.hcl
Normal file
74
terranix/containers/website/job.hcl
Normal file
|
@ -0,0 +1,74 @@
|
|||
variable "flake_ref" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "flake_sha" {
|
||||
type = string
|
||||
}
|
||||
|
||||
job "website" {
|
||||
datacenters = [ "homelab-1" ]
|
||||
type = "service"
|
||||
|
||||
constraint {
|
||||
attribute = "${attr.unique.hostname}"
|
||||
value = "blowhole"
|
||||
}
|
||||
|
||||
group "website" {
|
||||
count = 2
|
||||
|
||||
update {
|
||||
max_parallel = 1
|
||||
}
|
||||
|
||||
network {
|
||||
mode = "bridge"
|
||||
}
|
||||
|
||||
service {
|
||||
name = "website"
|
||||
port = "80"
|
||||
|
||||
check {
|
||||
type = "http"
|
||||
address_mode = "alloc"
|
||||
path = "/"
|
||||
port = "80"
|
||||
interval = "10s"
|
||||
timeout = "10s"
|
||||
}
|
||||
|
||||
connect {
|
||||
sidecar_service {}
|
||||
|
||||
sidecar_task {
|
||||
resources {
|
||||
cpu = 75
|
||||
memory = 48
|
||||
}
|
||||
|
||||
config {
|
||||
memory_hard_limit = 96
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task "apache" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
nix_flake_ref = "${var.flake_ref}#nixngSystems.website.config.system.build.toplevel"
|
||||
nix_flake_sha = var.flake_sha
|
||||
entrypoint = [ "init" ]
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 128
|
||||
memory = 32
|
||||
memory_max = 64
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue