add soft serve maintenance

This commit is contained in:
2025-03-02 18:15:59 +01:00
parent fb157895fb
commit 1732c62734
3 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
---
title: "Soft Serve Maintenance"
tags: [ "data", "git server", "maintenance" ]
required: [ "git", "nginx" ]
---
Over time git repositories become bloated with old data, but never get cleaned.
I can't find an official way to clean up the crud, so I did this:
```sh
usermod -aG soft-serve $USER
# Log out and back in for this to take effect.
cd /var/lib/soft-serve/data/repos
sudo chmod -R g+w *
git config --global --add safe.directory '*'
du -sh *.git
for repo in *.git; do
git -C "$repo" gc
done
du -sh *.git
$EDITOR ~/.gitconfig
# You should remove having everything marked 'safe'.
```

View File

@@ -0,0 +1,71 @@
---
title: "Soft Serve through https"
tags: [ "data", "git server", "lfs" ]
required: [ "git", "nginx" ]
---
## `http` Setup
In this example, the port used is `23231`, but it can be anything.
Open `/var/lib/soft-serve/data/config.yaml` and make sure the `http` section looks like this:
```
# The HTTP server configuration.
http:
# The address on which the HTTP server will listen.
listen_addr: ":23232"
# The path to the TLS private key.
tls_key_path: ""
# The path to the TLS certificate.
tls_cert_path: ""
# The public URL of the HTTP server.
# This is the address that will be used to clone repositories.
# Make sure to use https:// if you are using TLS.
public_url: "http://localhost:23232"
```
Restart the `soft-serve` service, then check it's working by cloning from localhost:
```bash
git clone http://localhost:23232/${some_repo}.git
```
### `https` Setup
Put this file at `/etc/nginx/sites-enabled/$DOMAIN.tld`, then set up standard certificates with [nginx](../networking/website/nginx.md).
(replace `${DOMAIN_NAME}` with your domain's name).
```
server {
listen 80;
server_name ${DOMAIN_NAME};
location / {
proxy_pass http://localhost:23232;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name ${DOMAIN_NAME};
location / {
proxy_pass http://localhost:23232;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```