test joplin-server

This commit is contained in:
Dmitriy Kholkin 2022-10-08 04:45:07 +03:00
parent a0a17d5b1e
commit ec61ceb84f
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,48 @@
{ config, lib, pkgs, ... }: {
virtualisation.oci-containers.containers = {
joplin = {
autoStart = true;
dependsOn = [ "joplin-db" ];
environment = {
DB_CLIENT = "pg";
POSTGRES_DATABASE = "joplin";
POSTGRES_USER = "test";
POSTGRES_PASSWORD = "test";
POSTGRES_PORT = "5432";
POSTGRES_HOST = "joplin-db";
APP_PORT = "22300";
APP_BASE_URL = "joplin.ataraxiadev.com";
};
extraOptions = [
"--network=joplin"
];
ports = [ "127.0.0.1:22300:22300" ];
image = "joplin:latest-dev";
};
joplin-db = {
autoStart = true;
environment = {
POSTGRES_PASSWORD= "test";
POSTGRES_USER = "test";
POSTGRES_DB = "joplin";
};
extraOptions = [
"--network=joplin"
];
image = "postgres:13";
# volumes = [ "/server/data/postgres:/var/lib/postgresql/data" ];
};
};
systemd.services.create-joplin-network = with config.virtualisation.oci-containers; {
serviceConfig.Type = "oneshot";
wantedBy = [
"${backend}-joplin.service"
"${backend}-joplin-db.service"
];
script = ''
${pkgs.docker}/bin/docker network inspect joplin || \
${pkgs.docker}/bin/docker network create -d bridge joplin
exit 0
'';
};
}

View File

@ -35,6 +35,7 @@
"shoko.ataraxiadev.com"
"bathist.ataraxiadev.com"
"microbin.ataraxiadev.com"
# "joplin.ataraxiadev.com"
];
};
};
@ -236,6 +237,19 @@
'';
};
} // default;
"joplin.ataraxiadev.com" = {
locations."/" = {
proxyPass = "http://localhost:22300";
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
'';
};
} // default;
};
};