Skip to content

Commit 92e619b

Browse files
committed
feat: add guide on using the tinyauth binary
1 parent 504b2c1 commit 92e619b

2 files changed

Lines changed: 101 additions & 0 deletions

File tree

.vitepress/config.mts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ export default withMermaid(
3737
{ text: "Github OAuth", link: "/docs/guides/github-oauth" },
3838
{ text: "Google OAuth", link: "/docs/guides/google-oauth" },
3939
{ text: "Github App OAuth", link: "/docs/guides/github-app-oauth" },
40+
{
41+
text: "Using the binary",
42+
link: "/docs/guides/using-the-binary",
43+
},
4044
{ text: "Access controls", link: "/docs/guides/access-controls" },
4145
{
4246
text: "Two factor authentication",

docs/guides/using-the-binary.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Using the binary
2+
3+
If you prefer using bare-metal over docker you can do so by using the tinyauth binary. This setup is ideal for LXC containers or machines that don't need to run docker but you would still like to use tinyauth to protect your services.
4+
5+
## Downloading the binary
6+
7+
To begin with, simply download the binary from the [latest](https://github.com/steveiliop56/tinyauth/releases/latest) Github release. There are builds available for both arm64 and amd64 linux machines. I suggest renaming the binary to `tinyauth` as that's what we will use for the rest of this guide. I also suggest ensuring that the binary is executable:
8+
9+
```shellscript
10+
chmod +x tinyauth
11+
```
12+
13+
## Configuring
14+
15+
To configure tinyauth we can either configure it through environment variables or through CLI flags. The recommended setup is to use environment variables. To configure tinyauth using environment variables you will need to download the example environment file from Github:
16+
17+
```shellscript
18+
curl -o tinyauth.env https://raw.githubusercontent.com/steveiliop56/tinyauth/refs/heads/main/.env.example
19+
```
20+
21+
Then you can simply edit the `tinyauth.env` file and either replacing the template values with actual values or simply remove the environment variables you do not need.
22+
23+
Alternatively, you can use CLI flags to configure tinyauth. This is not recommended as it can get quite complex and your shell may parse the values incorrectly. That's why you should always use quotes (`'`) to ensure that the values are given to tinyauth correctly.
24+
25+
A full list of environment variables and CLI flags is available in the [Configuration](/docs/reference/configuration.md) page.
26+
27+
## Running
28+
29+
After you are done with configuration you can start tinyauth. If you are using an environment variables you need to set them in your shell, this can be done by running:
30+
31+
```shellscript
32+
source tinyauth.env
33+
```
34+
35+
Finally you can start up the tinyauth server with:
36+
37+
```shellscript
38+
./tinyauth
39+
```
40+
41+
If you chose to use CLI flags you need to pass them to tinyauth with:
42+
43+
```shellscript
44+
./tinyauth --secret=example --app-url=https://tinyauth.example.com
45+
```
46+
47+
## Running as a service
48+
49+
if you need tinyauth to autostart on boot you can do so by creating a systemd service (this of course requires having systemd installed). Firstly you will need to create the service file:
50+
51+
```shellscript
52+
sudo nano /etc/systemd/system/tinyauth.service
53+
```
54+
55+
And fill it with the following content:
56+
57+
```
58+
[Unit]
59+
Description=Tinyauth service
60+
After=network.target
61+
62+
[Service]
63+
EnvironmentFile=/some/path/tinyauth.env
64+
ExecStart=/some/path/tinyauth
65+
Restart=on-failure
66+
67+
[Install]
68+
WantedBy=multi-user.target
69+
```
70+
71+
::: info
72+
Make sure to replace the paths in the service with the actual locations of your environment and binary file.
73+
:::
74+
75+
::: tip
76+
If you are using CLI flags, you can remove the `EnvironmentFile` line and add your flags to to the `ExecStart` line, e.g. `ExecStart=/some/path/tinyauth --secret=secret --app-url=https://tinyauth.example.com`.
77+
:::
78+
79+
Finally we need to reload the systemd daemon:
80+
81+
```shellscript
82+
sudo systemctl daemon-reload
83+
```
84+
85+
And start our new service:
86+
87+
```shellscript
88+
sudo systemctl enable --now tinyauth
89+
```
90+
91+
You can view the logs of tinyauth by running:
92+
93+
```shellscript
94+
sudo journalctl -efu tinyauth
95+
```
96+
97+
That's it! Tinyauth should automatically start on boot now!

0 commit comments

Comments
 (0)