summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/akkoma/default.nix48
1 files changed, 47 insertions, 1 deletions
diff --git a/services/akkoma/default.nix b/services/akkoma/default.nix
index 4cd4022..8b89df7 100644
--- a/services/akkoma/default.nix
+++ b/services/akkoma/default.nix
@@ -3,6 +3,7 @@
let
inherit (pkgs) dockerTools;
inherit (auxiliaryPkgs) common;
+ inherit (unstablePkgs) fedifetcher;
akkomaLocalPort = "1111";
akkomaDir = "/srv/akkoma";
@@ -28,6 +29,33 @@ let
'';
};
+ fedifetcherScript = pkgs.writeShellScriptBin "fedifetcher-script.sh" ''
+ fedifetcher -c /etc/fedifetcher/config.json &>> /var/log/fedifetcher.log
+ '';
+
+ fedifetcherCron = pkgs.writeText "fedifetcher-cron" ''
+ 0 */3 * * * /bin/fedifetcher-script.sh
+ '';
+
+ fedifetcherEntry = pkgs.writeShellScriptBin "fedifetcher-entry.sh" ''
+ crond -b -l 0 -L /var/log/crond.log
+ touch /var/log/fedifetcher.log
+ tail -f /var/log/fedifetcher.log
+ '';
+
+ fedifetcherImage = dockerTools.buildLayeredImage {
+ name = "fedifetcher";
+ tag = fedifetcher.version;
+ fromImage = common.alpine.base;
+
+ contents = [ pkgs.bash fedifetcher fedifetcherEntry fedifetcherScript ];
+
+ extraCommands = ''
+ mkdir -p etc/crontabs
+ cat ${fedifetcherCron} > etc/crontabs/root
+ '';
+ };
+
in
{
virtualisation.oci-containers.containers = {
@@ -79,6 +107,23 @@ in
"--network=akkoma"
];
};
+
+ akkoma-fedifetcher = {
+ imageFile = fedifetcherImage;
+ image = "fedifetcher:${fedifetcher.version}";
+
+ volumes = [
+ "${akkomaDir}/fedifetcher:/opt/fedifetcher"
+ "${akkomaDir}/fedifetcher.json:/etc/fedifetcher/config.json"
+ ];
+
+ entrypoint = "/bin/fedifetcher-entry.sh";
+
+ extraOptions = [
+ "--network-alias=db"
+ "--network=akkoma"
+ ];
+ };
};
# systemd configuration to combine containers.
@@ -100,8 +145,9 @@ in
};
in {
services = {
- "docker-akkoma-db" = containerService;
"docker-akkoma" = containerService;
+ "docker-akkoma-db" = containerService;
+ "docker-akkoma-fedifetcher" = containerService;
"${network}" = {
path = [ pkgs.docker ];