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

Add trilium server and module #75047

Merged
merged 9 commits into from Dec 23, 2019
Merged

Add trilium server and module #75047

merged 9 commits into from Dec 23, 2019

Conversation

@kampka
Copy link
Contributor

@kampka kampka commented Dec 5, 2019

Motivation for this change

This change adds the trilium server package and a module to run it.
It also refactors the trilium package as such so its easier to keep the metadata and version of both packages in sync.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @dtzWill @emmanuelrosa

Copy link
Contributor

@aanderse aanderse left a comment

I have only reviewed the nixos module. Further to the points mentioned below there are inconsistencies between your spelling trillium vs trilium.

nixos/modules/services/web-apps/trilium.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/trilium.nix Outdated Show resolved Hide resolved
@kampka kampka force-pushed the kampka:trilium-server branch 2 times, most recently from 9ee81be to 7f59d7c Dec 6, 2019
@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 6, 2019

@aanderse Thanks very much for the quick review, I appreciate it :)

Copy link
Contributor

@aanderse aanderse left a comment

For some reason, presumably user error 😕, my mobile browser seems to have lost one of the comments I made on this PR. So here we go again... sorry for the noise.

nixos/modules/services/web-apps/trilium.nix Outdated Show resolved Hide resolved
@kampka kampka force-pushed the kampka:trilium-server branch 2 times, most recently from b42a4c3 to 947a723 Dec 6, 2019
@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 8, 2019

For some reason, presumably user error confused, my mobile browser seems to have lost one of the comments I made on this PR. So here we go again... sorry for the noise.

@aanderse for some reason GH has recorded this message as a change request.
Is there anything we need to do there to not have it block the merge?

Copy link
Contributor

@aanderse aanderse left a comment

Mostly fairly minor things at this point.

nixos/modules/services/web-apps/trilium.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/trilium.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/trilium.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/trilium.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/trilium.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/trilium.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/trilium.nix Outdated Show resolved Hide resolved
@kampka kampka force-pushed the kampka:trilium-server branch from 947a723 to 35fc57b Dec 8, 2019
@kampka kampka requested a review from aanderse Dec 8, 2019
Copy link
Contributor

@aanderse aanderse left a comment

Module looks good to me! Thanks.

I haven't reviewed anything but the module so I'll wait for review from @dtzWill, @emmanuelrosa, or anyone else who cares to provide it. If no one jumps on this in the next couple days ping me and I'll take a look at the package changes.

@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 8, 2019

@aanderse Thanks a lot for this comprehensive and instructive (also: timely ;) ) review !

@emmanuelrosa
Copy link
Contributor

@emmanuelrosa emmanuelrosa commented Dec 9, 2019

I tested trilium-desktop and trilium-server. Both worked :)

I used a NixOS container to install trilium-server and then connected from the host:

trilium-container.nix

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, lib, ... }:

{

   services.trilium-server = {
    enable = true;
    nginx = {
      enable = true;
      hostName = "trilium.example.com";
    };
  };

  networking.firewall.enable = false;
}

nixos-container create trilium --config-file trilium-container.nix --host-address 192.168.1.108 --local-address 10.233.0.100

@emmanuelrosa
Copy link
Contributor

@emmanuelrosa emmanuelrosa commented Dec 9, 2019

I forgot to mention that trilium-server is not logging to journald. Instead it's logging to a file in dataDir.

@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 9, 2019

I forgot to mention that trilium-server is not logging to journald. Instead it's logging to a file in dataDir.

