New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nextcloud module: changing config doesn't propagate to the module #49783

Open
Ekleog opened this Issue Nov 5, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@Ekleog
Copy link
Member

Ekleog commented Nov 5, 2018

Data that was once config and recorded on ${dataDir}/config/config.php doesn't get updated when the configuration changes.

This is a violation of purity. And more than that, it's very surprising when trying to install, hesitating between pgsql and sqlite, and struggling before understanding that the configuration doesn't get used anyway :p

cc @globin @flokli @eqyiel @fpletz

@flokli

This comment has been minimized.

Copy link
Contributor

flokli commented Nov 11, 2018

@Ekleog that's a bit tough.

We have a nextcloud-setup unit, that's supposed to do the installation.

We use the nextcloud-occ maintenance:install command to install nextcloud (passing the configured database and adminpass settings as command parameters).

This CLI generates ${cfg.home}/config/config.php, and installs nextcloud.

The script checks the presence of ${cfg.home}/config/config.php, and skips installation on following starts.

If you now change configuration from the module, we won't run the install command again, as the config file already exists, and nextcloud-setup assumes nextcloud is already installed.

@Ekleog

This comment has been minimized.

Copy link
Member

Ekleog commented Nov 12, 2018

Hmm… Maybe it would be possible to generate the ${cfg.home}/config/config.php somewhere in the store, and symlink to it? This way the next time nextcloud-setup runs it can in addition check whether config.php points to the correct store path.

Now, I don't really know what nextcloud-occ exactly does, so maybe it's not actually possible to do this because eg. one would need to re-run maintenance:install on certain configuration changes? In which case it'd be hard :/ but at least we can maybe make nextcloud-setup fail or something like that, so that the issue is at least noisy?

@Ma27

This comment has been minimized.

Copy link
Member

Ma27 commented Nov 16, 2018

Now, I don't really know what nextcloud-occ exactly does, so maybe it's not actually possible to do this because eg. one would need to re-run maintenance:install on certain configuration changes?

I don't recommend to do this, I just tried that (after upgrading one of my personal systems) and this tries to recreate a database schema which can end in very bad results.

This way the next time nextcloud-setup runs it can in addition check whether config.php points to the correct store path.

Unfortunately I doubt that this will work properly, nextcloud wants to merge this during the runtime. E.g. it adds a installed => true after a successful maintenance:install or adds trusted domains when running the corresponding command.

I'm using this as well now and hitting these issues, unfortunately I don't have useful ideas either ATM, but I'm happy to discuss better solutions :)

@flokli

This comment has been minimized.

Copy link
Contributor

flokli commented Nov 18, 2018

Nextcloud edits it's config.php in a lot of different places, so having it generated through Nix currently isn't possible.
nextcloud/server#11075 digs into that already, I added a comments about our use case here too.

@flokli

This comment has been minimized.

Copy link
Contributor

flokli commented Nov 18, 2018

@Ma27, @Ekleog to avoid other people running into the reconfiguration issue for now, what about documenting that, maybe in services.nextcloud.enable?

@Ma27

This comment has been minimized.

Copy link
Member

Ma27 commented Nov 18, 2018

That's certainly a good thing to do. If nobody else wants to take over, I'd volunteer to do this during the next week as investing time on improving the nextcloud module is one item on my todo list :)

@flokli I was aware of config.php being stateful, but thanks a lot for linking the corresponding ticket! I'll have a look at this as soon as I have sufficient time to :)

Ma27 added a commit to Ma27/nixpkgs that referenced this issue Nov 29, 2018

nixos/nextcloud: add basic module documentation and warn about curren…
…t upgrading issues

Part of NixOS#49783. NextCloud tracks in its `config.php` the application's
state which makes it hard for the module to modify configurations during
upgrades.

It will take time until the issue is properly fixed, therefore we
decided to warn about this in the manual.

This PR addresses two things:

* Adding a basic example for nextcloud. I figured it to be helpful to
  add some basic usage instructions when adding a new manual entry.
  Advanced documentation may follow later.

  For now this document actively links to the service options, so users
  are guided to the remaining options that can be helpful in certain
  cases.

* Add a warning about upgrades and manual changes in
  `/var/lib/nextcloud`. This will be fixed in the future, but it's
  definetely helpful to document the current issues in the manual (as
  proposed in NixOS#49783 (comment)).

flokli added a commit to flokli/nixpkgs that referenced this issue Dec 16, 2018

nixos/nextcloud: add basic module documentation and warn about curren…
…t upgrading issues

Part of NixOS#49783. NextCloud tracks in its `config.php` the application's
state which makes it hard for the module to modify configurations during
upgrades.

It will take time until the issue is properly fixed, therefore we
decided to warn about this in the manual.

This PR addresses two things:

* Adding a basic example for nextcloud. I figured it to be helpful to
  add some basic usage instructions when adding a new manual entry.
  Advanced documentation may follow later.

  For now this document actively links to the service options, so users
  are guided to the remaining options that can be helpful in certain
  cases.

* Add a warning about upgrades and manual changes in
  `/var/lib/nextcloud`. This will be fixed in the future, but it's
  definetely helpful to document the current issues in the manual (as
  proposed in NixOS#49783 (comment)).

(cherry picked from commit 216a954)

globin added a commit that referenced this issue Dec 16, 2018

nixos/nextcloud: add basic module documentation and warn about curren…
…t upgrading issues

Part of #49783. NextCloud tracks in its `config.php` the application's
state which makes it hard for the module to modify configurations during
upgrades.

It will take time until the issue is properly fixed, therefore we
decided to warn about this in the manual.

This PR addresses two things:

* Adding a basic example for nextcloud. I figured it to be helpful to
  add some basic usage instructions when adding a new manual entry.
  Advanced documentation may follow later.

  For now this document actively links to the service options, so users
  are guided to the remaining options that can be helpful in certain
  cases.

* Add a warning about upgrades and manual changes in
  `/var/lib/nextcloud`. This will be fixed in the future, but it's
  definetely helpful to document the current issues in the manual (as
  proposed in #49783 (comment)).

(cherry picked from commit 216a954)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment