# Development

> Run Quasar locally, test it, and publish releases.

Source: https://quasar.achaverot.fr/docs/reference/development/

## Running locally

Requirements: Go and Docker.

```bash
git clone https://github.com/AymericChaverot/quasar.git
cd quasar
cp .env.example .env
docker network create traefik-net
go run ./cmd/server
```

The dashboard runs on `http://localhost:8080`. Sign in with `ADMIN_USER` and `ADMIN_PASSWORD` from `.env`.

- `.env` is loaded from the current folder. Real environment variables take precedence, and `ENV_FILE` points to another file.
- The database, applications and backups go to `.dev/`, which is ignored by Git.
- `COOKIE_SECURE=false` allows signing in over plain HTTP. Never use it in production.
- The admin account is only created when the database has no user.

## Tests

```bash
go build ./...
go test ./...
```

### Catalogue checks

```bash
# Every catalogue image still exists in its registry (network only)
CATALOG_IMAGES=1 go test ./internal/catalog/ -run TestEveryImageStillExists

# Every entry is actually deployed and probed (needs Docker, takes a while)
CATALOG_DEPLOY=1 go test ./internal/catalog/ -run TestDeploy -parallel 4 -timeout 3h

# Only some entries
CATALOG_DEPLOY=1 CATALOG_ONLY=immich,outline go test ./internal/catalog/ -run TestDeploy -v

# The example catalogues in catalogs/ are valid
go test ./internal/catalog/ -run TestExampleCatalogs
```

### Station checks

```bash
# The example stations in stations/ are valid
go test ./internal/station/ -run TestShippedStations

# Their scripts load in the runtime
go test ./internal/station/runtime/ -run TestEveryShippedStation
```

## CI and releases

| Workflow | Runs on | Does |
| --- | --- | --- |
| `ci.yml` | Every push and pull request | Build, vet, tests and Docker build. |
| `release.yml` | A `vX.Y.Z` tag | Publishes the image to GHCR (`vX.Y.Z` and `latest`) and creates the GitHub release. |

To publish a release:

```bash
git tag v0.5.0 && git push --tags
```

Installed servers see the release within 30 minutes. See [updating](/getting-started/updating/).

## Running your own fork

To install from a fork instead of the main repository:

1. Push the fork to GitHub and publish a first release (`git tag v0.1.0 && git push --tags`).
2. Make the GHCR package **public** (package page → *Package settings* → *Change visibility*). Otherwise servers can't pull the image, and the installer builds it locally instead, which is slower.
3. Run the installer with `QUASAR_REPO` pointing at the fork:

   ```bash
   curl -sSL https://raw.githubusercontent.com/<owner>/quasar/main/setup.sh \
     | sudo QUASAR_REPO=https://github.com/<owner>/quasar.git bash
   ```

4. Add these lines to `/opt/quasar/.env`, so the image and updates come from the fork, then run `docker compose up -d` in `/opt/quasar`:

   ```ini
   GITHUB_REPO=<owner>/quasar
   QUASAR_IMAGE=ghcr.io/<owner>/quasar:latest
   ```