mirror of
https://github.com/dump-dvb/nix-config.git
synced 2024-07-02 19:30:39 +02:00
add port to server
This commit is contained in:
parent
b85926a2df
commit
788181e15e
|
@ -5,8 +5,11 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{ pkgs, config, lib, ... }:
|
||||||
let
|
let
|
||||||
port = 8070;
|
port = 8070;
|
||||||
in
|
in {
|
||||||
{
|
imports = [
|
||||||
|
./postgres.nix
|
||||||
|
];
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
services = {
|
services = {
|
||||||
"clicky-bunty-server" = {
|
"clicky-bunty-server" = {
|
||||||
|
@ -35,36 +38,11 @@ in
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"pg-dvbdump-setup" = {
|
|
||||||
description = "prepare dvbdump postgres database";
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
after = [ "networking.target" "postgresql.service" ];
|
|
||||||
serviceConfig.Type = "oneshot";
|
|
||||||
|
|
||||||
path = [ pkgs.sudo config.services.postgresql.package ];
|
|
||||||
script = ''
|
|
||||||
sudo -u ${config.services.postgresql.superUser} psql -c "ALTER ROLE dvbdump WITH PASSWORD '$(cat ${config.sops.secrets.postgres_password.path})'"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
postgresql = {
|
|
||||||
port = 5432;
|
|
||||||
enable = true;
|
|
||||||
ensureUsers = [
|
|
||||||
{
|
|
||||||
name = "dvbdump";
|
|
||||||
ensurePermissions = {
|
|
||||||
"DATABASE dvbdump" = "ALL PRIVILEGES";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
ensureDatabases = [
|
|
||||||
"dvbdump"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
nginx = {
|
nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{ pkgs, config, lib, ... }: {
|
{ pkgs, config, lib, ... }: {
|
||||||
|
imports = [
|
||||||
|
./postgres.nix
|
||||||
|
];
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
services = {
|
services = {
|
||||||
"data-accumulator" = {
|
"data-accumulator" = {
|
||||||
|
|
30
modules/data-hoarder/postgres.nix
Normal file
30
modules/data-hoarder/postgres.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
services.postgresql = {
|
||||||
|
port = 5432;
|
||||||
|
enable = true;
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "dvbdump";
|
||||||
|
ensurePermissions = {
|
||||||
|
"DATABASE dvbdump" = "ALL PRIVILEGES";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
ensureDatabases = [
|
||||||
|
"dvbdump"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd."pg-dvbdump-setup" = {
|
||||||
|
description = "prepare dvbdump postgres database";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "networking.target" "postgresql.service" ];
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
|
||||||
|
path = [ pkgs.sudo config.services.postgresql.package ];
|
||||||
|
script = ''
|
||||||
|
sudo -u ${config.services.postgresql.superUser} psql -c "ALTER ROLE dvbdump WITH PASSWORD '$(cat ${config.sops.secrets.postgres_password.path})'"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -44,7 +44,7 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
script = "exec ${pkgs.telegram-decoder}/bin/telegram-decode --config ${cfg.configFile} --server ${builtins.concatStringsSep " " cfg.server} &";
|
script = "exec ${pkgs.telegram-decoder}/bin/telegram-decode --config ${cfg.configFile} --server ${(builtins.concatStringsSep " " cfg.server)} &";
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
AUTHENTICATION_TOKEN_PATH = cfg.authTokenFile;
|
AUTHENTICATION_TOKEN_PATH = cfg.authTokenFile;
|
||||||
|
|
|
@ -21,7 +21,7 @@ in
|
||||||
};
|
};
|
||||||
dump-dvb.services.telegram-decoder = {
|
dump-dvb.services.telegram-decoder = {
|
||||||
enable = true;
|
enable = true;
|
||||||
server = [ "http://10.13.37.1" "http://10.13.37.5" ];
|
server = [ "http://10.13.37.1:8080" "http://10.13.37.5:8080" ];
|
||||||
configFile = file;
|
configFile = file;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user