Skip to content
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

nextcloud25Packages.apps.recognize: init at 3.3.6 #211631

Closed
wants to merge 1 commit into from

Conversation

dotlambda
Copy link
Member

I get

Unable to open "/nix/store/ig7li2s4pyvicprhd50wa08nsv880d7z-source-patched/bin/x64.tar.gz" using mode "w+": fopen(/nix/store/ig7li2s4pyvicprhd50wa08nsv880d7z-source-patched/bin/x64.tar.gz): Failed to open stream: Read-only file system`
Downloading of node binary failed

originating in https://github.com/nextcloud/recognize/blob/v3.3.6/lib/Migration/InstallDeps.php when adding it to extraApps.

Is there a standard way to declaratively change settings in the databse? In particular, I want to set the path to the Node.js binary. See https://github.com/nextcloud/recognize/blob/v3.3.6/lib/Migration/InstallDeps.php#L76.

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@dotlambda dotlambda requested review from onny and urandom2 January 19, 2023 18:53
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jan 19, 2023
@SuperSandro2000
Copy link
Member

Is there a standard way to declaratively change settings in the databse?

Are you searching for extraConfig https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/web-apps/nextcloud.nix#L606-L621 ? I vaguely remember that this gets merged into the DB but I am not fully sure anymore. Maybe we can add something to overrideConfig https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/web-apps/nextcloud.nix#L790 ?

I am using recognize on my nextcloud, although installed through the app store. If you have any questions feel free to ask me directly or in chat.

I have the following dirty change for the setup service to make recognize download a required library because nextcloud is somehow not getting my PATH changes.

      nextcloud-setup = {
        requires = [ "postgresql.service" ];
        after = [ "postgresql.service" ];
        path = config.users.users.nextcloud.packages;
        script = ''
          if [[ ! -e /var/lib/nextcloud/store-apps/recognize/node_modules/@tensorflow/tfjs-node/lib/napi-v8/tfjs_binding.node ]]; then
            if [[ -d /var/lib/nextcloud/store-apps/recognize/node_modules/ ]]; then
              cd /var/lib/nextcloud/store-apps/recognize/node_modules/
              npm rebuild @tensorflow/tfjs-node --build-addon-from-source
            fi
          fi
        '';
      }

I also added the following packages to the nextcloud user:

      nextcloud.packages = with pkgs; [
        # generate video thumbnails with preview generator
        ffmpeg_5-headless
        # required for recognize app
        nodejs-14_x # runtime and installation requirement
        nodejs-14_x.pkgs.node-pre-gyp # installation requirement
        util-linux # runtime requirement for taskset
      ];

@benneti
Copy link
Contributor

benneti commented Jul 2, 2023

@SuperSandro2000 Thanks for your insight! If I might ask why add the packages to the user not the path of the phpfpm service? And I think you meant to write preStart or postStart not script for your workaround did you?
EDIT: Also did you do something different on nixos-23.05 where nodejs 14 is not in the cache and marked as insecure?

@SuperSandro2000
Copy link
Member

If I might ask why add the packages to the user not the path of the phpfpm service?

Updates sometimes break and having the package available makes it easier to fix up by hand.

Also did you do something different on nixos-23.05 where nodejs 14 is not in the cache and marked as insecure?

The app only support nodejs 14, so no.

@benneti
Copy link
Contributor

benneti commented Jul 6, 2023

thanks, did you do something to tell recognize the correct node path, because for me it still does not work even after recompiling using npm ci and I have the feeling it might be due to still trying to use some other node executable (mind though I have no idea about node development...).

@SuperSandro2000
Copy link
Member

I think I just wrote the static path (/etc/profiles/per-user/nextcloud/bin/node) from the user packages into settings

@benneti
Copy link
Contributor

benneti commented Jul 6, 2023 via email

@SuperSandro2000
Copy link
Member

We can probably inject that config setting somehow but I didn't dug into that.

@dotlambda
Copy link
Member Author

Is there a standard way to declaratively change settings in the databse? In particular, I want to set the path to the Node.js binary. See https://github.com/nextcloud/recognize/blob/v3.3.6/lib/Migration/InstallDeps.php#L76.

I don't know how. That's what I wanted to express with

Is there a standard way to declaratively change settings in the databse? In particular, I want to set the path to the Node.js binary. See https://github.com/nextcloud/recognize/blob/v3.3.6/lib/Migration/InstallDeps.php#L76.

@SuperSandro2000
Copy link
Member

We could just run psql to inject that row in postStart. I don't really have a better idea.

@Pacman99
Copy link
Contributor

Pacman99 commented Aug 3, 2023

I tried the workaround above to edit the nextcloud-setup service and I got the following error from npm:

51 verbose lifecycle @tensorflow/[email protected]~install: CWD: /var/lib/nextcloud/store-apps/recognize/node_modules/@tensorflow/tfjs-node
52 silly lifecycle @tensorflow/[email protected]~install: Args: [ '-c', 'node scripts/install.js' ]
53 info lifecycle @tensorflow/[email protected]~install: Failed to exec install script
54 silly lifecycle @tensorflow/[email protected]~install: Returned: code: -2  signal: null
55 info lifecycle @tensorflow/[email protected]~install: Failed to exec install script
56 verbose stack Error: @tensorflow/[email protected] install: `node scripts/install.js`
56 verbose stack spawn sh ENOENT
56 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:19)
56 verbose stack     at onErrorNT (internal/child_process.js:472:16)
56 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:82:21)
57 verbose pkgid @tensorflow/[email protected]
58 verbose cwd /var/lib/nextcloud/store-apps/recognize/node_modules
59 verbose Linux 6.1.37
60 verbose argv "/nix/store/l831sxqicw9crp6naj7k538qfimdk1zd-nodejs-14.21.3/bin/node" "/nix/store/l831sxqicw9crp6naj7k538qfimdk1zd-nodejs-14.21.3/bin/npm" "rebuild" "@tensorflow/tfjs-node" "--build-addon-from-source" "--verbose"

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Mar 9, 2024
@mibmo
Copy link
Contributor

mibmo commented Mar 10, 2024

@SuperSandro2000 has your config changed since then? I'm having the same issue with PATH not updating, even when overriding services.phpfpm.pools.nextcloud.phpEnv.PATH, which just seems ... really weird to me. I don't know much anything about Nextcloud's architecture, but to me this would seem to suggest that apps run as a different process entirely?

@SuperSandro2000
Copy link
Member

Probably, I am setting the PATH for the user, that cron, systemd services, etc. all contain it.

@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict This PR has merge conflicts with the target branch labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
@teutat3s teutat3s mentioned this pull request Aug 15, 2024
13 tasks
@beardhatcode
Copy link
Contributor

I also try to add Recognise in #333545 , but I took another approach, as the app requires not only the release but also the content of the repo containing the models.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 18, 2024
@mibmo
Copy link
Contributor

mibmo commented Aug 25, 2024

I also try to add Recognise in #333545 , but I took another approach, as the app requires not only the release but also the content of the repo containing the models.

Closing in favor of this! :) oh crap, I thought this was my attempt at a PR trying to do this. My mistake, sorry! I've reopened.

@mibmo mibmo closed this Aug 25, 2024
@mibmo mibmo reopened this Aug 25, 2024
@teutat3s
Copy link
Member

Completed in #333545

@teutat3s teutat3s closed this Dec 16, 2024
@dotlambda dotlambda deleted the nextcloud-recognize-init branch December 17, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux 12.approvals: 1 This PR was reviewed and approved by one reputable person
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants