I had everything in /var/git owned by the ‘git’ user, then the following
rc.d file was sufficient:

#!/bin/sh

daemon="/var/git/go/src/github.com/gogits/gogs/gogs web &"
daemon_user="git"

. /etc/rc.d/rc.subr

pexp="/var/git/go/src/github.com/gogits/gogs/gogs web"
rc_reload=NO

rc_cmd $1


> On 2016-03-25, at 20:18, Markus Hennecke
<[email protected]> wrote:
>
> Am 25.03.2016 um 02:45 schrieb Predrag Punosevac:
>> Hi Misc,
>>
>> Is anybody running Gogs
>>
>> https://gogs.io/
>>
>> in production on OpenBSD using PostgreSQL as a backend. Any chance to
>> share the installation/configuration notes with me?
>>
>> Predrag
>>
> Just compile it using the documentation. You don't have to set $GOROOT.
OpenBSD has the go files in the path already under /usr/local/bin
>
> I mimiced the binary tar balls and copied all the files in there to my
installation location.
> The directories public, scripts and templates and the README and LICENSE
files plus the gogs binary.
>
> You want to setup up a git user account if that is not already available.
Set it up with a valid shell so that only public key authentication is allowed
and let gogs handle all the SSH keys. In that way no user will get a login
shell when connecting via SSH.
>
> Setup a user and database in postgresql, I did that with user and database
name gogs.
> Make the gogs user the owner of the gogs database and set a password.
> Then on the installation page enter the username, password and database name
and you should be set. Gogs will create all tables in the database during
install.
>
> Gogs listens on 0.0.0.0 by default, so I added the entry HTTP_ADDR    =
127.0.0.1 in the server section of the app.ini file and setup nginx to be a
reverse proxy -> location /gogs/ { proxy_pass http://127.0.0.1:3000/; },
remember to adjust the ROOT_URL entry to match the nginx configuration.
>
> I wrote a litte rc.d script to start it using nohup, it has to be run as the
git user account:
> #! /bin/sh
>
> user="git"
> daemon="/home/${user}/gogs/gogs"
> daemon_flags="web"
>
> . /etc/rc.d/rc.subr
>
> rc_reload=NO
>
> rc_check() {
>        pkill -0 -f "${daemon} ${daemon_flags}"
> }
>
> rc_stop() {
>        pkill -f "${daemon} ${daemon_flags}"
> }
>
> rc_start() {
>        nohup su -l -c daemon ${user} -c "${daemon} ${daemon_flags}"
>/dev/null 2>&1 &
> }
>
> rc_cmd $1
>
>
> HTH
> Markus

Reply via email to