-
Notifications
You must be signed in to change notification settings - Fork 0
/
nocodb.nix
53 lines (51 loc) · 1.42 KB
/
nocodb.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ config, pkgs, ... }:
{
# create network in systemd
systemd.services.init-nocodb-network = {
description = "Create network for nocodb containers.";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig.type = "oneshot";
script = let
dockercli = "${config.virtualisation.docker.package}/bin/docker";
in ''
check=$(${dockercli} network ls | grep "nocodb" || true)
if [ -z "$check" ]; then
${dockercli} network create nocodb
else
echo "Network 'nocodb' already exists."
fi
'';
};
# the containers
virtualisation.oci-containers.containers = {
nocodb = {
image = "nocodb/nocodb:latest";
ports = [ "8081:8080" ];
volumes = [
"/mnt/barracuda/nocodb/data:/usr/app/data"
];
environment = {
NC_DB = "pg://nocodb-db:5432?u=postgres&p=password&d=root_db";
};
dependsOn = [ "nocodb-db" ];
autoStart = true;
extraOptions = [
"--network=nocodb"
];
};
nocodb-db = {
image = "library/postgres:latest"; # official docker images use "library/"
volumes = [ "/mnt/barracuda/nocodb/db:/var/lib/postgresql/data" ];
autoStart = true;
environment = {
POSTGRES_DB = "root_db";
POSTGRES_USER = "postgres";
POSTGRES_PASSWORD = "password";
};
extraOptions = [
"--network=nocodb"
];
};
};
}