Nextcloud: Difference between revisions

From NixOS Wiki
imported>SuperSandro2000
Replace NixOS container wby simply changing the nginx listening port
imported>Onny
Enhance listening port section
Line 29: Line 29:
== Tips and tricks ==
== Tips and tricks ==


=== Use alternative web server ===
=== Change default listening port ===


In case port 80 is already used by a different application or you're using a different web server than [[Nginx]], which is used by the Nextcloud module, you can change the listening port with the following option: <code>services.nginx.virtualHosts."localhost".listen = [ { addr = "127.0.0.1"; port = 8080; } ];</code>.
In case port 80 is already used by a different application or you're using a different web server than [[Nginx]], which is used by the Nextcloud module, you can change the listening port with the following option:  
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
services.nginx.virtualHosts."localhost".listen = [ { addr = "127.0.0.1"; port = 8080; } ];
</nowiki>}}


== Troubleshooting ==
== Troubleshooting ==

Revision as of 10:35, 13 September 2022

Installation

A minimal example to get a Nextcloud running on localhost should look like this

/etc/nixos/configuration.nix
services.nextcloud = {                
  enable = true;                   
  package = pkgs.nextcloud24;
  hostName = "localhost";
  config.adminpassFile = "${pkgs.writeText "adminpass" "test123"}";
};

After that you will be able to login into your Nextcloud instance at http://localhost with user root and password test123 as configured above.

Upgrade

As you can see on the package search, there is no default nextcloud package. Instead you have to set the current version in services.nextcloud.package, and it is your job as the maintainer of your nextcloud to check whether you're running an upstream supported version.

Upgrading then consists of these steps:

  1. nextcloud-occ maintenance:mode --on
  2. Increment the version of services.nextcloud.package in your config by 1 (leaving out a major version is not supported)
  3. nixos-rebuild switch
  4. nextcloud-occ maintenance:mode --off

In theory, your nextcloud has now been upgraded by one version. NixOS attempts nextcloud-occ upgrade, if this succeeds without problems you don't need to do anything. Check journalctl to make sure nothing horrible happened. Go to the /settings/admin/overview page in your nextcloud to see whether it recommends further processing, such as database reindexing or conversion.

Tips and tricks

Change default listening port

In case port 80 is already used by a different application or you're using a different web server than Nginx, which is used by the Nextcloud module, you can change the listening port with the following option:

/etc/nixos/configuration.nix
services.nginx.virtualHosts."localhost".listen = [ { addr = "127.0.0.1"; port = 8080; } ];

Troubleshooting

You get the message

   U Wed Jul  3 06:15:06 2019 p3 nextcloud-cron.service Nextcloud[9374]: {cron} {"Exception":"Exception","Message":"Not installed","Code":0,"Trace":[{"file":"\/nix\/store\/9c58nxa9mzzg93ppwq2jlynpf4vsbd30-nextcloud-15.0.8\/lib\/base.php","line":660,"function":"checkInstalled","class":"OC","type":"::","args":[]},{"file":"\/nix\/store\/9c58nxa9mzzg93ppwq2jlynpf4vsbd30-nextcloud-15.0.8\/lib\/base.php","line":1068,"function":"init","class":"OC","type":"::","args":[]},{"file":"\/nix\/store\/9c58nxa9mzzg93ppwq2jlynpf4vsbd30-nextcloud-15.0.8\/cron.php","line":41,"args":["\/nix\/store\/9c58nxa9mzzg93ppwq2jlynpf4vsbd30-nextcloud-15.0.8\/lib\/base.php"],"function":"require_once"}],"File":"\/nix\/store\/9c58nxa9mzzg93ppwq2jlynpf4vsbd30-nextcloud-15.0.8\/lib\/base.php","Line":277,"CustomMessage":"--"}

Then you run into [1]