<div dir="ltr">Didier:<div><br></div><div>This sounds like exactly what I wanted!  So once this lands I will be able to just use: <span style="color:rgb(24,54,145);background-color:rgb(247,247,247);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:13.6px">snapctl get value</span> to get user set information?</div><div><br></div><div>Will the snapctl command be available anywhere in the snap or only in the hooks?</div><div><br></div><div>Also the upgrade hook looks like it could be a thing of beauty. Any plans for a downgrade hook?</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 27, 2016 at 10:14 AM Didier Roche <<a href="mailto:didrocks@ubuntu.com">didrocks@ubuntu.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le 27/10/2016 à 16:50, Aaron Ogle a écrit :<br class="gmail_msg">
> Greetings,<br class="gmail_msg">
><br class="gmail_msg">
> With our Rocket.Chat snap, we're looking to be able to allow someone<br class="gmail_msg">
> to run an external mongodb instead of the built in one.  As well as<br class="gmail_msg">
> we'd like to add something like caddy / traefik etc to do ssl<br class="gmail_msg">
> termination.  But its not a daemon we would want enabled out of the<br class="gmail_msg">
> box because of the effect on existing users.<br class="gmail_msg">
><br class="gmail_msg">
> So basically looking for a way let the user of a snap enable or<br class="gmail_msg">
> disable two different daemons in our snap.<br class="gmail_msg">
><br class="gmail_msg">
> Is this possible using anything out of the box?  Or would I have to<br class="gmail_msg">
> make the command ran in the daemon look at an environment variable /<br class="gmail_msg">
> file etc. and determine if it should make the daemon just exit?<br class="gmail_msg">
><br class="gmail_msg">
> How have others handled this?  Or allowing users to customize snap<br class="gmail_msg">
> behaviour?<br class="gmail_msg">
<br class="gmail_msg">
Hey Aaron,<br class="gmail_msg">
<br class="gmail_msg">
sounds like a great plan for usability!<br class="gmail_msg">
<br class="gmail_msg">
I would suggest using configure hooks to proceed that. Hooks are just a<br class="gmail_msg">
way for users to set variable=value. Based on that, you can control your<br class="gmail_msg">
daemon with a configure script (triggered by this command) inside your<br class="gmail_msg">
snap. This one can triggers start and stop inside a mongodb daemon<br class="gmail_msg">
wrapper (waiting for a certain value to be passed for instance before<br class="gmail_msg">
executing the real daemon).<br class="gmail_msg">
<br class="gmail_msg">
The documentation is not yet published on <a href="http://snapcraft.io" rel="noreferrer" class="gmail_msg" target="_blank">snapcraft.io</a> AFAIK, but is<br class="gmail_msg">
available there:<br class="gmail_msg">
<a href="https://github.com/snapcore/snapd/blob/master/docs/hooks.md" rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/snapcore/snapd/blob/master/docs/hooks.md</a>.<br class="gmail_msg">
<br class="gmail_msg">
However, please keep in mind about this bug<br class="gmail_msg">
<a href="https://bugs.launchpad.net/snappy/+bug/1636931" rel="noreferrer" class="gmail_msg" target="_blank">https://bugs.launchpad.net/snappy/+bug/1636931</a>, we need a new core image<br class="gmail_msg">
to have snapctl available from your snap, and so, you won't be able to<br class="gmail_msg">
experiment it right away.<br class="gmail_msg">
<br class="gmail_msg">
I'll probably write a codelab on this precise topic in a couple of weeks<br class="gmail_msg">
FYI (once the feature is really available to users and developers).<br class="gmail_msg">
Cheers,<br class="gmail_msg">
Didier<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
Snapcraft mailing list<br class="gmail_msg">
<a href="mailto:Snapcraft@lists.snapcraft.io" class="gmail_msg" target="_blank">Snapcraft@lists.snapcraft.io</a><br class="gmail_msg">
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/snapcraft" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.ubuntu.com/mailman/listinfo/snapcraft</a><br class="gmail_msg">
</blockquote></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">
<div><br></div><div><table border="0" cellspacing="0" cellpadding="0" style="color:rgb(0,0,0);font-family:verdana;font-size:medium">
        <tbody>
                <tr>
                        <td style="padding-right:15px">
                                <img src="https://cdn-download.rocket.chat/email-signature.png?v=3" style="width: 80px; display: block; margin-left: 10px;">
                        </td>
                        <td valign="top" style="padding-left:15px;border-left-width:1px;border-left-style:solid;border-left-color:rgb(240,240,240)">
                                <table width="100%" border="0" cellspacing="0" cellpadding="3" style="border-collapse:collapse;font-size:12px;margin-top:4px">
                                        <tbody>
                                                <tr>
                                                        <td style="padding:3px 0px 10px;margin:0px;font-family:verdana,geneva,sans-serif;font-size:12px;color:rgb(86,97,120)">
                                                                <b style="display:block;font-size:12px">Aaron Ogle</b>
                                                                <span style="color:rgb(153,153,153);font-size:10px;display:block">Core Developer</span>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td style="padding:0px 0px 2px;margin:0px">
                                                                <p style="margin:0px;padding:0px"><a href="mailto:aaron.ogle@rocket.chat" style="color:rgb(156,160,172);font-size:10px" target="_blank">aaron.ogle@rocket.chat</a></p>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        
                                                </tr>
                                                <tr>
                                                        <td style="padding:0px 0px 2px;margin:0px">
                                                                <p style="margin:0px;padding:0px"><a href="https://demo.rocket.chat/direct/aaron.ogle" style="color:rgb(156,160,172);font-size:10px" target="_blank">@aaron.ogle</a></p>
                                                        </td>
                                                </tr>
                                                <tr>
                                                        <td style="padding:0px 0px 2px;margin:0px">
                                                                <p style="margin:0px;padding:0px"><a href="https://rocket.chat" style="color:rgb(156,160,172);font-size:10px" target="_blank">https://rocket.chat</a></p>
                                                        </td>
                                                </tr>
                                        </tbody>
                                </table>
                        </td>
                </tr>
        </tbody>
</table></div>
</div></div>