Reputation: 808
Here just checking out gogs, I followed a tutorial to setup gogs behind apache. I was able to see the install page, ran install successfully. But unable to go past that step, as I don't see a login page for gogs. terminal shows below error
[Macaron] 2020-03-03 16:48:29: Completed GET / 500 Internal Server Error in 743.184µs
[Macaron] 2020-03-03 16:48:29: Started GET /favicon.ico for 10.108.23.170
[Macaron] PANIC: session(start): mkdir data: permission denied
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/session/session.go:162 (0x9bae70)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:79 (0x963b80)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:157 (0x934080)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:135 (0x933daa)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:121 (0x963cd9)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:112 (0x976b1f)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/recovery.go:161 (0x976b0d)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/logger.go:40 (0x967973)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:157 (0x934080)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:135 (0x933daa)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:121 (0x963cd9)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:112 (0x975e40)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/logger.go:52 (0x975e2b)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/logger.go:40 (0x967973)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:157 (0x934080)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:135 (0x933daa)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:121 (0x963cd9)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/router.go:187 (0x977d66)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/router.go:303 (0x970405)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/macaron.go:220 (0x968d4c)
/usr/local/go/src/net/http/server.go:2774 (0x74a9c7)
/usr/local/go/src/net/http/server.go:1878 (0x7466b0)
/usr/local/go/src/runtime/asm_amd64.s:1337 (0x466190)
[Macaron] 2020-03-03 16:48:29: Completed GET /favicon.ico 500 Internal Server Error in 649.106µs
I have setup the directory/permissions. which I can see from
$su -c '/opt/gogs/gogs web' gogs
Password:
2020/03/03 16:52:17 [TRACE] Custom path: /opt/gogs/custom
2020/03/03 16:52:17 [TRACE] Log path: /opt/gogs/log
2020/03/03 16:52:17 [TRACE] Log Mode: File (Info)
when I hit the browser I got the above error.
Upvotes: 1
Views: 996
Reputation: 808
Solution to this issue is to change dir to the gogs install directory and run
$su -c '/opt/gogs/gogs web' gogs
Password:
2020/03/03 16:52:17 [TRACE] Custom path: /opt/gogs/custom
2020/03/03 16:52:17 [TRACE] Log path: /opt/gogs/log
2020/03/03 16:52:17 [TRACE] Log Mode: File (Info)
solved the issue,
reason: gogs tries to mkdir on present directory, when running from your home, gogs user won't have permission there.
cd /opt/gogs/
helps gogs to run under the gogs user owned directory with needed permissions.
Hope that helps somebody
https://www.itfanr.cc/2017/03/23/docker-ubuntu-gogs-deploy/ explains the workdir for docker, which helped to find this bit of info
Thank you
Upvotes: 1