dsfx/docs/hosting.md

84 lines
3.1 KiB
Markdown
Raw Normal View History

2025-03-21 22:02:51 -04:00
# Hosting
2025-03-22 11:07:13 -04:00
## Installation
2025-03-24 13:35:08 -04:00
Due to the maturity of the project, we haven't yet created a release strategy.
In order to install DSFX, we recommend building the project from source.
2025-03-22 11:07:13 -04:00
2025-03-24 13:35:08 -04:00
### Dependencies
2025-03-22 11:07:13 -04:00
2025-03-24 13:35:08 -04:00
In order to build the project from source, you will need to have git installed
on your system, as well as the go compiler. You can install these dependencies
using your system's package manager. For example, on Ubuntu, you can run:
2025-03-22 11:26:56 -04:00
2025-03-24 13:35:08 -04:00
```bash
sudo apt-get install git golang
```
2025-03-22 11:26:56 -04:00
2025-03-24 13:35:08 -04:00
### Git Setup
2025-03-22 11:07:13 -04:00
2025-03-24 13:35:08 -04:00
Currently we are hosted on **gitea cloud**, which hides everything from the
public internet by default. This means that you will need to authenticate with
your gitea account as if you were cloning a private repository, even though our
repository is public. An easy way to do this is with the `.netrc` file combined
with a personal access token. You can create a `.netrc` file in your home directory
with the following contents:
2025-03-22 11:07:13 -04:00
2025-03-24 13:35:08 -04:00
```plaintext
machine koti.casa login <your username> password <gitea personal access token>
2025-03-22 11:07:13 -04:00
```
2025-03-24 13:35:08 -04:00
Finally, you'll need to set the `GOPRIVATE` environment variable to allow go to fetch
private repositories. You can do this by running the following command:
2025-03-22 11:07:13 -04:00
```bash
2025-03-24 13:35:08 -04:00
export GOPRIVATE=koti.casa
2025-03-22 11:26:56 -04:00
```
2025-03-24 13:35:08 -04:00
If you want to persist this setting across sessions, you can add the above line to your
`~/.bashrc` or `~/.bash_profile`.
### Installation
2025-03-22 11:26:56 -04:00
2025-03-24 13:35:08 -04:00
Now that you have the go toolchain set up with access to our repository, you can simply install the
project by using the `go install` command.
```bash
go install koti.casa/numenorlabs/dsfx/cmd/dsfx@main
```
2025-03-22 11:26:56 -04:00
2025-03-24 13:35:08 -04:00
### Running
2025-03-22 11:26:56 -04:00
2025-03-24 13:35:08 -04:00
You can run the DSFX server using the `dsfx` command, which will be available in your `$GOPATH/bin`
directory after installation. If you have added `$GOPATH/bin` to your `PATH`, you can run the server
directly from the command line:
2025-03-22 11:26:56 -04:00
```bash
2025-03-24 13:35:08 -04:00
dsfx
```
2025-03-22 11:26:56 -04:00
2025-03-24 13:35:08 -04:00
Optionally, you can run the command directly via the `go run` command if you prefer not to install
the project globally. This can be done with the following command:
2025-03-22 11:26:56 -04:00
2025-03-24 13:35:08 -04:00
```bash
go run koti.casa/numenorlabs/dsfx/cmd/dsfx@main
2025-03-22 11:07:13 -04:00
```
2025-03-22 11:26:56 -04:00
## Environment Variables
DSFX uses the following environment variables to configure its behavior:
| Variable | Description | Default Value |
| --------------- | ----------------------------------------------------------- | ---------------- |
| DSFX_HOST | The host on which the DSFX server will run | 0.0.0.0 |
| DSFX_PORT | The port on which the DSFX server will listen | 8000 |
| DSFX_LOG_LEVEL | The log level to use. One of (error, warn, info, debug) | info |
| DSFX_DATA_DIR | The directory where the DSFX data files are stored | /etc/dsfx/data |
| DSFX_CONFIG_DIR | The directory where the DSFX configuration files are stored | /etc/dsfx/config |
## Local Files
The DSFX server uses local files for configuration and storage. The default directories for these
files are specified in the `DSFX_CONFIG_DIR` and `DSFX_DATA_DIR` environment variables. You can
change these directories by setting the corresponding environment variables before starting the server.