To clone locally: $ git clone https://betagit.vosjedev.net/git/gitsune.git
3e0e1c817443 [html+css] revise the menubar to make the logo larger[checkout]
| Name | Size | Mode |
|---|---|---|
| .gitignore | 21B | 100644 |
| Dockerfile | 701B | 100644 |
| README.md | 7.05KiB | 100644 |
| container-entry.sh | 2.57KiB | 100755 |
| example-gitolite.rc | 7.05KiB | 100644 |
| gen_nerdfont_mappings.py | 2.56KiB | 100644 |
| poetry.lock | 42.51KiB | 100644 |
| pyproject.toml | 627B | 100644 |
| scripts/ | - | 040000 |
| src/ | - | 040000 |
| tests/ | - | 040000 |
Gitsune¶
I present to the general public: gitsune!
Gitsune is a git forge based on top of gitolite and git. It was written due to me wanting some software that does the following:
- provide all features I'd use out of a modern forge (taking forgejo and sourcehut as my examples)
- have "account" and repository management be as simple as it is on gitolite (like using ssh keys instead of passwords)
- allow anyone to contribute as long as they have an email address
This lead to the following featureset:
- SSH-key based login: we use gitolite's keydir to provide login
- native file rendering: uses python-markdown and pygments to render git
blobs, uses custom code and html tables to display gittreeobjects - smart http cloning: "outsources" this to
git's CGI smart-cloning script, viagitolite-shellfor authorisation - feature-rich logviewer: features a checkout link, full description (not just summary) viewing, author and commit date fields (though sadly lacks a graph and any form of ranges...)
- webhooks: automatically picks either a subset of github's webhook packets, or a nice discord embed when the URL contains
discord - and bug/patch tracking (acit-style) will eventually arrive too!
The name¶
The name, Gitsune, is a combination of the name of the kitsune, a japanese mythical fox creature, and our favorite version control system, git.
Notes (READ THIS before deploying)¶
- Gitsune works with a plugin architecture. Most features are a plugin you can enable/disable.
- Gitsune does not support Partial Copy access control. It may work accidentally, but don't expect it to.
- You can enable and disable any plugin, but that does not mean the plugin won't be linked to. So disabling plugins like
treeandobjectviewerwill probably give you dead links. - Disabling the
taskqueueplugin breaks the explore page. - Gitsune does not support "Old style multi-keys", as the gitolite manual calls them. See commit
130363cc. -
Gitsune works way better with wild repos. While config-defined repos work, a lot of features (at least all that depend on knowing the repo owner) will break.
- you can work around this by doing something like
echo -n yourkeyname > repositories/$REPO.git/gl-creator, but I don't recommend it. recreate your repos instead.
- you can work around this by doing something like
- To massively increase authentication speed, read ## fastauth.
-
Just like gitolite, gitsune does not always delete old data, it might instead 'forget' about the data's existence. This is a list of data that isn't deleted:
- [all] data of plugins that were enabled and are no longer enabled
- [
account]allowed_signerslists of deleted/inactive users - possibly more that I did not add (yet)
you'll have to remove this data yourself.
Setup¶
If you are using the docker container, you can skip this (unless you're migrating an existing install).
- Gitsune uses
LOCAL_CODEto do a lot of stuff. Set upLOCAL_CODE, I personally use/var/lib/git/localfor it. - Then place
scripts/hook_post-receive.shin it ashooks/common/post-receive, and make sure it's executable -
Now install
scripts/trigger_post_create.shas a hook calledgitsune:- Copy the file as
triggers/gitsune, make sure it's executable. - Make sure to add
gitsuneto your list ofPOST_CREATEtriggers (putPOST_CREATE => [ 'gitsune', ],right before yourENABLEsection, see the gitolite docs)
- Copy the file as
Docker¶
The image has been only tested on podman. If you encounter any bugs using docker, feel free to report them. Note the build instructions will apply to podman.
Building the container is quite straightforward: podman build -t gitsune .. You can now deploy this, for example using a compose.yml:
| - | |
|---|---|
If you encounter an error while building that there is no pyproject.toml, explicitly mount the repo with the z flag: podman build -t gitsune -v $PWD:/source:z .
To do development using this image, mount the repo root at /gitsune, optionally read-only:
| - | |
|---|---|
KNOWN BUGS:¶
- if something provides invalid input to fastauth resulting in gitolite exiting (should be very difficult), the next request that does accesschecks will always return 403
- lack of documentation
- no log graphs :( (not really a bug but it is something I'd like to have)
- there's a possibility for multiple
JsonFile()classes to the same file existing. solution would be to make a.deletelater()function and keep it in the refs until then.
LOGLEVELS:¶
Set the loglevel with the DEBUG env. Do not enable this in production.
- stuff that happens often but not always
- expansion of 1
- very verbose logging
- the secret loglevel that unlocks even more logmessages
TODO¶
-
bug reporting
- ways to subscribe to bugreports
- a way to delete stuff
- bug metadata (status, maybe type, etc)
- task runners (basically simple CI/CD)
- cgit-style categories on the explore page
- the bugs in ## KNOWN BUGS
- user documentation
- admin docs if I feel like it
fastauth¶
Before the fastauth plugin, gitsune spawned a new gitolite process every time it wanted to check a permission (so at least once per request, for most plugins). This took a lot of time. fastauth (for fast authorisation) optimises this by using gitolite access in batch mode. This does require a patch to be applied to gitolite at the moment. Since gitolite v3.6.16, my patch has been included in the release. In case you are on an older version, continue reading. If you are on at least v3.6.16, simply enabling the fastauth plugin should be enough.
I recommend patching the specific file and putting it in your local code:
Afterwards, don't forget to add the fastauth plugin to the add_plugins config entry.
The other option, in case you are building gitolite from source, is to git apply the patch file on that. I use that method.