set up postgresql to be remote accessable

This commit is contained in:
Nickiel12 2023-05-27 15:49:25 -07:00
parent 570ff894f8
commit 6c37553143
3 changed files with 4 additions and 25 deletions

View file

@ -7,7 +7,6 @@
(import ./hardware-configuration.nix)
(import ./modules/nginx.nix)
(import ./modules/nextcloud.nix)
(import ./modules/postgresql.nix)
(import ./modules/msmtp.nix)
(import ./modules/forgejo.nix)
];
@ -34,7 +33,7 @@
};
firewall = {
enable = true;
allowedTCPPorts = [80 443 3001]; # port 3001 opened to allow git traffic on the local netword
allowedTCPPorts = [80 443 3001 5432]; # port 3001 opened to allow git traffic on the local netword
};
};

View file

@ -40,6 +40,7 @@
services.postgresql = {
enable = true;
enableTCPIP = true;
ensureDatabases = [ "nextcloud" ];
ensureUsers = [
{
@ -52,7 +53,8 @@
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
'';
host all all 0.0.0.0/0 md5
''; # address is the computer you are connecting from
};
# Make sure PostSQL is running before nextcloud

View file

@ -1,22 +0,0 @@
{ config, lib, pkgs, ... }:
{
services.postgresql = {
enable = true;
ensureDatabases = [ "nextcloud" ];
ensureUsers = [
{
name = "nextcloud";
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
}
];
authentication = lib.mkForce ''
# TYPE DATABASE USER ADDRESS METHOD
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
'';
};
}