2021-03-28 13:10:27 +00:00
|
|
|
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2021-03-31 23:38:39 +00:00
|
|
|
{ depot, ... }:
|
2021-03-31 23:52:38 +00:00
|
|
|
let
|
|
|
|
inherit (depot.ops) secrets;
|
|
|
|
in {
|
2021-03-28 13:10:27 +00:00
|
|
|
imports = [
|
|
|
|
../lib/bvm.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
# Networking!
|
|
|
|
networking = {
|
|
|
|
hostName = "bvm-twitterchiver";
|
|
|
|
hostId = "c7ff157c";
|
|
|
|
|
|
|
|
interfaces.enp1s0 = {
|
|
|
|
ipv4.addresses = [{ address = "10.100.0.201"; prefixLength = 23; }];
|
|
|
|
};
|
|
|
|
};
|
2021-03-28 14:32:16 +00:00
|
|
|
my.ip.tailscale = "100.119.86.55";
|
2021-03-28 13:10:27 +00:00
|
|
|
|
2021-03-28 22:46:44 +00:00
|
|
|
services.postgresql = {
|
|
|
|
enable = true;
|
|
|
|
ensureDatabases = [
|
|
|
|
"twitterchiver"
|
|
|
|
];
|
|
|
|
ensureUsers = [{
|
|
|
|
name = "twitterchiver";
|
|
|
|
ensurePermissions = { "DATABASE twitterchiver" = "ALL PRIVILEGES"; };
|
|
|
|
}];
|
|
|
|
};
|
|
|
|
services.postgresqlBackup.enable = true;
|
|
|
|
|
2021-03-28 22:48:43 +00:00
|
|
|
users.groups.twitterchiver = {};
|
|
|
|
users.users.twitterchiver = {
|
|
|
|
home = "/srv/twitterchiver";
|
|
|
|
isSystemUser = true;
|
|
|
|
createHome = true;
|
|
|
|
group = "twitterchiver";
|
|
|
|
};
|
|
|
|
|
2021-03-31 23:33:44 +00:00
|
|
|
systemd.services.twitterchiver-viewer = {
|
|
|
|
description = "Twitterchiver Viewer";
|
|
|
|
wants = ["network-online.target"];
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
serviceConfig = {
|
2021-03-31 23:44:52 +00:00
|
|
|
ExecStart = "${depot.go.twitterchiver.viewer}/bin/viewer --user_to_twitter=lukegb@lukegb.com:lukegb,bgekul";
|
2021-03-31 23:52:38 +00:00
|
|
|
EnvironmentFile = secrets.twitterchiver.environment;
|
2021-03-31 23:38:39 +00:00
|
|
|
WorkingDirectory = "${depot.go.twitterchiver.viewer}/share";
|
2021-03-31 23:33:44 +00:00
|
|
|
User = "twitterchiver";
|
|
|
|
Restart = "always";
|
|
|
|
};
|
|
|
|
};
|
2021-04-01 00:22:57 +00:00
|
|
|
systemd.services.twitterchiver-relatedfetcher = {
|
|
|
|
description = "Twitterchiver Related-Fetcher";
|
|
|
|
wants = ["network-online.target"];
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${depot.go.twitterchiver.relatedfetcher}/bin/relatedfetcher --media_work_at_once 100 --media_tick_interval 10s";
|
|
|
|
EnvironmentFile = secrets.twitterchiver.environment;
|
|
|
|
User = "twitterchiver";
|
|
|
|
Restart = "always";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
systemd.services.twitterchiver-archiver = {
|
|
|
|
description = "Twitterchiver Archiver";
|
|
|
|
wants = ["network-online.target"];
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${depot.go.twitterchiver.archiver}/bin/archiver";
|
|
|
|
EnvironmentFile = secrets.twitterchiver.environment;
|
|
|
|
User = "twitterchiver";
|
|
|
|
Restart = "always";
|
|
|
|
};
|
|
|
|
};
|
2021-03-31 23:33:44 +00:00
|
|
|
|
2021-03-28 13:10:27 +00:00
|
|
|
system.stateVersion = "21.05";
|
|
|
|
}
|