add systemd unit exemple

This commit is contained in:
Massaki Archambault 2021-03-21 21:52:22 -04:00
parent d72dc6d769
commit bfdb1f0946
3 changed files with 24 additions and 0 deletions

View File

@ -98,6 +98,10 @@ To stop the filesystem, use the command `umount /path/to/mountpoint` to cleanly
If `gitlabfs` is not cleanly stopped, you might start seeing the error "transport endpoint is not connected" when trying to access the mountpoint, even preventing from mounting back the filesystem on the same mountpoint. To fix this, use `umount` as root user, eg: `sudo umount /path/to/mountpoint`.
### Running automatically on user login
See [./contrib/systemd](contrib/systemd) for instructions on how to configure a systemd service to automatically run gitlabfs on user login.
## Caching
To reduce the number of calls to the Gitlab api and improve the responsiveness of the filesystem, `gitlabfs` will cache the content of the group in memory. If a group or project is renamed, created or deleted from Gitlab, these change will not appear in the filesystem. To force `gitlabfs` to refresh its cache, use `touch .refresh` in the folder to refresh to force `gitlabfs` to query Gitlab for the list of groups and projects again.

11
contrib/systemd/README.md Normal file
View File

@ -0,0 +1,11 @@
This unit file allows you to automatically start gitlabfs as a systemd unit.
## Install
1. Install gitlabfs using `go get`
2. Copy **gitlabfs@.service** into **~/.config/systemd/user**. Create the folder if it does not exists.
3. Reload systemd: `systemctl --user daemon-reload`
## Usage
1. Create your gitlabfs config file in **~/.config/gitlabfs** eg: **~/.config/gitlabfs/gitlab.com.yaml**. Make sure the config file name ends with **.yaml** and a mountpoint is configured in the file.
2. Start your service with `systemctl --user start gitlabfs@<name of your config>.service`. eg: `systemctl --user start gitlabfs@gitlab.com.service`. Omit the **.yaml** in the name of the service.
3. Enable your service start on login with `systemctl --user enable gitlabfs@<name of your config>.service`. eg: `systemctl --user enable gitlabfs@gitlab.com.service`

View File

@ -0,0 +1,9 @@
[Unit]
Description=FUSE filesystem for gitlab groups and projects (%i)
After=network-online.target
[Service]
ExecStart=%h/go/bin/gitlabfs -config %E/gitlabfs/%i.yaml
[Install]
WantedBy=network-online.target