Support Declarative Configuration #385
Replies: 4 comments
-
Hey, if you are planning to package for Nix, please use goreleaser for that as I'm already deploying everything through goreleaser. They can publish packages for all kinds of package managers. I'm not familiar with how nix packages work, but if there are any problems goreleaser doesn't solve, let me know.
That should already be possible by creating a new user and only give this user the permissions you want. Normal users don't have access to to the app settings page. |
Beta Was this translation helpful? Give feedback.
-
I could do that, but it would only be published to the Nix User Repository which is the place for unofficial packages. I want to integrate it into nixpkgs, so that it becomes an official package. The downside of this is that it will require the package to be maintained over time, rather than the version being implicitly bumped every time you release on GitHub.
Ok, that's good to know. Still, I need a way to pre-seed the sqlite configuration. I expect there is a way to do this by manually importing a configuration into sqlite, though it would be more elegant if upsnap had a proper mechanism for this. NixOS contains hundreds of modules for configuration of services from Nix code. Here is an example for Nginx configuration: https://nixos.wiki/wiki/Nginx . So the goal here is to enable NixOS users to deploy UpSnap declaratively alongside any other system services. |
Beta Was this translation helpful? Give feedback.
-
I see, makes sense. What needs to be done for each release? A pull request on the nixpkgs repo?
I don't think I quite understand what is meant by that yet. What do you mean by pre-seed? Is this used so that the sqlite database is directly filled with content during the Nix installation and you don't have to configure everything via the web interface? |
Beta Was this translation helpful? Give feedback.
-
That's right. In the trivial case this just involves bumping the version numbers and package file hashes. Obviously if the build process changes, then there will need to be more extensive changes to the packaging. If you are interested, here is the prototype packaging I have: https://dpaste.org/k0YbK . It's quite simple The NixOS module with config file generation, and systemd config will be done separately.
That's right. NixOS encourages Configuration-as-Code (CaC). With some packages, this is more feasible than others. For example, on my home server, nginx, ddclient, postgresql, oath2_proxy, gitea, nextcloud, onlyoffice, octoprint and syncthing are completely configured by Nix configuration code. IMHO, it would be a nice feature for all UpSnap users, not just NixOS users, to have the option of configuring the service via a config file e.g. YAML, TOML or JSON. In this case, NixOS would simply generate that config file and create an ephemeral tmpfs data directory when the service starts up. In the absence of an input config file feature, I am contemplating generating the sqlite database instead, but I suspect that meddling in UpSnap's internal storage would be difficult to implement correctly and difficult to maintain. |
Beta Was this translation helpful? Give feedback.
-
I'm currently experimenting with packaging UpSnap for Nix, and integrating it with NixOS. I would like to create a NixOS module for UpSnap which would allow users to configure UpSnap in Nix code in much the same way that they do with other services.
NixOS modules work by generating settings files in response to the Nix configuration. The issue is that UpSnap currently lacks any way to configure it through settings files.
A poor-man's approach would be to (re)write the sqlite database at startup in a shell script before UpStart launches.
A more sophisticated approach would be for UpStart to accept a JSON (?) configuration file as a command-line option.
It would also be nice to have an option to lock down the settings UI so that users can't make changes. This would also solve the shutdown command security issue.
Beta Was this translation helpful? Give feedback.
All reactions