212 lines
10 KiB
Markdown
212 lines
10 KiB
Markdown
# Contributing to Coulobre Panel
|
|
|
|
## Planning and releases
|
|
|
|
- Use [Gitea issues][issues] for the backlog and [milestones][milestones] for
|
|
the roadmap. Search for existing work before opening an issue. Use a
|
|
template and describe the problem, the intended outcome, and how to verify
|
|
the result.
|
|
- During triage, apply one `kind/` label and the relevant `area/` labels. The
|
|
labels can also be used on pull requests.
|
|
|
|
| Label | Use |
|
|
| --- | --- |
|
|
| `kind/bug` | Incorrect behavior or a regression. |
|
|
| `kind/feature` | New or expanded user-facing behavior. |
|
|
| `kind/docs` | Documentation, examples, or contributor guides. |
|
|
| `kind/maintenance` | Testing, tooling, packaging, or release preparation. |
|
|
| `area/panel` | The panel UI, authentication, and access control. |
|
|
| `area/hosting` | Accounts, plans, quotas, websites, domains, TLS, and SFTP. |
|
|
| `area/database` | MariaDB provisioning and database tools. |
|
|
| `area/mail` | Mailboxes, mail delivery, IMAP, and webmail. |
|
|
| `area/dns` | Zone management and DNS publication. |
|
|
| `area/backups` | Backup, retention, and restore workflows. |
|
|
| `area/migration` | Imports from other hosting panels. |
|
|
| `area/deployment` | Installation, configuration, upgrades, and operating systems. |
|
|
|
|
- Maintainers assign accepted work to a milestone when it has a target
|
|
release. Issues without a milestone stay in the backlog. Add a due date
|
|
when a release date has been agreed.
|
|
|
|
### Choose a release version
|
|
|
|
Use [Semantic Versioning][semver] for Coulobre releases. Consider the
|
|
documented interfaces people depend on, including configuration, CLI commands,
|
|
upgrade paths, and the protocols between the panel and its service nodes.
|
|
|
|
| Change | Version increment from 1.0 onward |
|
|
| --- | --- |
|
|
| Compatible bug fixes, including compatible security fixes | Patch (`1.2.3` → `1.2.4`) |
|
|
| Compatible features or deprecations | Minor (`1.2.3` → `1.3.0`) |
|
|
| Incompatible changes to a documented interface | Major (`1.2.3` → `2.0.0`) |
|
|
|
|
Before 1.0, use `0.Y.Z`. Increment `Y` and reset `Z` for a feature release or
|
|
an incompatible change. Increment `Z` for compatible fixes. Document any
|
|
incompatible change and its upgrade steps in the release notes.
|
|
|
|
Start release candidates at 1 for each target version and increment the
|
|
candidate number for each release. Use [Python version specifiers][versions]
|
|
in `pyproject.toml` and the matching tag in Git and Gitea.
|
|
|
|
| Release | Python package version | Git tag |
|
|
| --- | --- | --- |
|
|
| First candidate for 0.12.0 | `0.12.0rc1` | `v0.12.0-rc.1` |
|
|
| Next candidate for 0.12.0 | `0.12.0rc2` | `v0.12.0-rc.2` |
|
|
| Final 0.12.0 release | `0.12.0` | `v0.12.0` |
|
|
|
|
Keep published release tags and artifacts fixed. Publish a new version for
|
|
subsequent changes.
|
|
|
|
### Prepare a release
|
|
|
|
1. Update the package version in `pyproject.toml` using the versioning rules
|
|
above.
|
|
2. From a clean checkout, use `python -m build` to build the source
|
|
distribution and wheel. Run
|
|
`python tools/check_core_release.py dist/*.tar.gz dist/*.whl` to compare
|
|
both packages with the reviewed Git tree. Use `--ref <tag-or-commit>`
|
|
to verify the files against a specific revision. Install the built wheel
|
|
in a fresh virtual environment and run the deployment checks.
|
|
[Build documentation][build] · [Deployment checks][deployment-checks]
|
|
3. Create an annotated tag for the tested commit on `main`. Verify the
|
|
artifacts against that local tag before pushing it. Publish the
|
|
corresponding [Gitea release][releases] with the verified source
|
|
distribution and wheel. Include user-visible changes, installation or upgrade
|
|
instructions, and known limitations. Mark a release candidate as a
|
|
prerelease. Close the milestone when its target version is published.
|
|
|
|
Gitea release notes are the project changelog. The panel displays published
|
|
notes under **System → Updates → Changelog**. Use short Markdown sections for
|
|
user-visible features, improvements, fixes, and upgrade instructions as
|
|
applicable.
|
|
|
|
### Build and publish the Debian package
|
|
|
|
Build from the same verified source distribution and wheel used for the
|
|
release. The builder reads the package version and timestamp from the reviewed
|
|
Git revision, and rejects inputs which differ from it.
|
|
|
|
```sh
|
|
python tools/build_deb.py dist/*.tar.gz dist/*.whl --ref "$tag"
|
|
sha256sum dist/coulobre-panel_*.deb
|
|
```
|
|
|
|
Verify a fresh installation and an upgrade with existing data on Ubuntu 26.04
|
|
and Debian 13. Include the checked package and its SHA-256 checksum in the
|
|
release. After release review, publish the same file to each supported suite
|
|
in the [Hippogrief Debian registry][debian-registry]. Use `resolute` and
|
|
`trixie` as the suites, `main` as the component for final versions, and
|
|
`candidate` for release candidates.
|
|
|
|
```sh
|
|
registry=https://code.hosting.hippogrief.nl/api/packages/hippogrief/debian
|
|
for suite in resolute trixie; do
|
|
curl --fail-with-body --user "$GITEA_USER" --upload-file "$deb" \
|
|
"$registry/pool/$suite/$component/upload"
|
|
done
|
|
```
|
|
|
|
Set `deb` to the checked artifact. When prompted by curl, use a Gitea token
|
|
with permission to publish packages. In the registry, link the package to
|
|
`hippogrief/coulobre` and verify that clients can install it using the
|
|
[documented signed APT configuration][apt-installation].
|
|
|
|
### Prepare a web update
|
|
|
|
For a release tested through the web updater, generate and attach
|
|
`web-update.json` alongside the matching wheel. List each tested starting
|
|
package version after the wheel path. Only list versions that can upgrade
|
|
with the dependencies and service units they already have.
|
|
|
|
```sh
|
|
python tools/web_update_manifest.py dist/coulobre_panel-0.10.2rc1-py3-none-any.whl \
|
|
0.10.1rc1 > dist/web-update.json
|
|
```
|
|
|
|
## Pull requests
|
|
|
|
- Start changes on a dedicated branch from the default branch, named main.
|
|
- Group related commits in a pull request that can be reviewed as a whole.
|
|
Describe what changed and how it was verified. Use `Closes #123` when the
|
|
pull request completes an issue. Use `Refs #123` for related or partial work.
|
|
- Submit changes for review before merging into main.
|
|
- Write issues, pull requests, code, comments, technical documentation, and
|
|
commit messages in English.
|
|
- Keep credentials, customer data, and local configuration out of commits.
|
|
|
|
[issues]: https://code.hosting.hippogrief.nl/hippogrief/coulobre/issues
|
|
[milestones]: https://code.hosting.hippogrief.nl/hippogrief/coulobre/milestones
|
|
[releases]: https://code.hosting.hippogrief.nl/hippogrief/coulobre/releases
|
|
[semver]: https://semver.org/
|
|
[versions]: https://packaging.python.org/en/latest/specifications/version-specifiers/#pre-releases
|
|
[build]: https://build.pypa.io/en/stable/
|
|
[deployment-checks]: docs/deployment.md#verify-a-new-installation
|
|
|
|
## Code style
|
|
|
|
- Follow PEP 8 with four spaces per indentation level, up to 79 characters
|
|
per line of Python, and up to 72 for comments and docstrings. Ruff formats
|
|
Python, sorts imports, and checks naming and common mistakes using the
|
|
project's Python target. [PEP 8](https://peps.python.org/pep-0008/)
|
|
- Use names from the hosting domain, such as `account`, `mailbox`, and
|
|
`zone`. Use verbs for actions and name tests after the behavior they
|
|
check, such as `test_unmanaged_running_zone_blocks_installation`.
|
|
- Explain why a constraint, permission check, or retry exists when the
|
|
code alone cannot explain it. Use PEP 257 for docstrings. Document
|
|
inputs, results, or side effects when callers need that information.
|
|
[PEP 257](https://peps.python.org/pep-0257/)
|
|
- Define model fields and managers first, then `Meta`, special methods,
|
|
and application methods. Give records displayed to users a meaningful
|
|
string representation. Generate a new migration when the schema
|
|
changes and review the generated operations.
|
|
[Django model style](https://docs.djangoproject.com/en/5.2/internals/contributing/writing-code/coding-style/#model-style)
|
|
- Use UTF-8 and LF line endings. Match the EditorConfig indentation for
|
|
each file type and follow the enclosing format in service configuration
|
|
and deployment examples. [EditorConfig](.editorconfig)
|
|
|
|
## Code organization
|
|
|
|
- Keep HTTP handling in views and input validation in forms or existing
|
|
domain objects. Use the access helpers for tenant scoping and enforce
|
|
permissions in the view. Put related writes and quota checks in a
|
|
service function with a transaction.
|
|
[Access helpers](src/coulobre/hosting/access.py),
|
|
[resource requests](src/coulobre/hosting/resource_requests.py)
|
|
- Coordinate background provisioning in tasks and contact local services
|
|
through the node client. Keep privileged changes in node commands.
|
|
Keep manifests compatible with existing nodes and make provisioning
|
|
safe to retry with the same request.
|
|
[Provisioning tasks](src/coulobre/hosting/tasks.py),
|
|
[node client](src/coulobre/hosting/node_client.py)
|
|
- Follow the closest existing implementation when extending a resource.
|
|
Reuse an existing helper when it already owns the validation or policy.
|
|
Extract shared code when the callers genuinely share behavior.
|
|
- Test through the entry point the caller uses. Follow neighboring
|
|
`test_*.py` modules and cover relevant permission boundaries or retries
|
|
when changing those behaviors.
|
|
|
|
## Panel copy and templates
|
|
|
|
- Use plain English and the same names for resources throughout the
|
|
interface. Write button labels as short actions in sentence case, such
|
|
as **Request mailbox** or **Publish zone**.
|
|
- Tell the reader what happened and, where they can act, what to do next.
|
|
For example, “This zone changed before publication. Reload the account
|
|
and try again.” Keep credentials and raw service output out of messages
|
|
shown in the panel.
|
|
- Reuse existing templates and styles for controls, focus states, and
|
|
status labels. Keep form inputs labelled and validation errors close to
|
|
the field that needs attention.
|
|
- Use the shared workspace template for signed-in pages. Place the page
|
|
heading first, followed by local tabs and any account, domain, or list
|
|
filters. Start the main content below the divider. Keep status updates
|
|
separate from forms the operator or customer may be editing.
|
|
[Workspace template](src/coulobre/hosting/templates/hosting/workspace_page.html)
|
|
|
|
## Checks
|
|
|
|
Run the development checks before submitting a pull request. Gitea Actions
|
|
checks Python 3.12 and 3.14. [Development checks](docs/development.md#checks)
|
|
[debian-registry]: https://docs.gitea.com/usage/packages/debian/
|
|
[apt-installation]: docs/deployment.md#use-the-gitea-apt-repository
|