Hi all ,
I want to to switch to NixOS for my server setup, which currently runs fedora and nextcloud plus caddy in containers.
currently, I have the nextcloud fpm image with a caddy webserver, a redis container and a mariadb container all in a podman pod, behind a caddy reverse proxy container. A lot of caddy I know!
First question regarding the database, is postgresql the recommended option ? I know mysql is similar to mariadb but I guess its not compatible in so much as I cant specify it as a database type ? so should I abandon mariadb and then start from fresh with pgsql? ( i.e no database dump ) .
second question in the 23.11 release docs it shows I can use an alternative to the web server in front of Nextcloud by disabling nginx and stating a different option, but it suggests itās a reverse proxy?!
my understanding of my current setup with containers is that the Caddy container I have in front of the Nextcloud fpm container is a web server for the fpm container and that in fact my Caddy container in front of all of that was my reverse proxy, is this correct or is it a reverse proxy in front of a reverse proxy ?
not that it matters too much as I guess in Nix I can just specify a Caddy reverse proxy in front of the Nextcloud install and just leave nginx enabled and managed by the Nix along with the database and redis.
next question, my understanding is that if I specify extra apps in my config the apps will be updated with nixos-rebuild switch and not via the web interface of Nextcloud? is this just the nix way or is it what most users do rather that update and install via Nextcloud?
If I install Caddy as a reverse proxy can I have another instance of Caddy with nix? I currently have a Caddy container as a file server, one as a reverse proxy and as I mentioned one as a web server( if Iām correct in my understanding) in front of Nextcloud
is there a way to specify the data directory on another ssd drive ? as I currently understand all config and data is stored in /var/lib/nextcloud/
could I use datadirectory' => '/media/storage/nextcloud/data
in my config options?
if I let nixos manage the database what happens during an major upgrade for example from postgres 15 to 16 say, will this cause a problem ?
so this is a nix config based on my understanding:
{ self, config, lib, pkgs, ... }:
{
services = {
caddy = {
enable = true;
virtualHosts."example.org".extraConfig = ''
reverse_proxy http://localhost:5080'';
};
nginx.virtualHosts = {
"localhost" = {
listen = [ { addr = "127.0.0.1"; port = 5080; } ];
forceSSL = false;
enableACME = false;
};
};
nextcloud = {
enable = true;
hostName = "localhost";
# Need to manually increment with every major upgrade.
package = pkgs.nextcloud27;
database.createLocally = true;
configureRedis = true;
phpOptions = {
maxUploadSize = "16G";
https = true;
enableBrokenCiphersForSSE = false;
};
autoUpdateApps.enable = true;
extraAppsEnable = true;
extraApps = with config.services.nextcloud.package.packages.apps; {
inherit calendar contacts notes tasks;
};
config = (
trusted_proxies = ['127.0.0.1'];
overwriteProtocol = "https";
defaultPhoneRegion = "GB";
dbtype = "pgsql";
overwrite.cli.url = "https://example.org";
adminuser = "greylinux";
adminpassFile = "/etc/nextcloud-admin-pass";
};
};
};
}
will this work ?
do I need the trusted proxies section ? currently I do but thatās because I run in containers
Is the admin pass file where the admin user password is saved ? is this from the first install screen or do I have to specify it in the file before hand ? what about other users?
this is the caddyfile I have for my caddy file server
http://192.168.1.160 {
root * /media/
file_server * {
browse /etc/caddy/simple.html
}
}
and the html file mentioned
{{$useragent := .Req.Header.Get "User-Agent"}}
{{if regexMatch "^Kodi" $useragent}}
<!DOCTYPE html>
<html><body><table><tbody>
{{range .Items}}
<tr>
<td><a href="{{html .URL | replace "./" ""}}">{{html .Name}}</a></td>
<td>{{.HumanModTime "2006-Jan-02 15:04:05"}}</td>
<td>{{if .IsDir}}-{{else}}{{.HumanSize | replace " " "" | replace "iB" ""}}{{end}}</td>
<td>{{if .IsDir}}Directory{{else}}application/octet-stream{{end}}</td>
</tr>
{{end}}
<tbody></table></body></html>
{{else}}
... browse output for other user agents (not kodi) ...
{{end}}
this is for my kodi server, how do I declare this in my nix config above should I leave the html doc as a file and just reference it in the nix config? or can I do a file server another way ?
if you have any tips, advice or sites you think might help my understanding I would really appreciate it.
thanks in advance for the advice