|
| 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