docs: add Coolify deployment reference and configuration details
This commit is contained in:
@@ -42,22 +42,40 @@ Once you are satisfied with your changes, submit a pull request to the main repo
|
||||
|
||||
## Continuous Integration
|
||||
|
||||
Calminer uses Gitea Actions for automated testing, linting, and deployment. The CI pipeline is defined in `.gitea/workflows/cicache.yml` and runs on pushes and pull requests to the `main` and `develop` branches.
|
||||
Calminer uses Gitea Actions for automated testing, linting, and deployment. The pipeline is orchestrated by `.gitea/workflows/ci.yml`, which delegates to reusable stage workflows that run entirely on the self-hosted Gitea runner:
|
||||
|
||||
### Pipeline Stages
|
||||
|
||||
1. **Lint**: Checks code style with Ruff and Black.
|
||||
2. **Test**: Runs pytest with coverage enforcement (80% threshold), using a PostgreSQL service. Uploads coverage.xml and pytest-report.xml artifacts.
|
||||
3. **Build**: Builds Docker image and pushes to registry only on `main` branch pushes (not PRs) if registry secrets are configured.
|
||||
- `.gitea/workflows/ci-lint.yml` checks out the repository, installs dependencies, and runs Ruff, Black, and Bandit.
|
||||
- `.gitea/workflows/ci-test.yml` provisions PostgreSQL 17, installs dependencies, executes pytest with an 80% coverage threshold, and uploads `coverage.xml` plus `pytest-report.xml` artifacts.
|
||||
- `.gitea/workflows/ci-build.yml` builds the Docker image, pushing tags only for `main` branch pushes (never for pull requests) when registry credentials are configured. It retains the optional deployment job gated by commit messages (`[deploy staging]`, `[deploy production]`). The workflow validates that the configured registry host matches the current Gitea instance to avoid publishing to the wrong registry.
|
||||
- `.gitea/workflows/deploy-coolify.yml` runs on `push` events to `main` (and via manual dispatch) once the repository is checked out. It bundles `docker-compose.prod.yml`, requires Coolify secrets (`COOLIFY_BASE_URL`, `COOLIFY_API_TOKEN`, `COOLIFY_APPLICATION_ID`, optional `COOLIFY_DEPLOY_ENV`), and calls the Coolify `/api/v1/deploy` endpoint with the application UUID.
|
||||
|
||||
### Workflow Behavior
|
||||
|
||||
- Triggers on push/PR to `main` or `develop`.
|
||||
- Linting must pass before tests run.
|
||||
- Tests must pass before build runs.
|
||||
- Coverage below 80% fails the test stage.
|
||||
- Artifacts are available for PR inspection.
|
||||
- Docker push occurs only for main branch commits with valid registry credentials.
|
||||
- `CI - Lint` triggers on push/PR to `main`, `develop`, or `v2` and must succeed before downstream workflows start.
|
||||
- `CI - Test` and `CI - Build` run as dependent jobs within the orchestrating workflow, so artifacts and images reflect the linted commit.
|
||||
- Coverage below 80% fails the test workflow and stops the build sequence.
|
||||
- Artifacts remain available for PR inspection via the test workflow.
|
||||
- Docker pushes occur only for main-branch pushes (PRs will never publish images). Deployments run exclusively on `main` pushes and require explicit `[deploy staging]` / `[deploy production]` markers.
|
||||
- Coolify automation also runs only for `main` pushes and relies on the configured application UUID to target the correct deployment.
|
||||
|
||||
### Gitea Runner and Registry Configuration
|
||||
|
||||
The runner and registry are self-hosted within Gitea. Configure the following secrets in the repository settings before enabling the workflows:
|
||||
|
||||
- `REGISTRY_URL`: Base URL of the Gitea container registry (for example `https://git.example.com`).
|
||||
- `REGISTRY_USERNAME` / `REGISTRY_PASSWORD`: Credentials with permission to push images to the project namespace.
|
||||
- `COOLIFY_BASE_URL`: Base URL to the Coolify instance (no trailing slash).
|
||||
- `COOLIFY_API_TOKEN`: Personal API token from Coolify with deploy permission.
|
||||
- `COOLIFY_APPLICATION_ID`: Coolify application UUID (see **Applications → Settings → UUID** in the Coolify UI).
|
||||
- `COOLIFY_DEPLOY_ENV` (optional): Multiline environment file content; omit if `deploy/.env` is stored in the repo.
|
||||
- `KUBE_CONFIG`, `STAGING_KUBE_CONFIG`, `PROD_KUBE_CONFIG` (optional): Base64 encoded kubeconfig for the optional k8s deployment job.
|
||||
- `K8S_DEPLOY_ENABLED` (optional): Set to `true` to allow the CI deploy job to run Kubernetes steps; leave unset/any other value to skip k8s updates (Coolify deploy still runs).
|
||||
|
||||
Tips:
|
||||
|
||||
- Ensure DNS records resolve the registry host for the runner network. Runner logs such as `logs/ci-lint-399.log` will show failures if the host cannot be resolved.
|
||||
- The workflows prefer `GITEA_*` environment variables when available (for example `GITEA_REF`, `GITEA_SHA`) and fall back to GitHub-compatible names, guaranteeing operation on a native Gitea runner.
|
||||
- If you change the registry endpoint, update `REGISTRY_URL` and verify the workflow warning emitted by the “Validate registry configuration” step to avoid pushing images to the wrong registry.
|
||||
|
||||
### Local Testing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user