# Installation

EagleCast is a simple binary application that requires a Postgres database instance to run. The binary can be downloaded and run manually, or it can be run as a container with Docker compose.

## Binary
1. Download the [latest release](https://source.offmarket.win/aleagle/EagleCast/releases) and extract the EagleCast binary. `amd64` is the main one. It works for Intel and x86 CPUs.
1. `./eaglecast --new-config` to generate config.toml. Edit the file.
1. `./eaglecast --install` to install the tables in the Postgres DB (⩾ 12).
1. Run `./eaglecast` and visit `http://localhost:9000` to create the Super Admin user and login.

!!! Tip
    To set the Super Admin username and password during installation, set the environment variables:
    `EAGLECAST_ADMIN_USER=myuser EAGLECAST_ADMIN_PASSWORD=xxxxx ./eaglecast --install`


## Docker

The latest image is available on the Gitea registry at `source.offmarket.win/aleagle/eaglecast:latest`.

The recommended method is to download the [docker-compose.yml](https://source.offmarket.win/aleagle/EagleCast/src/branch/master/docker-compose.yml) file, customize it for your environment and then to simply run `docker compose up -d`.

```shell
# Download the compose file to the current directory.
curl -LO https://source.offmarket.win/aleagle/EagleCast/raw/branch/master/docker-compose.yml

# Run the services in the background.
docker compose up -d
```

Then, visit `http://localhost:9000` to create the Super Admin user and login.

!!! Tip
    To set the Super Admin username and password during setup, set the environment variables (only the first time):
    `EAGLECAST_ADMIN_USER=myuser EAGLECAST_ADMIN_PASSWORD=xxxxx docker compose up -d`


### Mounting a custom config.toml
The docker-compose file includes all necessary EagleCast configuration as environment variables, `EAGLECAST_*`.
If you would like to remove those and mount a config.toml instead:

#### 1. Save the config.toml file on the host

```toml
[app]
address = "0.0.0.0:9000"

# Database.
[db]
host = "eaglecast_db" # Postgres container name in the compose file.
port = 5432
user = "eaglecast"
password = "eaglecast"
database = "eaglecast"
ssl_mode = "disable"
max_open = 25
max_idle = 25
max_lifetime = "300s"
```

#### 2. Mount the config file in docker-compose.yml

```yaml
  app:
    ...
    volumes:
    - /path/on/your/host/config.toml:/eaglecast/config.toml
```

#### 3. Change the `--config ''` flags in the `command:` section to point to the path

```yaml
command: [sh, -c, "./eaglecast --install --idempotent --yes --config /eaglecast/config.toml && ./eaglecast --upgrade --yes --config /eaglecast/config.toml && ./eaglecast --config /eaglecast/config.toml"]
```

### Coolify

The repository ships a Coolify-ready compose file, [docker-compose.coolify.yml](https://source.offmarket.win/aleagle/EagleCast/src/branch/master/docker-compose.coolify.yml).

1. In Coolify, add a new resource -> *Docker Compose* and point it at the EagleCast git repository.
2. Set *Docker Compose Location* to `/docker-compose.coolify.yml`.
3. Assign your public domain to the `eaglecast` service (port 9000). Coolify's proxy handles TLS.
4. Optionally set `EAGLECAST_ADMIN_USER` and `EAGLECAST_ADMIN_PASSWORD` in the environment variables UI before the first deploy to auto-create the Super Admin.
5. Deploy. The image is built from source (frontend + backend) by the multi-stage `Dockerfile`, and the database schema is installed/upgraded automatically on start.
6. After logging in, set the root URL in *Admin -> Settings -> General* to your public `https://` domain.

-----------

## Nightly

!!! Warning
    Nightly releases are untested and may have bugs. Use at your own risk. Always take a backup of your Postgres database before using a nightly release.

A nightly build is automatically published with the latest changes merged to the repository. If you want to access the latest changes without waiting for versioned releases, you can obtain the nightly builds and follow the same instructions above.

- **Docker**: `source.offmarket.win/aleagle/eaglecast:nightly` (use this as the image name in the docker-compose file)
- **Binary**: [Download nightly release](https://source.offmarket.win/aleagle/EagleCast/releases)


## Compiling from source

To compile the latest unreleased version (`master` branch):

1. Make sure `go`, `nodejs`, and `yarn` are installed on your system.
2. `git clone https://source.offmarket.win/aleagle/EagleCast.git`
3. `cd eaglecast && make dist`. This will generate the `eaglecast` binary.
