affine config changed
This commit is contained in:
parent
afd01fa735
commit
0af2f42c1f
4 changed files with 146 additions and 0 deletions
43
affine/containers/affine-server.nix
Normal file
43
affine/containers/affine-server.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
let
|
||||
affine-static = "/var/lib/affine";
|
||||
affine-config = config.services.affine;
|
||||
in {
|
||||
config = lib.mkIf affine-config.enable {
|
||||
virtualisation.oci-containers.containers."affine_server" = {
|
||||
image = "ghcr.io/toeverything/affine:stable";
|
||||
environment = with affine-config.env; {
|
||||
"AFFINE_INDEXER_ENABLED" = "false";
|
||||
"AFFINE_REVISION" = config.services.affine.revision;
|
||||
"CONFIG_LOCATION" = "${affine-static}/config";
|
||||
"DATABASE_URL" = "postgresql://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/${DB_DATABASE}";
|
||||
"DB_DATABASE" = DB_DATABASE;
|
||||
"DB_DATA_LOCATION" = "${affine-static}/db";
|
||||
"DB_PASSWORD" = DB_PASSWORD;
|
||||
"DB_USERNAME" = DB_USERNAME;
|
||||
"PORT" = toString PORT;
|
||||
"REDIS_SERVER_HOST" = "redis";
|
||||
"UPLOAD_LOCATION" = "${affine-static}/storage";
|
||||
};
|
||||
volumes = [
|
||||
"${affine-static}/config:/root/.affine/config:rw"
|
||||
"${affine-static}/storage:/root/.affine/storage:rw"
|
||||
];
|
||||
ports = [ "${ toString config.services.affine.env.PORT}:3010/tcp" ];
|
||||
dependsOn = [ "affine_migration_job" "affine_postgres" "affine_redis" ];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network-alias=affine"
|
||||
"--network=affine_default"
|
||||
];
|
||||
};
|
||||
systemd.services."docker-affine_server" = {
|
||||
serviceConfig.Restart = lib.mkOverride 90 "always";
|
||||
after = [ "docker-network-affine_default.service" ];
|
||||
requires = [ "docker-network-affine_default.service" ];
|
||||
partOf = [ "docker-compose-affine-root.target" ];
|
||||
wantedBy = [ "docker-compose-affine-root.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue