<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 13 December 2016 at 02:27, Ivan Lezhnjov IV <span dir="ltr"><<a href="mailto:iliv@commandprompt.com" target="_blank">iliv@commandprompt.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I’m working on pgbouncer snap package and as I’m new to snaps I wanted to ask the community what is the current preferred way to install a program’s configuration files that are meant to be edited by users?<br>
<br>
For example, pgbouncer has a couple of files: pgbouncer.ini and userlist.txt. Both normally located under /etc/pgbouncer.<br>
<br>
As users need to be able to modify various settings in pgbouncer.ini it has to be under $SNAP_USER_DATA/etc/pgbouncer/<wbr>.<br>
<br>
I use a standalone wrapper script that initializes some filesystem paths, creates empty log files, etc. which is all required by pgbouncer and is never created by the program itself, where I essentially do this:<br>
<br>
[ -e "$CNF_DIR/pgbouncer.ini" ] || cp $SNAP/etc/pgbouncer/pgbouncer.<wbr>ini $CNF_DIR/pgbouncer.ini<br>
<br>
As you can see I first dump pgbouncer.ini to $SNAP/etc/pgbouncer/ and then attempt to copy it to $CNF_DIR, which expands to $SNAP_USER_DATA/etc/pgbouncer.<br>
<br>
However, this doesn’t work as $SNAP/etc/pgbouncer/pgbouncer.<wbr>ini is owned by root and when the wrapper script is run as a normal user it cannot read the $SNAP/etc/pgbouncer/pgbouncer.<wbr>ini file (permission denied).<br></blockquote><div><br></div><div>I think the only problem here is that $SNAP/etc/pgbouncer/pgbouncer.ini was not world readable when snapped. Maybe a umask issue, or you need to explicitly set the permissions on this template file.<br><br><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I might be one step close to getting this to work but I was wondering what is the common/recommended practice to do what I’m trying to achieve here?</blockquote><div><br></div><div>I used the same approach you did, and got it building locally and working ( <a href="https://code.launchpad.net/~stub/+git/pgbouncer-snap/+ref/master">https://code.launchpad.net/~stub/+git/pgbouncer-snap/+ref/master</a> , please steal freely if there is anything useful there ). I haven't published it anywhere because I thought there was a reasonable chance you would be looking at it :) Also, I'm holding out hope that we can run non-root daemons sooner rather than later since pgbouncer is another app that refuses to run as root. I wasn't looking forward to documenting how to manually install systemd service definitions :)<br></div><div> </div></div><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Stuart Bishop <<a href="mailto:stuart.bishop@canonical.com" target="_blank">stuart.bishop@canonical.com</a>></div>

</div></div>