Le 27/10/2016 à 16:50, Aaron Ogle a écrit : > Greetings, > > With our Rocket.Chat snap, we're looking to be able to allow someone > to run an external mongodb instead of the built in one. As well as > we'd like to add something like caddy / traefik etc to do ssl > termination. But its not a daemon we would want enabled out of the > box because of the effect on existing users. > > So basically looking for a way let the user of a snap enable or > disable two different daemons in our snap. > > Is this possible using anything out of the box? Or would I have to > make the command ran in the daemon look at an environment variable / > file etc. and determine if it should make the daemon just exit? > > How have others handled this? Or allowing users to customize snap > behaviour?
Hey Aaron, sounds like a great plan for usability! I would suggest using configure hooks to proceed that. Hooks are just a way for users to set variable=value. Based on that, you can control your daemon with a configure script (triggered by this command) inside your snap. This one can triggers start and stop inside a mongodb daemon wrapper (waiting for a certain value to be passed for instance before executing the real daemon). The documentation is not yet published on snapcraft.io AFAIK, but is available there: https://github.com/snapcore/snapd/blob/master/docs/hooks.md. However, please keep in mind about this bug https://bugs.launchpad.net/snappy/+bug/1636931, we need a new core image to have snapctl available from your snap, and so, you won't be able to experiment it right away. I'll probably write a codelab on this precise topic in a couple of weeks FYI (once the feature is really available to users and developers). Cheers, Didier -- Snapcraft mailing list Snapcraft@lists.snapcraft.io Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snapcraft