This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
...
|
||||
}: {
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
affineDomain = "affine.${domain}";
|
||||
@@ -129,7 +130,23 @@
|
||||
});
|
||||
|
||||
compose = "${pkgs.docker-compose}/bin/docker-compose --project-name affine --env-file ${environmentFile} --file ${composeFile}";
|
||||
frontendStatic = pkgs.hectic.affine-frontend-static;
|
||||
frontendOverride = (pkgs.formats.yaml {}).generate "affine-frontend-compose.yaml" {
|
||||
services.affine.volumes = [ "${frontendStatic}:/app/static:ro" ];
|
||||
};
|
||||
frontendCompose = "${compose} --file ${frontendOverride}";
|
||||
in {
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.hasPrefix "ghcr.io/toeverything/affine:${frontendStatic.version}@sha256:" affineImage;
|
||||
message = "AFFiNE frontend assets and the deployed backend image must use the same release.";
|
||||
}
|
||||
{
|
||||
assertion = frontendStatic.revision == "b4c8548c09da21b2898443559a5b846f0ccf5dd8";
|
||||
message = "AFFiNE frontend source revision must match the pinned 0.27.4 backend.";
|
||||
}
|
||||
];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${stateDirectory} 0750 root root -"
|
||||
"d ${stateDirectory}/data 0750 root root -"
|
||||
@@ -185,6 +202,26 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
# Reconcile only the application container; leave the database and migration job alone.
|
||||
systemd.services.affine-frontend = {
|
||||
description = "Source-built AFFiNE frontend assets";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
requires = [ "affine.service" ];
|
||||
after = [ "affine.service" ];
|
||||
partOf = [ "affine.service" ];
|
||||
reloadIfChanged = true;
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = "${frontendCompose} up --detach --no-deps --force-recreate affine";
|
||||
ExecReload = "${frontendCompose} up --detach --no-deps --force-recreate affine";
|
||||
ExecStop = "${compose} up --detach --no-deps --force-recreate affine";
|
||||
TimeoutStartSec = "5min";
|
||||
TimeoutStopSec = "5min";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.affine-bootstrap = {
|
||||
description = "Prepare AFFiNE pilot basic authentication";
|
||||
requiredBy = [ "nginx.service" ];
|
||||
|
||||
Reference in New Issue
Block a user