add documentation
This commit is contained in:
parent
db0681d6d1
commit
230dc9f69f
4 changed files with 114 additions and 40 deletions
41
README.md
41
README.md
|
|
@ -1,42 +1,3 @@
|
||||||
# docs.brut.systems
|
# docs.brut.systems
|
||||||
|
|
||||||
This program acts as a proxy to serve files directly from repositories.
|
View documentation [here](https://docs.brut.systems/judah/docs.brut.systems)
|
||||||
|
|
||||||
It expects the following environment variables to be set:
|
|
||||||
|
|
||||||
- `API_URL` - Base Forgejo API url (ex. `https://git.brut.systems`)
|
|
||||||
- `API_TOKEN` - Forgejo API authorization token
|
|
||||||
- `REDIRECT_URL` - Redirect url when access fails or files do not exist (ex. `https://git.brut.systems`)
|
|
||||||
- `PORT` - Port to listen on
|
|
||||||
|
|
||||||
## Usage w/ systemd
|
|
||||||
|
|
||||||
Create a file at `/etc/systemd/system/docs.brut.service` with the following:
|
|
||||||
|
|
||||||
```
|
|
||||||
[Unit]
|
|
||||||
Description=Serves files from Git repositories
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
ExecStart=<path/to/respository>/start.sh
|
|
||||||
WorkingDirectory=<path/to/repository>
|
|
||||||
ExecStop=/usr/bin/pkill docs.brut.systems
|
|
||||||
Restart=always
|
|
||||||
User=<user to run as>
|
|
||||||
Environment="API_URL=<url>"
|
|
||||||
Environment="API_TOKEN=<token>"
|
|
||||||
Environment="REDIRECT_URL=<url>"
|
|
||||||
Environment="PORT=<port>"
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
```
|
|
||||||
|
|
||||||
Then start the service:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ sudo systemctl enable docs.brut
|
|
||||||
$ sudo systemctl start docs.brut
|
|
||||||
```
|
|
||||||
|
|
|
||||||
73
docs/index.html
Normal file
73
docs/index.html
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Docs.Brut.Systems</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
padding: 1em 0 2em 0;
|
||||||
|
max-width: 750px;
|
||||||
|
font-size: 115%;
|
||||||
|
line-height: 1.4;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
h1, h2 {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
border-bottom: 1px solid;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
pre code {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
table caption {
|
||||||
|
padding: 0.5em;
|
||||||
|
text-align: left;
|
||||||
|
caption-side: top;
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
text-align: left;
|
||||||
|
border: none;
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
thead th {
|
||||||
|
border-bottom: 2px solid #ddd;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
tbody tr {
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Docs.Brut.Systems</h1><p>This program acts as a proxy to serve files directly from repositories.</p><p>It expects the following environment variables to be set:</p><ul><li><code>API_URL</code> - Base Forgejo API url (ex. <code>https://git.brut.systems</code>)</li><li><code>API_TOKEN</code> - Forgejo API authorization token</li><li><code>REDIRECT_URL</code> - Redirect url when access fails or files do not exist (ex. <code>https://git.brut.systems</code>)</li><li><code>PORT</code> - Port to listen on</li></ul><h2>Usage W/ Systemd</h2><p>Create a file at <code>/etc/systemd/system/docs.brut.service</code> with the following:</p><pre><code>[Unit]
|
||||||
|
Description=Serves files from Git repositories
|
||||||
|
After=network.target
|
||||||
|
</code></pre><pre><code>[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=<path/to/respository>/start.sh
|
||||||
|
WorkingDirectory=<path/to/repository>
|
||||||
|
ExecStop=/usr/bin/pkill docs.brut.systems
|
||||||
|
Restart=always
|
||||||
|
User=<user to run as>
|
||||||
|
Environment="API_URL=<url>"
|
||||||
|
Environment="API_TOKEN=<token>"
|
||||||
|
Environment="REDIRECT_URL=<url>"
|
||||||
|
Environment="PORT=<port>"
|
||||||
|
</code></pre><pre><code>[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
</code></pre><p>Then start the service:</p><pre><code>sudo systemctl enable docs.brut
|
||||||
|
sudo systemctl start docs.brut
|
||||||
|
</code></pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
39
docs/index.riv
Normal file
39
docs/index.riv
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
DOCS.BRUT.SYSTEMS
|
||||||
|
|
||||||
|
This program acts as a proxy to serve files directly from repositories.
|
||||||
|
|
||||||
|
It expects the following environment variables to be set:
|
||||||
|
|
||||||
|
- `API_URL` - Base Forgejo API url (ex. `https://git.brut.systems`)
|
||||||
|
- `API_TOKEN` - Forgejo API authorization token
|
||||||
|
- `REDIRECT_URL` - Redirect url when access fails or files do not exist (ex. `https://git.brut.systems`)
|
||||||
|
- `PORT` - Port to listen on
|
||||||
|
|
||||||
|
|
||||||
|
USAGE W/ SYSTEMD
|
||||||
|
|
||||||
|
Create a file at `/etc/systemd/system/docs.brut.service` with the following:
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Serves files from Git repositories
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=<path/to/respository>/start.sh
|
||||||
|
WorkingDirectory=<path/to/repository>
|
||||||
|
ExecStop=/usr/bin/pkill docs.brut.systems
|
||||||
|
Restart=always
|
||||||
|
User=<user to run as>
|
||||||
|
Environment="API_URL=<url>"
|
||||||
|
Environment="API_TOKEN=<token>"
|
||||||
|
Environment="REDIRECT_URL=<url>"
|
||||||
|
Environment="PORT=<port>"
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
Then start the service:
|
||||||
|
|
||||||
|
sudo systemctl enable docs.brut
|
||||||
|
sudo systemctl start docs.brut
|
||||||
1
main.go
1
main.go
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:generate go run git.brut.systems/judah/rivit2html@latest docs/index.riv
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue