Get cloudreve working on new corp with local database
This was a huge hassle. I really wanted to see it working under a non-root user since it writes files, but that ended up being impossible because of several bugs in podman's rootless integration with NixOS. I've kept pieces of the logic around and commented out in case I can fix it in the future as it would be more secure. I also tried to connect to Postgres over the unix domain socket, but the problem here is that the container is built to run as root and I'd need to do some elaborate mapping of the root user inside the container, the non-root user outside the container, and the Postgres auth scheme. This would be great stuff to sort out, but I'm out of time now to work on it.
This commit is contained in:
parent
b652029e73
commit
2c101e6aaa
4 changed files with 35 additions and 16 deletions
|
|
@ -38,11 +38,6 @@ with lib;
|
|||
reverse_proxy http://127.0.0.1:9000
|
||||
'';
|
||||
services.postgresql = {
|
||||
authentication = pkgs.lib.mkOverride 10 ''
|
||||
#type database DBuser auth-method
|
||||
local all all trust
|
||||
'';
|
||||
enable = true;
|
||||
ensureDatabases = [ "authentik" ];
|
||||
ensureUsers = [{
|
||||
ensureClauses.login = true;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,29 @@ with lib;
|
|||
services.caddy.virtualHosts."files.gleipnir.technology".extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:10040
|
||||
'';
|
||||
services.postgresql = {
|
||||
# In the below config I've got 107.150.59.1/24, which is a total guess
|
||||
# based on what I'm seeing with containers, it may be way, WAY off.
|
||||
authentication = pkgs.lib.mkOverride 10 ''
|
||||
#type database DBuser origin-address auth-method
|
||||
local all all trust
|
||||
host all all 127.0.0.1/32 trust
|
||||
host all all ::1/128 trust
|
||||
host cloudreve cloudreve 10.88.0.1/16 trust
|
||||
host cloudreve cloudreve 107.150.59.1/24 trust
|
||||
'';
|
||||
enable = true;
|
||||
ensureDatabases = [ "cloudreve" ];
|
||||
enableTCPIP = true;
|
||||
ensureUsers = [{
|
||||
ensureClauses.login = true;
|
||||
ensureDBOwnership = true;
|
||||
name = "cloudreve";
|
||||
}];
|
||||
#settings = {
|
||||
#listen_addresses = lib.mkForce "10.88.0.1,localhost";
|
||||
#};
|
||||
};
|
||||
sops.secrets.cloudreve-env = with config.virtualisation.oci-containers; {
|
||||
format = "dotenv";
|
||||
group = "cloudreve";
|
||||
|
|
@ -20,19 +43,27 @@ with lib;
|
|||
systemd.tmpfiles.rules = [
|
||||
"d /opt/cloudreve 0755 cloudreve cloudreve"
|
||||
];
|
||||
# The container here comes from a private repository. In order to get it you need to buy a pro license
|
||||
# and download and configure the image via https://cloudreve.org/manage
|
||||
# You'll do so by getting the image repository credentials and running
|
||||
# sudo podman login -u <user> -p <password> cloudreve.azurecr.io
|
||||
virtualisation.oci-containers.containers.cloudreve = {
|
||||
environmentFiles = [
|
||||
"/var/run/secrets/cloudreve-env"
|
||||
];
|
||||
image = "cloudreve.azurecr.io/cloudreve/pro:4.3.0";
|
||||
#extraOptions = ["--network=pasta:--map-gw"];
|
||||
image = "cloudreve.azurecr.io/cloudreve/pro:4.5.0";
|
||||
# I'd much rather be doing this, but it fails in inscrutible ways
|
||||
#podman.user = "cloudreve";
|
||||
ports = [ "127.0.0.1:10040:5212" ];
|
||||
volumes = [
|
||||
"/opt/cloudreve:/cloudreve/data"
|
||||
"/var/lib/cloudreve:/cloudreve/data"
|
||||
];
|
||||
};
|
||||
users.groups.cloudreve = {};
|
||||
users.users.cloudreve = {
|
||||
group = "cloudreve";
|
||||
home = "/home/cloudreve";
|
||||
isSystemUser = true;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,11 +8,6 @@ with lib;
|
|||
reverse_proxy http://127.0.0.1:10010
|
||||
'';
|
||||
services.postgresql = {
|
||||
authentication = pkgs.lib.mkOverride 10 ''
|
||||
#type database DBuser auth-method
|
||||
local all all trust
|
||||
'';
|
||||
enable = true;
|
||||
ensureDatabases = [ "vikunja" ];
|
||||
ensureUsers = [{
|
||||
ensureClauses.login = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue