Add instasync cronjob and plumbing for nodejs on nomad clients.

This commit is contained in:
2023-09-03 06:10:50 +01:00
parent 3a5913602a
commit 25a21cb6c3
3 changed files with 51 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
nodejs_20
vim
];
}

View File

@@ -22,9 +22,15 @@ in
interface = "tailscale0";
cidr = "100.64.0.0/10";
};
host_volume.code = {
path = "/data/compute/code";
read_only = true;
host_volume = {
code = {
path = "/data/compute/code";
read_only = true;
};
nix-store = {
path = "/nix/store";
read_only = true;
};
};
};

41
services/instasync.hcl Normal file
View File

@@ -0,0 +1,41 @@
job "instasync" {
datacenters = ["alo"]
type = "batch"
periodic {
cron = "*/5 * * * *"
prohibit_overlap = true
}
group "cron" {
volume "code" {
type = "host"
read_only = true
source = "code"
}
volume "nix-store" {
type = "host"
read_only = true
source = "nix-store"
}
task "sync" {
driver = "exec"
config {
command = "/nix/store/2y52nmyfpsq497cppgc43x9v6lkp3q25-nodejs-20.5.1/bin/node"
args = ["/code/instasync/sync.js"]
}
volume_mount {
volume = "code"
destination = "/code"
}
volume_mount {
volume = "nix-store"
destination = "/nix/store"
}
}
}
}