I have released a gogs snap gogsgit to the snap store in candidate. This gogs snap doesn’t come with mysql built-in and provides a way to access gogs full commandline easily.
For more info the snap-files are here: https://github.com/tbraeutigam/gogs-snap
snap install gogsgit --channel=candidate
I’ve run through basic tests on my machine without trouble.
I hope it’ll resist attempts to break it!
Hey, thanks for this, a gogs snap is one of the top items on my “snap wish list”
The daemon worked just fine in my testing (creating repositories/users/wiki pages etc).
I also tried some subcommands (gogsgit.<command>) not listed as “tested” in gogsgit.help and ran into the following issues:
I couldn’t create a user via command line:
$ gogsgit.admin create-user --name test --password test --email test@example.com
2017/08/21 13:34:43 [ WARN] Custom config '/snap/gogsgit/5/bin/custom/conf/app.ini' not found, ignore this if you're running first time
CreateUser: dial tcp 127.0.0.1:3306: socket: permission denied
I couldn’t create a backup even when specifying a --tempdir it is able to write to:
$ gogsgit.backup --tempdir /home/tim/snap/gogsgit/common/
2017/08/21 13:41:18 [ WARN] Custom config '/snap/gogsgit/5/bin/custom/conf/app.ini' not found, ignore this if you're running first time
2017/08/21 13:41:18 [ INFO] Backup root directory: /home/tim/snap/gogsgit/common/gogs-backup-294285712
2017/08/21 13:41:18 [ INFO] Packing backup files to: gogs-backup-20170821134118.zip
2017/08/21 13:41:18 [FATAL] Fail to create backup archive 'gogs-backup-20170821134118.zip': open gogs-backup-20170821134118.zip: read-only file system
I couldn’t launch gogsgit.web manually:
$ gogsgit.web
2017/08/21 13:43:42 [ WARN] Custom config '/snap/gogsgit/5/bin/custom/conf/app.ini' not found, ignore this if you're running first time
2017/08/21 13:43:42 [TRACE] Custom path: /snap/gogsgit/5/bin/custom
2017/08/21 13:43:42 [TRACE] Log path: /snap/gogsgit/5/bin/log
2017/08/21 13:43:42 [TRACE] Log Mode: Console (Trace)
2017/08/21 13:43:42 [ INFO] Gogs 0.11.29.0727
2017/08/21 13:43:42 [ INFO] Cache Service Enabled
2017/08/21 13:43:42 [ INFO] Session Service Enabled
2017/08/21 13:43:42 [ INFO] SQLite3 Supported
2017/08/21 13:43:42 [ INFO] Run Mode: Development
2017/08/21 13:43:42 [FATAL] [...gits/gogs/cmd/web.go:65 checkVersion()] Fail to read 'templates/.VERSION': open /snap/gogsgit/5/bin/templates/.VERSION: no such file or directory
Anyway, thanks a lot for this! Do you consider to try contributing it upstream once it is ready?
Thanks for making this, like @TimSueberkrueb, this was on my wishlist. There is a gogs snap registered in the store, which hasn’t been updated for a long time. It probably makes sense to move your snap over to the gogs name, as it’s up to date. I’d also recommend getting this submitted upstream once we’ve done some testing. Nice work!
I’ll try to get this upstream once most niggles are gone and
This is what I found:
gogs admin does not currently take a -c parameter to provide the app.ini path.
This might need an upstream fix. (possibly a build-time fix to allow for custom/ to be specified…)
For the other commands… they should work as long as you specifiy -c /path/to/app.ini.
I pushed a small fix to do two things:
remove gogsgit.admin from the commandline (can be accessed via gogsgit direct admin ... still but won’t work as stated)
have the commands executed from $SNAP_NAME.cmd auto-append -c $appini if app.ini isn’t found in the command line
This should fix most of the issues. Once thing to note though:
If you are looking to use the commands with the daemon, you will need to run it under sudo to allow for proper permissions. Else it’ll try to run it all with your current user.
Other changes that are included:
fix for gogsgit.cert not having a ‘/’ at the end
provide a gogsgit enableHttps (note the missing . here) to switch to the self-signed certs generated by gogsgit.cert
→ I’ve promoted it through to the stable channel, as it’s at least less broken
I’m encountering an odd issue: After refreshing the snap from the store snap I get an empty page at http://localhost:3001/.
Only after cleaning up the data directory /var/snap/gogsgit/<current rev> I can get to the setup page again.
Any ideas what’s going on or how I can debug that? I can reproduce it by using snap revert too.
I’m able to replicate the behaviour, but I’m not sure what’s causing it.
A service restart doesn’t change it either… there’s nothing useful logged in at Trace logging as well.
I’ve updated the snap on the store (all channels).
Please remove and reinstall it once as some directories have changed (this is more to not have extra garbage around…)
Here’s what I found:
gogs for whatever reason had ignored the APP_DATA_PATH as found in app.ini after any snap-operations.
The workaround is a bit ugly, but keeps it well alive:
there are now symlinks in $SNAP/bin/ for the custom and data directories.
In my local testing this has worked out just fine. I was able to re-install, upgrade and revert without any issues.
The full line will be gogsgit.backup -c /var/snap/gogsgit/current/custom/app.ini -t /var/snap/gogsgit/common/tmp --target /var/snap/gogsgigt/common/ (you might have to create the tmp dir)
Regrettably snapd doesn’t provide a proper /tmp space to snaps.
Regrettably snapd doesn’t provide a proper /tmp space to snaps.
Yeah, I think it should also be possible to give snaps read and/or write permission to files specifically chosen by the user on the filesystem (for something like this backup option and many other use cases like code editors for example).
Ubuntu Phone had the “Content Hub” which let phone (click) apps exchange different types of content through an interface but that was pretty limited. As for snaps, I’m not aware of any similar possibilities for content exchange between snaps and/or the system (but I might have missed something), besides of the home plug (which is probably not a proper solution).