docs.brut.systems/docs/index.html
2026-01-28 16:51:07 -07:00

73 lines
No EOL
2.7 KiB
HTML

<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>How It Works</h2><p>When a request like <code>http://localhost:8080/user/repository/path/to/file</code> is sent to the proxy, it will dynamically fetch that file from the repository and return it to the user.</p><h2>Usage With 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=&lt;path/to/respository&gt;/start.sh
WorkingDirectory=&lt;path/to/repository&gt;
ExecStop=/usr/bin/pkill docs.brut.systems
Restart=always
User=&lt;user to run as&gt;
Environment="API_URL=&lt;url&gt;"
Environment="API_TOKEN=&lt;token&gt;"
Environment="REDIRECT_URL=&lt;url&gt;"
Environment="PORT=&lt;port&gt;"
</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><h2>Usage Within Git.Brut.Systems</h2><p>Those with repositories on <a href="https://git.brut.systems">git.brut.systems</a> can serve websites by creating a <code>docs/</code> folder (on the default branch). While any file from the repository can be accessed, files within <code>docs/</code> are accessible from <code>/</code>. If a file within <code>docs/</code> conflicts with another file in the repository, the file in <code>docs/</code> take precedence.</p>
</body>
</html>