It is actually doing both, although not quite consistently (https://github.com/zadam/trilium/blob/c4d5060a0b9f2066e661725c6d32ed2f016b8b71/src/services/log.js).
It's also not just the server, the desktop version does this too in ~/.local/share/trilium-data/log.
As there is no way to configure this, I see only the option to patch it on our side.
If anyone thinks it's worth it I'll prepare a patch for review

@kampka kampka force-pushed the kampka:trilium-server branch from 35fc57b to 0137929 Dec 9, 2019
@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 9, 2019

@emmanuelrosa I've added a patch for the server version that removes the file logger and logs to console only now.
The desktop version is a pre-build electron app, I don't see a good way to patch that without building from source.

@kampka kampka force-pushed the kampka:trilium-server branch from 0137929 to 99878a1 Dec 10, 2019
@kampka kampka force-pushed the kampka:trilium-server branch from 4bccbb9 to c96cd96 Dec 14, 2019
kampka added 8 commits Dec 5, 2019
@kampka kampka force-pushed the kampka:trilium-server branch from 83c4b8d to a7db640 Dec 19, 2019
@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 19, 2019

@GrahamcOfBorg build trilium-server
@GrahamcOfBorg build trilium-desktop
@GrahamcOfBorg test trilium-server

@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 19, 2019

Rebased against master and updated the package version once more.
Anyone willing to push the button? :)

@aanderse
Copy link
Contributor

@aanderse aanderse commented Dec 22, 2019

@kampka oops, sorry for the delay. I didn't notice the comments from @emmanuelrosa.

Speaking of which... @emmanuelrosa do you mind hitting the approve button please? I took a very quick look over the package but I would like you as the listed maintainer to give it the official thumbs up.

@kampka can you please address the aarch64 failure?

@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 22, 2019

@GrahamcOfBorg build trilium-desktop
@GrahamcOfBorg build trilium-server
@GrahamcOfBorg test trilium-server

@kampka kampka force-pushed the kampka:trilium-server branch from c32f9df to e1e76b8 Dec 22, 2019
@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 22, 2019

@GrahamcOfBorg build trilium-desktop
@GrahamcOfBorg build trilium-server
@GrahamcOfBorg test trilium-server

@ofborg ofborg bot added the 8.has: clean-up label Dec 22, 2019
@kampka kampka force-pushed the kampka:trilium-server branch from e1e76b8 to ebf3f1f Dec 22, 2019
@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 22, 2019

@GrahamcOfBorg test trilium-server

@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 22, 2019

@aanderse sorry for the noise, the fact that ofBorg does an "empty" run on unsupported archs threw me of there.
Pinned the executables and tests to x86_64-linux

@emmanuelrosa
Copy link
Contributor

@emmanuelrosa emmanuelrosa commented Dec 22, 2019

I don't have an approval button, but nevertheless, I approve :)

@aanderse
Copy link
Contributor

@aanderse aanderse commented Dec 23, 2019

Pinned the executables and tests to x86_64-linux

I thought if you marked a package as x86_64-linux tests would only run for that platform. I don't think you need to specifically mention that in the list of tests... but I'm not sure off the top of my head.

I don't have an approval button, but nevertheless, I approve :)

If you review a package you should have the ability to approve, comment, or request changes. Thank you for explicitly stating, though 😄

As an aside... you are marked as a maintainer for this package yet you aren't a member of the NixOS github project 🤔 If this is not by choice we should ping the maintainer of that code because it was my understanding that everyone listed as a maintainer was supposed to be added to the project at one point. Let me know if you want this corrected.

Copy link
Contributor

@aanderse aanderse left a comment

👍

Thanks @kampka! ...and sorry for the long drawn out process.

@aanderse aanderse merged commit 086d1ad into NixOS:master Dec 23, 2019
17 checks passed
17 checks passed
trilium, trilium-server on aarch64-linux No attempt
Details
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A darwin-tested
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release-combined.nix -A tested
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
tests.trilium-server on aarch64-linux Success
Details
tests.trilium-server on x86_64-linux Success
Details
trilium, trilium-server on x86_64-linux Success
Details
@emmanuelrosa
Copy link
Contributor

@emmanuelrosa emmanuelrosa commented Dec 23, 2019

@aanderse, I was involved in developing the original package. I suppose that's why I'm listed as a maintainer. I'd be honored to be a member of the NixOS project.

@kampka
Copy link
Contributor Author

@kampka kampka commented Dec 23, 2019

@aanderse @emmanuelrosa thanks for taking the time to review this guys 👍

@kampka kampka deleted the kampka:trilium-server branch Dec 23, 2019
@aanderse
Copy link
Contributor

@aanderse aanderse commented Dec 23, 2019

@kampka no problem. Thanks for the contribution 🎉
@emmanuelrosa I'm told this should be taken care of at some point today 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.