Files

1444 lines
65 KiB
Markdown

# Local development
Use Python 3.12 or later. From the repository root, install the panel and its
development tools in a virtual environment.
```sh
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -e '.[dev]'
export COULOBRE_SECRET_KEY="$(python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())')"
export COULOBRE_DEBUG=1
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
```
Open <http://127.0.0.1:8000/> and sign in with the administrator account.
Select **Add hosting account** and enter a name and a primary domain such as
`example.org`. Open an account from the list to edit its details or request an
Apache preview. Manage users, groups, and permissions at `/admin/`.
Use **Hosting packages** to add named plans with an optional description. Choose a
plan when creating or editing an account. Existing accounts start unassigned.
Operators need permission to view hosting packages before they can assign one.
Set a database limit and a mailbox limit on a hosting package to cap how many
requests each assigned account can make through the panel. A blank limit allows
unlimited requests. Zero blocks new requests of that type. Accounts without a
plan have unlimited requests. The account page shows usage for configured
limits. Mailboxes count toward the same limit across all of an account's mail
domains, including domains retained after a primary domain change.
Set **Mailbox storage limit (MiB)** to assign a Dovecot storage quota to each
new mailbox requested under the plan. The account page shows each mailbox's
assigned limit. Leave the field blank to omit a Coulobre storage limit.
[Configure Dovecot quota enforcement](#enforce-mailbox-storage-limits)
Set **Website storage limit (MiB)** to supply the initial value when an
operator applies a website quota from the account page.
[Apply a website storage limit](#apply-a-website-storage-limit)
Set optional PHP resource defaults on a hosting package. Coulobre applies them
on first local activation and when an operator reapplies the plan on the
account page. See [website PHP settings](deployment.md#configure-php-pool-limits-per-website).
Changing or reassigning a plan preserves existing databases and mailboxes. If
the new limit is at or below current usage, the panel blocks additional
requests of that type. Changing the plan's storage limit applies to new
mailbox requests. Use **Change storage limit** for an individual mailbox.
[Change a mailbox storage limit](#change-a-mailbox-storage-limit)
## Give a manager access to assigned accounts
In `/admin/`, create a normal user and add a **Manager** record for that user.
Then open a hosting account in Coulobre Panel and select the manager when
editing the account. Existing accounts start with no manager assigned.
Managers can sign in to Coulobre Panel to see their assigned hosting accounts
and plans. They can also onboard customers and assign an allowed hosting package
to an existing account.
To let the manager add accounts, set a positive account limit and select the
available hosting packages in the manager's admin record. The manager's account
list shows their allowance. The limit applies to self-service creation, and
operator assignments also count toward the allowance. New hosting accounts
automatically belong to the manager and require an allowed plan. A limit of
zero blocks creation of additional hosting accounts.
Platform operators manage existing accounts, assignments, manager allowances,
and node deployment files.
The local database defaults to `db.sqlite3`. Set `COULOBRE_SQLITE_PATH` to use a
different file. Keep `COULOBRE_DEBUG` for local development.
## Give a customer access to hosting accounts
In Coulobre Panel, open **Customers** and select **Add customer**. Enter a
username and email address to send a password setup link, or set an
initial password manually. Select the customer when adding or editing a
hosting account. Repeat the assignment for each hosting account the customer
should be able to access. To give an existing user customer access, add a
**Customer** record for that user in `/admin/`.
The customer signs in after setting or receiving their password.
Their account list shows only the hosting accounts assigned to them. Each
account page shows its hosting package, database requests, DNS zones, and mailbox
requests. Customers can request databases and mailboxes for their own accounts
within their plan limits. Operators deploy those requests on the hosting nodes.
Use **Suspend sign-in** in the customer list to block panel access for that
customer across all their hosting accounts. Use **Restore sign-in** to give
them access again. Account assignments are preserved through suspension.
Operators need the **Can view customer** permission to use the customer list
and select a customer on hosting accounts they can create or edit. **Can add
customer** enables customer creation. **Can change customer** enables
sign-in suspension and restoration.
To create an account for your own hosting, sign in as a verified server
administrator. On **Add hosting account**, leave **Customer** unassigned and
select **For my own hosting**. The panel links the account to your login and
creates a customer profile if needed. Use the role selector to switch to
**Customer** and manage the hosting assigned to that profile.
If local credential access is enabled, customers can choose **Connection
details** for databases and mailboxes on their assigned accounts. The panel
requires password confirmation for each reveal.
[Enable local connection details](deployment.md#show-local-database-and-mailbox-connection-details)
## View the panel as a customer
In the operator workspace, open **Show All Users** and select **Sign in as
customer** next to an eligible customer. The panel shows the customer's
assigned hosting accounts and supported resource pages. Request forms are
visible with their inputs disabled. The banner identifies the customer and
the session mode. Select **Leave impersonation** below the sidebar account
name, in place of the workspace switcher, to return to **All users** without
signing out. Signing out ends both sessions.
A support session lasts up to 30 minutes and applies to the current browser
session. The panel checks that both users remain eligible on each request.
For example, suspending the customer or removing the administrator's
permission ends the view on the next request.
A staff user needs both **Can view customer** and **Can view the panel as a
customer**. The second permission is listed under **Customer impersonation
sessions**. Manager and Customer workspaces cannot start impersonation.
Managers can use **Manage hosting** and **Contact and invitation** in
**My users** for their assigned customers without changing identity.
In `/admin/`, users with **Can view customer impersonation
session** can review the administrator, customer, timestamps, and outcome
for each session. The audit records are read-only in Django admin.
### Manage hosting on behalf of a customer
Grant **Can manage hosting as a customer** under **Customer impersonation
sessions**, in addition to the two customer view permissions. In the operator
workspace, open **Show All Users** and select **Manage as customer**. You can
use the customer's hosting tools for their assigned accounts, with the same
feature availability and package limits as the customer. This includes website
management, DNS, email, databases, SFTP, and backups where enabled.
The operator remains signed in. The support banner and **Leave impersonation**
stay available while managing hosting. Personal account settings, sign-in
credentials, MFA, existing service credential reveals, and SSO are not
delegated. Service password rotation, where enabled, requires the operator's
own password and the normal service credential permissions.
Managed hosting submissions are audited with the operator and customer
session, route, HTTP outcome, and numeric resource identifiers when available.
The audit does not include form values or credentials. A queued submission's
HTTP outcome is not its eventual execution result.
### Make limited changes during a support session
Grant **Can start a support session with write access** in addition to the
two customer view permissions. In the operator workspace, open the legacy
customer list at `/customers/` and select **Support with write access**
next to the customer. The banner identifies the active customer,
administrator, and mode. **Sign in as customer** in **All users** still
starts a read-only session.
In a writable session, the administrator can request a database or mailbox
and manage SSH keys on the customer's hosting accounts. Each action also
requires the administrator's normal permission for that operation. The
customer's account scope and plan limits apply. Forms belong to the active
support session. Reopen the form after changing sessions or modes.
Grant **Can view customer impersonation action** to review these changes in
`/admin/`. Each entry records the session, administrator, customer, account
ID, operation, resource, and time. SSH key changes record fingerprints of
the keys added or removed. Queued changes still report their execution
status in the hosting account.
## Export manifests from the command line
Routine provisioning and backups in the panel do not require a separate
manifest. For manual node operations or local testing, export the matching
resource using the panel's Django management environment.
```sh
panel_manage export_manifest database 1 > coulobre-database-1.json
panel_manage export_manifest dns-zone 1 > coulobre-zone.json
panel_manage export_manifest mailbox 1 > coulobre-mailbox-1.json
panel_manage export_manifest website 1 > coulobre-website-1.json
panel_manage export_manifest apache-preview 1 > coulobre-web-plan-1.json
panel_manage export_manifest account-backup 1 --include-mail > account.json
```
Replace `1` with the ID of the matching database, DNS zone, mailbox,
independent website, Apache preview, or hosting account. Use the
[`panel_manage` helper](deployment.md#prepare-the-panel) on an installed
server, or `python manage.py` in a development checkout. The command only
exports metadata and does not apply changes or create a backup.
## Request a MariaDB database
Open a hosting account and select **Request database**. Choose a short suffix
such as `wordpress`. The panel derives the full database name from the account
ID and suffix, so two accounts can each request a database named `wordpress`.
The account page shows the requested databases. The CLI manifest contains the
account ID and suffix. Managers
can view the requested database names on their own assigned accounts. The
manifest describes the database to provision on a MariaDB node.
Use the installed node command to validate the manifest and display the derived
database and login names.
```sh
coulobre-database-node inspect coulobre-database-1.json
```
### Apply a database manifest
Use a local MariaDB server with Unix socket authentication for
`root@localhost`. Install Coulobre with the `mariadb` extra in a root-owned
virtual environment and apply the exported manifest on that server.
```sh
sudo /opt/coulobre/bin/coulobre-database-node apply coulobre-database-1.json
```
The default socket is `/run/mysqld/mysqld.sock`. Use `--socket` for a different
local socket. The command creates a UTF-8 database and one login at
`localhost` with privileges on that exact database.
The command reports the path to a root-only credentials file under
`/var/lib/coulobre/database-node/`. Use those credentials when configuring the
application. Reapplying a manifest preserves the existing password and can
complete an interrupted first installation. Coulobre uses its local registry
and a database ownership marker to distinguish managed databases from existing
resources.
### Check a database installation
Run the following command on the MariaDB node with the same manifest and socket
used for installation.
```sh
sudo /opt/coulobre/bin/coulobre-database-node status coulobre-database-1.json
```
The read-only check verifies the local registry, the database ownership marker
and the application's direct MariaDB grants. It then connects over the local
socket with the stored application credentials and selects the database. The
JSON report includes the database and login names, the state, and a diagnostic
message when the installation needs attention.
| State | Exit code | Meaning |
| --- | --- | --- |
| `configured` | 0 | All checks passed. |
| `not_installed` | 2 | The registry, database, and login are absent. |
| `needs_attention` | 2 | Provisioning or restore is incomplete, or the installation differs from the expected configuration. |
Exit code `1` indicates an invalid manifest or an unavailable check, for example
when the MariaDB administrative connection fails.
### Back up and restore a managed database
Run these commands as root on the MariaDB node. Install the MariaDB client
utilities and the Coulobre package with its `mariadb` extra. Use the same
database manifest and socket as for provisioning. Add `--socket PATH` when
using a custom socket.
```sh
sudo install -d -m 0700 /var/backups/coulobre
sudo /opt/coulobre/bin/coulobre-database-node backup-database \
coulobre-database-1.json /var/backups/coulobre/database-1.sql.gz
```
The node writes a gzip-compressed SQL dump containing the database's schema,
rows, views, triggers, routines, and events. Database objects with a definer
must use the managed application login. The dump uses a single transaction
for InnoDB data. Pause schema changes and writes to nontransactional tables
during backup. Choose a new filename for each backup and keep archives in a
root-controlled directory with file permissions of `0600`.
To restore, apply the original manifest on the destination node and leave the
new database empty. Transfer the archive to a root-controlled directory on that
node and ensure it is owned by root with permissions of `0600`.
```sh
sudo /opt/coulobre/bin/coulobre-database-node restore-database \
coulobre-database-1.json /var/backups/coulobre/database-1.sql.gz
```
The node checks the gzip stream and its database identity before running the
SQL. The archive needs temporary space for the uncompressed SQL on the same
filesystem. Use the destination node's application credentials and keep the
application disconnected until the restore completes.
MariaDB can commit schema changes before reporting a restore error. If an
import fails, `status` reports `needs_attention`. Inspect the partial database
and return it to an empty state before retrying with the same manifest.
### Enable local database provisioning
On a MariaDB node using `/run/mysqld/mysqld.sock`, install the matching Coulobre
package with its `mariadb` extra in a root-owned virtual environment at
`/opt/coulobre`. Enable the local provisioning socket.
```sh
getent group coulobre-db-provisioning >/dev/null || sudo groupadd --system coulobre-db-provisioning
sudo install -m 0644 deploy/systemd/coulobre-database-apply.socket \
deploy/systemd/coulobre-database-apply@.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now coulobre-database-apply.socket
```
Grant the socket group only to the service identity responsible for database
provisioning. Send one version 1 MariaDB database manifest as UTF-8 JSON to
`/run/coulobre-database-apply.sock`. The limit is 4 KiB. Close the writing half
of the socket and read the JSON reply to EOF. For a valid manifest, the reply
includes its identity, a state of `configured` or `failed`, and a diagnostic
on failure.
MariaDB passwords stay in the root-only credentials files on the node.
## Render a BIND9 zone
Open a hosting account and select **Add DNS zone** to configure a zone for
its primary domain. Enter the nameservers, SOA mailbox, and any A or AAAA
records. To edit an existing zone, select its domain in the **DNS zones** table.
- In **MX records**, enter a name, priority and mail server on each line,
such as `@ 10 mx.provider.example`. Add an A or AAAA record for each
mail server inside the zone.
- In **TXT records**, enter a name and its value on each line, such as
`_dmarc.example.net v=DMARC1; p=none`. Use a quoted JSON string to preserve
leading spaces, line breaks, or an empty value.
Use `@` for the zone domain in either field. Use fully qualified names
for other records. The panel increments the SOA serial when the zone data
changes. Changing the account's primary domain preserves its existing DNS zones.
Export the zone using the CLI and copy the file to the hosting server or a
separate DNS node. Managers can see the configured domains and serials for
their assigned accounts. Operators with the appropriate permissions can add
and edit zones in the panel.
Coulobre exports version 2 for zones containing MX or TXT records and
version 1 for other zones.
A manifest can also be written directly for local testing. Save the
following example as `coulobre-zone.json`.
```json
{
"version": 1,
"kind": "bind9_zone",
"domain": "example.net",
"serial": 1,
"nameservers": ["ns1.example.net", "ns2.provider.example"],
"responsible_name": "hostmaster.example.net",
"addresses": [
{"name": "example.net", "address": "192.0.2.20"},
{"name": "ns1.example.net", "address": "192.0.2.53"},
{"name": "www.example.net", "address": "2001:db8::20"}
]
}
```
The first nameserver is the SOA primary. Supply addresses for nameservers
inside the zone. Use fully qualified names in `addresses` and DNS mailbox
notation for `responsible_name`, such as `hostmaster.example.net` for
`hostmaster@example.net`. Increment the SOA serial when editing a manifest
by hand.
Render the zone file and validate it with the `named-checkzone` utility
provided by the `bind9-utils` package. The rendered zone is written to
standard output. See the [BIND9 command reference](https://bind9.readthedocs.io/en/stable/manpages.html#named-checkzone).
```sh
coulobre-dns-node render coulobre-zone.json > db.example.net
named-checkzone example.net db.example.net
```
### Include mail records in a manifest
Version 2 adds the `mx_records` and `txt_records` arrays. In a version 1
manifest, update the version to `2` and add both arrays. Use an empty array
when you only need one record type. Version 1 manifests still work with
the updated node command.
```json
{
"version": 2,
"mx_records": [
{"name": "example.net", "priority": 10, "exchange": "mx.provider.example"}
],
"txt_records": [
{"name": "example.net", "text": "v=spf1 mx -all"},
{"name": "_dmarc.example.net", "text": "v=DMARC1; p=none"}
]
}
```
Keep the domain, nameservers, mailbox and addresses from the original
manifest. Increase the serial when updating a published zone. Use fully
qualified record names and supply an A or AAAA record for
each MX server inside the zone. Use priority `0` and exchange `.` for a null
MX record at a name that receives no mail. [RFC 7505](https://www.rfc-editor.org/rfc/rfc7505.html)
Supply TXT values as plain JSON strings. The renderer quotes the values and
splits long UTF-8 strings into DNS character strings. DKIM readers concatenate
the strings in the TXT record. [RFC 1035](https://www.rfc-editor.org/rfc/rfc1035.html) and [RFC 6376](https://www.rfc-editor.org/rfc/rfc6376.html)
### Include CNAME, SRV, and CAA records in a manifest
Version 3 adds an `extra_records` array and retains the two arrays from
version 2. The panel emits version 3 for zones that use an extra record type.
The node still accepts version 1 and 2 manifests.
```json
{
"name": "_sip._tcp.example.net",
"record_type": "SRV",
"value": "10 0 5060 sip.example.net."
}
```
Use fully qualified names for CNAME targets and SRV target hosts. Use `.`
as an SRV target for an unavailable service. A CNAME cannot share its owner
with any other record or form a loop within the zone.
### Apply a zone manifest
Install `bind9` and `bind9-utils` on the DNS node. Use BIND9's default
IN view and enable `allow-new-zones yes;` in the existing `options` block.
On an authoritative-only DNS node, set `recursion no;` and configure
`allow-transfer` to match your secondary servers. Set
`allow-transfer { none; };` on a standalone server. Verify that the local
RNDC control channel is available after applying your BIND9 configuration.
```sh
sudo rndc -s 127.0.0.1 status
sudo /opt/coulobre/bin/coulobre-dns-node apply coulobre-zone.json
```
Coulobre validates the zone with `named-checkzone` and installs it under
`/etc/bind/coulobre/`. BIND9 persists the primary zone registration through
`rndc addzone`. To publish an edit manually, export the updated manifest and apply
it again. Coulobre checks the SOA serial, reloads the individual zone, and
waits for BIND9 to report the requested serial. Reapply the same manifest to
resume after an interrupted reload. See the [BIND9 command reference](https://bind9.readthedocs.io/en/v9.18.39/manpages.html#rndc) and [RFC 1982](https://www.rfc-editor.org/rfc/rfc1982.html).
### Enable local DNS publishing
On a BIND9 node with the same RNDC setup, install Coulobre in a root-owned
virtual environment at `/opt/coulobre`. Create the managed zone directory and
enable the publishing socket.
```sh
getent group coulobre-dns-provisioning >/dev/null || sudo groupadd --system coulobre-dns-provisioning
sudo install -d -o root -g root -m 0755 /etc/bind/coulobre
sudo install -m 0644 deploy/systemd/coulobre-dns-apply.socket \
deploy/systemd/coulobre-dns-apply@.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now coulobre-dns-apply.socket
```
Grant the socket group only to the service identity responsible for publishing
zones. Send one version 1, 2, or 3 zone manifest as UTF-8 JSON to
`/run/coulobre-dns-apply.sock`, with a limit of 1 MiB. Shut down the writing
half of the connection and read the JSON reply to EOF. For a valid manifest,
the reply identifies the domain and SOA serial. A `configured` reply means
BIND9 has loaded that serial. A `failed` reply includes a diagnostic.
## Request a virtual mailbox
Open a hosting account and select **Request mailbox**. Enter the part before
the `@`, such as `support`. The panel uses the account's primary domain,
lowercases the local part, and converts the domain to its ASCII DNS form.
Existing mailbox requests keep their addresses when the primary domain changes.
The **Mailbox requests** table shows the email addresses. The CLI export
contains the domain and local part.
Managers can see mailbox requests on their assigned accounts.
Version 2 adds `quota_mib` for mailboxes with a storage limit. Version 1
manifests continue to apply with no Coulobre storage limit.
Run the installed node command to validate the manifest and display its
address. The manifest describes a virtual user for the Postfix and Dovecot
mail stack. See the [Dovecot guide to Postfix and LMTP](https://doc.dovecot.org/2.3/configuration_manual/howto/postfix_dovecot_lmtp/).
```sh
coulobre-mail-node inspect coulobre-mailbox-1.json
```
### Apply a mailbox manifest
Install Postfix, `dovecot-imapd`, and `dovecot-lmtpd`. Debian 13 and Ubuntu
26.04 use Dovecot 2.4. Ubuntu 24.04 uses Dovecot 2.3. Install Coulobre in a
root-owned virtual environment on the node. Use a Postfix hostname outside
the set of hosted mail domains and keep those domains in Postfix's virtual
mailbox address class. See the [Postfix virtual domain guide](https://www.postfix.org/VIRTUAL_README.html).
On a fresh mail node, create the virtual mail user and empty lookup files.
```sh
sudo adduser --system --group --no-create-home --home /srv/coulobre-mail \
--shell /usr/sbin/nologin coulobre-vmail
sudo install -m 0644 /dev/null /etc/postfix/coulobre-domains
sudo install -m 0644 /dev/null /etc/postfix/coulobre-mailboxes
sudo install -o root -g dovecot -m 0640 /dev/null /etc/dovecot/coulobre-users
```
Use these values in Postfix's `main.cf`.
```ini
virtual_mailbox_domains = proxy:texthash:/etc/postfix/coulobre-domains
virtual_mailbox_maps = proxy:texthash:/etc/postfix/coulobre-mailboxes
virtual_transport = lmtp:unix:private/dovecot-lmtp
smtpd_reject_unlisted_recipient = yes
```
#### Dovecot 2.3 on Ubuntu 24.04
Replace the stock `auth-system.conf.ext` include in Dovecot's `10-auth.conf`
with the following virtual user configuration. Configure Dovecot's TLS
certificate and keep encrypted client authentication enabled on a public
mail node. See the [Dovecot passwd-file guide](https://doc.dovecot.org/2.3/configuration_manual/authentication/passwd_file/).
```text
auth_username_format = %Lu
auth_cache_size = 0
passdb {
driver = passwd-file
args = /etc/dovecot/coulobre-users
}
userdb {
driver = passwd-file
args = /etc/dovecot/coulobre-users
}
```
Set the mailbox format and enable the LMTP socket for Postfix in Dovecot.
Use the output of `id -u coulobre-vmail` for both UID settings in place of
the example value `103`. This limits Dovecot mailbox access to the virtual
mail user on this node. See the [Dovecot UID range settings](https://doc.dovecot.org/2.3/settings/core/#first-valid-uid).
```text
protocols = imap lmtp
mail_location = maildir:~/Maildir
first_valid_uid = 103
last_valid_uid = 103
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
user = postfix
group = postfix
mode = 0600
}
}
```
#### Dovecot 2.4 on Debian 13 and Ubuntu 26.04
For a fresh, dedicated mail node, use the
[Dovecot 2.4 configuration example](../deploy/dovecot/coulobre-2.4.conf.example)
as `/etc/dovecot/dovecot.conf`. Set the certificate and key paths for the mail
hostname. Use the output of `id -u coulobre-vmail` for both UID settings.
For an existing mail node, follow the
[Dovecot upgrade guide](https://doc.dovecot.org/2.4.2/installation/upgrade/2.3-to-2.4.html)
to migrate its configuration and retain its Maildirs and Coulobre registry.
#### Enforce mailbox storage limits
Use Dovecot's count quota driver for mailbox storage limits. The
[Dovecot 2.4 example](../deploy/dovecot/coulobre-2.4.conf.example) enables
quota enforcement and reports usage to IMAP clients. Keep the quota's default
storage size unlimited so mailbox-specific limits come from Coulobre.
[Dovecot 2.4 quota configuration](https://doc.dovecot.org/2.4.2/core/plugins/quota.html)
On Dovecot 2.3, merge these settings into the mail node configuration.
```text
mail_plugins = $mail_plugins quota
protocol imap {
mail_plugins = $mail_plugins imap_quota
}
plugin {
quota = count:User quota
quota_vsizes = yes
quota_grace = 0
}
```
Reload Dovecot after updating its configuration. The examples disable the
delivery grace allowance so LMTP and IMAP enforce the assigned limit. To
see the usage and limit of a live mailbox, run
`sudo doveadm quota get -u support@example.net`.
[Dovecot 2.3 quota configuration](https://doc.dovecot.org/2.3/configuration_manual/quota/)
After upgrading a mail node from Dovecot 2.3 to 2.4, reapply a managed mailbox
manifest to republish the lookup table with the new quota setting syntax.
#### Install the mailbox
Start Postfix first to initialize its spool directory, then start Dovecot so
it can bind the LMTP socket. Apply the manifest once both services are running.
```sh
sudo /opt/coulobre/bin/coulobre-mail-node apply coulobre-mailbox-1.json
```
The command creates a private mailbox home under `/srv/coulobre-mail/`,
generates the initial password, and prints the path to the root-only
credentials file on the mail node. Dovecot authenticates the full mailbox
address using a password hash. Postfix accepts listed recipients and
hands delivery to Dovecot over the local LMTP socket. Reapply the same
manifest to resume installation with the same credentials.
### Change a mailbox storage limit
On the account page, select **Change storage limit** next to the mailbox.
Enter the new limit in MiB or leave the field blank for unlimited storage.
This action requires mailbox provisioning and change permissions. For a
mailbox already provisioned through the panel, saving queues an update on
the local mail node. Use **Retry provisioning** to retry a failed update
before setting another limit.
For a mailbox provisioned manually, export its updated manifest and run
the following command on the mail node.
```sh
sudo /opt/coulobre/bin/coulobre-mail-node set-quota coulobre-mailbox-1.json
```
The command changes the quota for the existing mailbox with that address.
Its messages and credentials remain available. If a lower limit is below
current usage, Dovecot enforces the limit on new mail. Reconnect IMAP clients
to pick up the new setting. If the command is interrupted, retry it with
the same manifest.
### Check a mailbox installation
Run the status command on the mail node with the same manifest.
```sh
sudo /opt/coulobre/bin/coulobre-mail-node status coulobre-mailbox-1.json
```
The check reads the local registry, mailbox home and lookup files. It
queries the running Postfix service for the domain and recipient and
tests the saved login against Dovecot's local authentication service.
The JSON report includes the address, state and a diagnostic when the
installation needs attention.
| State | Exit code | Meaning |
| --- | --- | --- |
| `configured` | 0 | The local mailbox and service checks passed. |
| `not_installed` | 2 | The mailbox is absent from the local registry and mail services. |
| `needs_attention` | 2 | An installation, configuration or service check failed. |
Exit code `1` indicates an invalid manifest or an invocation error such as
running the check without root privileges.
### Back up and restore a mailbox
Export the mailbox manifest and run the backup on the node
that hosts the mailbox. Use a new archive name in a root-controlled directory.
```sh
sudo install -d -m 0700 /var/backups/coulobre
sudo /opt/coulobre/bin/coulobre-mail-node backup-mailbox \
coulobre-mailbox-1.json /var/backups/coulobre/mailbox-1.tar.gz
```
Coulobre uses Dovecot to copy the managed mailbox into temporary Maildir
storage before creating the archive. Allow space for that copy on the mail
volume. The archive contains messages, folders, IMAP flags, and subscriptions.
Mailbox passwords and node configuration stay on the node. If Dovecot reports
an incomplete sync, retry when the mailbox is idle.
[Dovecot backup command](https://doc.dovecot.org/2.4.4/core/man/doveadm-backup.1.html)
To recover mail, apply the original mailbox manifest on the destination node.
Use a newly provisioned mailbox that has received no delivery or client
access and has no existing `Maildir`. Keep delivery and client access paused
for that mailbox until recovery completes. Keep Postfix and Dovecot running
for the local configuration checks. Transfer the archive if needed and
ensure it is owned by root with mode `0600`.
```sh
sudo /opt/coulobre/bin/coulobre-mail-node restore-mailbox \
coulobre-mailbox-1.json /var/backups/coulobre/mailbox-1.tar.gz
```
The node checks the address and validates the archive before publishing the
restored Maildir. Sign in with the destination mailbox's credentials.
### Enable local mailbox provisioning
On a mail node with the same Postfix and Dovecot setup, install Coulobre in a
root-owned virtual environment at `/opt/coulobre` and enable the provisioning
socket.
```sh
getent group coulobre-mail-provisioning >/dev/null || sudo groupadd --system coulobre-mail-provisioning
sudo install -m 0644 deploy/systemd/coulobre-mail-apply.socket \
deploy/systemd/coulobre-mail-apply@.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now coulobre-mail-apply.socket
```
Grant the socket group only to the service identity responsible for mailbox
provisioning. Send one version 1 or 2 mailbox manifest as UTF-8 JSON to
`/run/coulobre-mail-apply.sock`, with a limit of 64 KiB. Shut down the writing
half of the connection and read the JSON reply to EOF. For a valid manifest,
the reply identifies the mailbox and reports `configured` or `failed`.
The generated password stays in a root-only credentials file on the mail node.
For an existing mailbox, the same socket accepts a request with
`"operation": "set_quota"` and the updated manifest under `"mailbox"`.
The reply includes both fields.
## Inspect a DirectAdmin backup
Use an account archive from DirectAdmin's Site Backup, Manage User Backups
or Admin Backup/Transfer feature. Coulobre reads plain tar and gzip archives
directly. Install the `zstd` package to read Zstandard archives. Include the
domains directory, database data, email accounts, and email data when taking
the source backup. The server-wide System Backup and CustomBuild database
backup are separate formats.
[DirectAdmin backup guide](https://docs.directadmin.com/directadmin/backup-restore-migration/)
### Import from the panel
Sign in as a server administrator with a verified second factor. Under
**Admin Tools → Import**, upload the archive and run the read-only preflight.
It inventories website files, supported SQL dumps, mailbox messages and
nonempty folders, and DNS records. The review also identifies unsupported
entries. The upload is stored privately on the panel host and the preview
expires after 24 hours.
Select a primary source domain, any additional source domains, a preferred
public or private web root, and the components to restore. If a selected
domain has only one web root, Coulobre uses it. You can restore all supported
components or only what you need. Select a package with enough website
slots when restoring more than one site.
The destination can be a new hosting account or an existing empty account
whose primary domain exactly matches. A document root containing only an
unchanged Coulobre starter page counts as empty. A modified starter page
or any other file blocks the website restore. Existing DNS can be left in
place if you do not select DNS import. New accounts do not include a new
customer login.
Open the destination account after import to attach a customer or manager.
The selected component types apply to supported content across the selected
domains. Additional websites become independent sites on the same hosting
account. Database dumps are restored once per import because the source
account, not an individual domain, owns them. Nested home
archives, source credentials, redirects, aliases, and scheduled tasks
are not restored. Mailboxes and databases use Coulobre credentials.
Set passwords and update applications that still use the old names or
passwords. Mailboxes are activated on the mail node immediately. Imported
DNS is saved without publishing. Review the IPs, nameservers, DNS
records and mail routing before publishing it or changing the registrar.
Watch progress online or return through **Recent imports**. An import is
not an atomic change across all services. If it stops, review component
status and the destination before trying again. An import never changes the
source server. A new copy cannot overwrite an existing website or database.
The compressed archive limit is 1 GiB and the expanded archive limit is
8 GiB or 500,000 entries, whichever is reached first. Reverse proxies in
front of Coulobre need to permit the upload size and time. For larger
archives or custom component mappings, use the staged CLI workflow below.
On slow connections, the panel's Gunicorn request timeout may also limit
the size that can be uploaded. Use the CLI or adjust the web service
timeout for the deployment. Wait for in-progress imports to finish before
upgrading a panel or mail receiver.
The packaged installer and APT upgrade install the dedicated import worker
and the local restore socket. A manually maintained panel needs the
matching `coulobre-directadmin-*` units in `deploy/systemd/` and the
`coulobre-mail-provisioning` system group. Run `systemctl daemon-reload`
and enable/start `coulobre-directadmin-restore.socket` and
`coulobre-directadmin-import-worker.service`. Fresh installations include
the Apache upload limit for this page. On an existing Apache deployment,
copy the updated `deploy/apache/panel-proxy.inc` to
`/etc/coulobre/panel-proxy.inc` and check its configuration with
`apache2ctl configtest` before reloading Apache. A linked Coulobre mail
receiver must be on the matching release and use its scoped apply key.
Apply the matching mail receiver installation or install the
`coulobre-mail-apply@.service.d/zz-directadmin.conf` drop-in before
restoring mailbox data.
### Inspect through the CLI
| Resource | Source in the account archive | Destination |
| --- | --- | --- |
| Account | `backup/user.conf` and the domain inventory | One new hosting account with the selected primary domain |
| Website | `domains/DOMAIN/public_html` or `private_html` | Empty managed document root for the selected domain |
| Database | `backup/USERNAME_SUFFIX.sql` | Empty managed MariaDB database named `coulobre_ACCOUNTID_suffix` |
| Mailbox | `backup/DOMAIN/email/passwd` and a virtual mailbox Maildir | Fresh managed mailbox with the same address |
| DNS | `backup/DOMAIN/DOMAIN.db` | Unpublished primary-domain zone with apex SOA and NS, A, AAAA, MX, TXT, CNAME, SRV, and CAA |
```sh
coulobre-directadmin inspect user.admin.customer.tar.zst
```
The command reads the archive in place and prints a JSON inventory. It
reports the source account and primary domain, discovered domains, website
and mail file counts, DNS zone presence, supported mailbox addresses, and
database dump names. Mailboxes with names outside Coulobre's address format
are counted separately. It records the presence of a nested home archive.
Symbolic links, hard links and other special entries are counted separately
from regular files.
The inventory reads the account, domain and mailbox lists from their
metadata files and checks the rest by archive entry. These metadata files
have an 8 MiB limit per file. Mail and website counts refer to regular
files at recognized paths. The report contains names and counts rather
than passwords, hashes or file contents.
### Plan a DirectAdmin import
On the panel host, use the panel's database settings to preview which
account, mailbox requests and database requests can be created.
```sh
python manage.py plan_directadmin_import user.admin.customer.tar.zst
```
The plan uses the source username as the account name and picks the backup's
primary domain, or its only discovered domain when there is no default.
Use `--primary-domain` to select a different domain from the backup. For
a domainless archive, use it to assign the new account a domain.
The command reads the panel database and reports `blocked` when the chosen
domain is already assigned to a hosting account, DNS zone or mail domain,
or when a domain still needs to be selected. The report lists database
requests using the suffix after the source username and mailbox requests
for the selected domain. `source_data` shows the selected domain's file counts
and DNS zone presence. `manual_review` lists resources that require a
separate restore step and source entries that need manual mapping.
### Import DirectAdmin account metadata
Apply the panel database migrations, then run the import on the panel host
with the backup and the same primary domain selection used for the preview.
```sh
python manage.py import_directadmin user.admin.customer.tar.zst
```
The import checks domain ownership again and creates the new hosting account,
supported database requests and selected domain's mailbox requests in one
transaction. The JSON report includes the new account ID and the MariaDB
names derived from the database requests. Use the CLI to export deployment
manifests for the nodes. The `manual_review` list records the
website, DNS, mail and SQL data to review before completing the separate
restore steps below.
Replaying the same account and request selection reports `already_imported`
for the original account. A domain conflict or a change to the original
account's domain or requests can block the import. A blocked import prints
its report and exits with code `2`.
### Stage DirectAdmin website files
Run the following command with a path for a new directory. The command
publishes the selected site's files under `document-root` inside that
directory after successfully reading the backup.
```sh
coulobre-directadmin stage-website user.admin.customer.tar.zst example.net ./example-net-stage
```
The default source is the domain's `public_html` directory. Use
`--source-root private_html` for a separate HTTPS document root. The
command writes regular files with owner-only permissions and reports
the file count, size and number of skipped links or special entries.
The staging directory is separate from the live web root.
### Restore a DirectAdmin website on a web node
Apply the account's web deployment manifest on the web node, then run
the following command with the same manifest and the original backup.
```sh
sudo /opt/coulobre/bin/coulobre-web-node restore-directadmin coulobre-web-plan-1.json user.admin.customer.tar.zst
```
The command restores the manifest's domain into an empty document root.
It reads and validates the entire backup before placing the files. Use
`--source-root private_html` to restore that source directory instead.
The report includes the file count, size and number of skipped entries.
The hosting account owns the restored files. Apache can read public
files through the `www-data` group. Hidden entries and entries with
private source permissions stay private to the hosting account. The
managed Apache configuration controls the restored site. Any restored
`.htaccess` files are available for review. See the
[Apache AllowOverride reference](https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride).
### Restore DirectAdmin database contents
Provision each database request using its Coulobre manifest. Copy the
same account archive and the manifest to the database node. Pass the
original database name from `database_requests` with its original casing.
```sh
sudo /opt/coulobre/bin/coulobre-database-node restore-directadmin \
coulobre-database-1.json user.admin.customer.tar.zst customer_site
```
The database must be empty. MariaDB reads the selected dump with the new
schema's managed login and client sandbox. Configure website applications
with the new database name and credentials. The account archive format
supplies a per-database logical SQL dump. Use a compatible single-schema
dump for objects that reference the old schema or have an explicit source
definer the managed login cannot use.
If MariaDB rejects the SQL, check the target before retrying. A failed dump
can leave partial data and a pending restore marker. Keep the destination
offline, review the source dump, and retry against an empty managed schema.
The restore refuses populated destinations.
### Restore DirectAdmin mailbox messages
Provision the mailbox on the destination and restore before users connect or
incoming mail reaches it. Run on the mail node with its mailbox manifest and
the same account archive.
```sh
sudo /opt/coulobre/bin/coulobre-mail-node restore-directadmin \
coulobre-mailbox-1.json user.admin.customer.tar.zst
```
The importer supports both `imap/DOMAIN/LOCALPART/Maildir` and
`backup/DOMAIN/email/data/imap/LOCALPART/Maildir`. It restores regular
messages in `cur` and `new`, including Maildir++ folders, and preserves their
timestamps and filename flags. A selected folder or message stored as a link
blocks the restore. Use a backup with regular files or migrate that mailbox
by IMAP. Dovecot rebuilds its indexes. The importer checks the selected
mailbox's quota and publishes only after the archive has been read. Both
an existing Maildir and an ambiguous source layout block publication.
[DirectAdmin's two IMAP backup layouts](https://docs.directadmin.com/changelog/version-1.50.0.html)
### Preview and save a DirectAdmin DNS zone
Use the imported account ID and run the first command without `--apply`.
Review the destination domain, addresses, nameservers, and mail records in
the resulting manifest.
```sh
python manage.py import_directadmin_zone user.admin.customer.tar.zst 1
python manage.py import_directadmin_zone user.admin.customer.tar.zst 1 --apply
```
Coulobre imports A, AAAA, MX, TXT, CNAME, SRV, and CAA with its own TTL and
SOA timers. Record types outside the mapping, such as delegated NS and DNSSEC
records, appear in the preview.
Use `--apply --skip-unsupported` only after deciding how the omitted records
will be served. A differing destination zone blocks the import. An identical
zone can be previewed or reapplied without creating another copy. Adjust
destination IP addresses, nameservers, and mail DNS before publishing from
the panel or updating your DNS provider. Saving the zone leaves deployment
and registrar delegation for the operator.
### Review remaining source data
Create a separate hosting account or model aliases explicitly for additional
web domains. Review mail forwarding, catch-all and vacation settings,
custom IMAP keywords and subscriptions, webmail preferences, scheduled
tasks, manager assignments, FTP users, certificates, source credentials,
and the system mailbox in a nested home archive. Reissue TLS certificates
and rotate access using the provisioned Coulobre credentials. Verify the
website, database rows, mailbox folders, and published zone before cutover.
See [migration sources](migration-sources.md) for the assessment of cPanel
and Plesk account archives.
## Request an Apache configuration preview
Start RabbitMQ and set `COULOBRE_BROKER_URL` to its AMQP URL. The development
default is `amqp://guest:guest@127.0.0.1:5672//`. Use the same database and
broker settings for the panel, worker, and scheduler.
In separate terminals with the virtual environment active, start a worker
and a scheduler. Use one worker process with SQLite.
```sh
celery -A coulobre worker --pool=solo
celery -A coulobre beat
```
Open an account in **Hosting accounts**, select **History**, and choose
**Request Apache preview**.
The preview page shows the request status and the configuration once the worker
finishes. Use **Refresh status** for pending requests or **Web provisioning →
History** to find earlier previews. **Current configurations** lists the last
successfully applied Apache configuration for each primary website. Each
preview request captures the primary domain at queue time.
The preview references the future document root and PHP-FPM socket for the
account. Preview generation makes no changes to the hosting services.
The panel stores requests in its database before the scheduler publishes work
to RabbitMQ. After a broker outage, queued requests resume when the worker and
scheduler reconnect. Plans that remain incomplete five minutes after dispatch
are eligible for delivery again.
## Render configuration on a web node
Export a completed preview for the account's current domain with
`export_manifest apache-preview`. The versioned JSON file contains the account ID and
primary domain. The web node command validates those values and derives the
system user, document root, and PHP-FPM socket from the account ID.
Install the panel package on the node at the same revision as the panel that
created the manifest. The command renders configuration to standard output.
Run it as a regular user in a directory for reviewing the generated files.
```sh
coulobre-web-node render coulobre-web-plan-1.json apache > apache.conf
coulobre-web-node render coulobre-web-plan-1.json php-fpm > php-fpm.conf
```
The command reads the manifest and packaged templates locally.
## Apply a manifest on a web node
Install Apache and PHP-FPM from the distribution packages. Use PHP 8.4 on
Debian 13 and PHP 8.5 on Ubuntu 26.04. Enable FastCGI in Apache and start the
services before applying a manifest. Each site's virtual host connects to its
own FPM socket.
```sh
php_version=8.5 # Use 8.4 on Debian 13.
sudo apt install apache2 "php${php_version}-fpm"
sudo a2enmod proxy_fcgi
sudo systemctl enable --now "php${php_version}-fpm"
sudo systemctl restart apache2
```
Install the matching Coulobre package in a root-owned virtual environment on
the node. Review the completed preview and transfer its deployment manifest
to the node. Apply it with the node operator account.
```sh
sudo /opt/coulobre/bin/coulobre-web-node apply coulobre-web-plan-1.json
```
The command reserves the account ID and domain on the node, creates a system
user and a document root under `/srv/coulobre/web/<account-id>/public`, and
installs Apache and PHP-FPM configuration. It selects the newest stable
installed series for a new site. Pass `--php-version 8.5` to select a
specific installed series at initial activation. It validates both
configurations, reloads PHP-FPM, waits for the per-site socket, then reloads
Apache. Reapplying the manifest preserves the active series.
Reapply the same manifest to retry or verify an existing installation. The
node checks the account registry for domain conflicts and protects existing
configuration files. If a configuration check or reload fails, the command
removes the configuration it added. It reloads the prior configuration for
affected services and reports any recovery errors. The account reservation and
document root stay available for the next attempt.
Check the local deployment state with the same manifest.
```sh
sudo /opt/coulobre/bin/coulobre-web-node status coulobre-web-plan-1.json
```
The JSON report includes the manifest identity and one of three states.
- `configured` means the reservation, Unix account, document root, service
configuration, running services, and PHP-FPM socket match the manifest.
The report includes the active `php_version`.
- `not_installed` means the node has no reservation for the account.
- `needs_attention` includes the first mismatch or service problem found.
The status command reads local state. It exits with code 0 for `configured`,
code 2 for the other report states, and code 1 if it cannot read the manifest
or inspect the node. Use an HTTP request to verify the site's response as well.
Website aliases reuse the activation and HTTPS sockets. The web node stores
alias reservations under `/var/lib/coulobre/web-node/aliases/` and creates
separate Apache virtual hosts that share the primary site's document root and
PHP-FPM socket. Existing website deployment manifests use the primary domain
as their identity.
See [managing aliases in the panel](deployment.md#serve-additional-hostnames-on-a-website).
## Enable HTTPS for a hosted website
Apply the web deployment manifest first. Use Certbot to obtain and renew
the website's Let's Encrypt certificate. The HTTP-01 challenge requires
public DNS for the domain and an inbound connection on port 80. If a
reverse proxy handles that port, forward `/.well-known/acme-challenge/`
for the domain to the web node, preserving the host and path.
[Let's Encrypt challenge types](https://letsencrypt.org/docs/challenge-types/)
Prepare Apache and the shared challenge directory once per web node.
Apache serves challenge files from this directory, which the web node
operator controls.
```sh
sudo apt install certbot
sudo a2enmod ssl
sudo install -d -m 0755 /var/www/coulobre-acme/.well-known/acme-challenge
sudo install -m 0644 deploy/apache/acme.conf.example \
/etc/apache2/conf-available/coulobre-acme.conf
sudo a2enconf coulobre-acme
sudo apache2ctl configtest
sudo systemctl reload apache2
```
Use the manifest's account ID for the Certbot certificate name and its
primary domain for the certificate hostname. Keep Certbot's private key
root-owned with mode `0600`. Apache uses the managed Certbot lineage on
port 443, with the same document root and PHP-FPM pool as the HTTP site.
```sh
sudo certbot certonly --webroot --webroot-path /var/www/coulobre-acme \
--cert-name coulobre-1 --domains example.org
sudo /opt/coulobre/bin/coulobre-web-node enable-https coulobre-web-plan-1.json
sudo /opt/coulobre/bin/coulobre-web-node https-status coulobre-web-plan-1.json
curl --fail https://example.org/
```
`https-status` checks the local virtual host and certificate on disk.
An HTTPS request verifies the certificate and response clients receive.
HTTP remains available for the site and future HTTP-01 challenges.
Install the renewal hook and check the Certbot timer. After a successful
renewal of a Coulobre certificate, the hook validates the Apache
configuration and reloads the service.
```sh
sudo install -D -m 0755 deploy/certbot/reload-apache.sh \
/etc/letsencrypt/renewal-hooks/deploy/coulobre-apache
systemctl status certbot.timer
sudo certbot renew --dry-run --run-deploy-hooks --cert-name coulobre-1
```
For a public domain that cannot accept inbound HTTP on port 80, Certbot
can use a DNS plugin for validation. Request the certificate under the
same lineage name before running `enable-https`.
[Certbot certificate guide](https://eff-certbot.readthedocs.io/en/stable/using.html)
To request and enable HTTPS from the panel, set up the dedicated socket
and worker on the local web node. They use the same Certbot webroot,
lineage name, and renewal hook.
[Panel HTTPS setup](deployment.md#request-https-from-the-panel)
### Enable local web activation
On a web node with the same Apache and PHP-FPM setup, systemd can accept local
activation requests at `/run/coulobre-web-apply.sock`. Install the matching
Coulobre package in a root-owned virtual environment at `/opt/coulobre` before
enabling the socket.
```sh
getent group coulobre-web-provisioning >/dev/null || sudo groupadd --system coulobre-web-provisioning
sudo install -m 0644 deploy/systemd/coulobre-web-apply.socket \
deploy/systemd/coulobre-web-apply@.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now coulobre-web-apply.socket
```
Grant group membership only to the service identity responsible for provisioning
sites. The socket accepts one version 1 site manifest as UTF-8 JSON, up to 4 KiB.
After sending the manifest, shut down the writing half of the connection and
read the JSON reply to EOF. A `configured` reply includes the account ID and
domain. A `failed` reply includes a diagnostic in `problem`. Retry the same
manifest if the connection closes before a reply arrives.
The panel uses `activate_with_runtime` with a deployment manifest under
`site`, the PHP limits under `php_settings`, and an `allowed_versions`
array of PHP series. An empty array allows all installed stable series.
A successful reply includes the `applied_php_version` and
`applied_php_settings`. To change the active pool, send `set_php_version`
with the same `site` and a `php_version` series. Retry the same request
after an interrupted reply to confirm the applied series.
The socket also accepts a storage request with
`"operation": "measure_storage"` and the deployment manifest under `"site"`.
A successful reply includes the request identity and `used_bytes`.
### Measure website storage
Use the deployed site manifest to measure the document root on its web node.
```sh
sudo /opt/coulobre/bin/coulobre-web-node storage-usage coulobre-web-plan-1.json
```
The command reports allocated space in bytes as reported by GNU `du` for the
site's document root. The scan runs as the site user, counts hard-linked
files once, and skips other filesystems. Symbolic links contribute their
own allocated space. The scan measures files as it encounters them, so
the total may change on a busy site. [GNU du manual](https://www.gnu.org/software/coreutils/manual/html_node/du-invocation.html)
With local web activation enabled, an operator with **Can add site storage
usage** can select **Measure website storage** on the hosting account.
Reload the page to see the result and timestamp. The account shows the most
recent successful result even if a later attempt fails. Customers and
managers can see measurements on their assigned accounts.
### Apply a website storage limit
Mount a dedicated ext4 filesystem with user quotas at `/srv/coulobre/web`.
For a new filesystem, the `mke2fs` options `-O quota -E quotatype=usrquota`
create the user quota metadata. Use the `usrquota` mount option. The web node
expects document roots on this volume without nested mounts. Check whether
user quotas are active with
`sudo quotaon -p -u /srv/coulobre/web`.
[ext4 mount options](https://www.kernel.org/doc/html/v7.0/admin-guide/ext4.html)
On the local installation, open a deployed hosting account and select
**Change storage limit** under **Website storage**. An operator with **Can
change site storage limit** can apply the hosting package's default or enter
another value in MiB. Clear the field to remove the space limit. The page
shows the last confirmed limit and any pending update.
On a separate web node, apply a limit using the deployed site manifest.
```sh
sudo /opt/coulobre/bin/coulobre-web-node set-storage-limit \
coulobre-web-plan-1.json --limit-mib 1024
sudo /opt/coulobre/bin/coulobre-web-node storage-limit coulobre-web-plan-1.json
```
Use `--unlimited` with `set-storage-limit` to remove the space limit. Linux
enforces a hard quota on bytes charged to the site's system user anywhere
on that filesystem. A lower limit can block new writes while existing
files are retained. The CLI reports the enforced limit and charged usage.
The panel's website measurement reports allocated space in the document root.
[Linux quota API](https://man7.org/linux/man-pages/man2/quotactl.2.html)
The local web socket accepts the same update as JSON with
`"operation": "set_storage_limit"`, the deployment manifest under `"site"`,
and a positive integer or `null` under `"limit_mib"`.
## Install SFTP keys on a web node
Generate an Ed25519 key on the computer that will connect and choose a
passphrase when prompted. With the default filename,
`~/.ssh/id_ed25519.pub` is the public key file. Keep the private key on
that computer.
```sh
ssh-keygen -t ed25519
```
Enable the OpenSSH configuration on the web node and apply the site's
deployment manifest. Use the public key file to set the account's keys
directly on that node. Running the command with an empty file removes
the configured keys for new connections.
[SFTP deployment setup](deployment.md#set-up-sftp-access-for-hosted-websites)
```sh
sudo /opt/coulobre/bin/coulobre-web-node set-sftp-keys \
coulobre-web-plan-1.json site-access.pub
sftp coulobre-1@web-node.example.org
```
## Back up and restore hosted website files
Apply the site's deployment manifest on the web node. Use that manifest
to create a native website backup in a root-controlled directory.
```sh
sudo install -d -m 0700 /var/backups/coulobre
sudo /opt/coulobre/bin/coulobre-web-node backup-site \
coulobre-web-plan-1.json /var/backups/coulobre/site.tar.gz
```
The root-only archive contains the account and domain identity plus
directories and regular files from the document root. The backup report
counts symbolic links and other non-regular entries as skipped.
Use a new archive filename for each backup. Pause SFTP uploads and
application writes for a consistent copy. The backup detects changes
while reading entries and requires site-owned files with Unix mode
permissions on the document root's filesystem.
To recover one file, select its path relative to the document root.
Its parent directory must already exist. To overwrite an existing
site-owned file at that path, add `--replace`.
```sh
sudo /opt/coulobre/bin/coulobre-web-node restore-site \
coulobre-web-plan-1.json /var/backups/coulobre/site.tar.gz \
--file assets/site.css --replace
```
To restore the entire archive, run the command with an empty document
root for the same account and domain.
```sh
sudo /opt/coulobre/bin/coulobre-web-node restore-site \
coulobre-web-plan-1.json /var/backups/coulobre/site.tar.gz
```
Use a root-owned archive with mode `0600`. The node validates the
entire archive before publishing restored files. Restored files belong
to the site account, with the Apache read access recorded in the
backup. The website can be recovered while its web services are stopped.
## Back up a hosting account
Export the backup manifest with `export_manifest account-backup`. It lists the
website and database resources for the account. Pass `--include-mail` to also
include mailbox requests from every mail domain assigned to the account.
Provision all listed resources before running the
backup. The ZIP contains the native website archive, a compressed SQL dump for
each listed database, and the requested mailbox archives. Back up DNS and panel
settings separately.
On a single-server installation, operators can start a backup of the website
and databases directly from the account page and view its status there. The
panel can also run one daily or weekly backup schedule per account. If mail
is hosted on that server too, enable the **Include mailboxes** option.
See [local account backups](deployment.md#start-local-account-backups-from-the-panel),
[backup schedules](deployment.md#schedule-backups-for-an-account), and
[local mailbox backups](deployment.md#include-mailboxes-on-the-same-server).
If all resources in the manifest are on one server, run the account backup
command there as root. To include mail, pass the manifest downloaded with
mail. Add `--socket PATH` when MariaDB uses a custom socket.
```sh
sudo install -d -m 0700 /var/backups/coulobre
sudo /opt/coulobre/bin/coulobre-account-backup create \
coulobre-account-1-backup.json /var/backups/coulobre/account-1.zip
```
Use a new archive filename. Allow space for the component archives and the
finished ZIP while it is assembled. Maildir snapshots also need space on the
mail volume. The components are captured in sequence. Pause changes to the
listed resources during backup if they need to represent a single point in
time.
### Bundle backups from separate nodes
Use the [website backup command](#back-up-and-restore-hosted-website-files)
on the web node and the [database backup command](#back-up-and-restore-a-managed-database)
on each database node. Transfer the resulting files to a root-controlled
directory with mode `0600` on every archive. Name the primary website archive
`website.tar.gz` and each SQL dump `database-<suffix>.sql.gz`, for example
`database-cms.sql.gz`. When the manifest includes mail, use the
[mailbox backup command](#back-up-and-restore-a-mailbox) on the mail node and
place each archive under `mailboxes/<domain>/<local-part>.tar.gz` within the
component directory. For a version 3 account manifest, use
`websites/s<site_id>.tar.gz` for each entry in `additional_websites`.
Assemble the ZIP with the same account manifest.
```sh
sudo /opt/coulobre/bin/coulobre-account-backup pack \
coulobre-account-1-backup.json /var/backups/coulobre/components \
/var/backups/coulobre/account-1.zip
```
### Recover backups from the bundle
On a single-server installation, operators can restore a website file, an
entire website, a database, or a mailbox from a completed account backup.
See [restoring from the panel](deployment.md#restore-from-local-account-backups-in-the-panel).
Unpack to a new directory on a root-controlled path. The command verifies the
ZIP contents and checks the identity and integrity of each compressed
component before publishing the directory.
```sh
sudo /opt/coulobre/bin/coulobre-account-backup unpack \
/var/backups/coulobre/account-1.zip /var/backups/coulobre/account-1-recovery
```
Use the recovered `website.json` and `website.tar.gz` with `restore-site`.
For an independent website, use its `websites/s<site_id>.json` and
`websites/s<site_id>.tar.gz` pair with the same command.
Use each `database-<suffix>.json` and `database-<suffix>.sql.gz` pair with
`restore-database`. For mail, use the original manifest and archive recovered
as `mailboxes/<domain>/<local-part>.json` and
`mailboxes/<domain>/<local-part>.tar.gz` with `restore-mailbox`.
Transfer the relevant pairs when the destination uses separate nodes. Prepare
an empty document root, empty managed databases, and any newly provisioned
destination mailboxes before restoration. Resume traffic after the components
have been restored. To recover one website file, use the website pair with the
existing `restore-site --file` option. Existing website and database bundles
continue to unpack with the same filenames.
## Run an isolated PHP test site
Export a completed preview for the account's current domain to a new tar file.
```sh
python manage.py export_manifest apache-preview 1 --smoke-bundle coulobre-web-plan-1.tar
```
The archive contains the exact Apache preview, a matching PHP-FPM
pool, site metadata, and a small PHP test page. It is intended for the isolated
Ubuntu check below.
Run the test with Docker from the repository root. Set the bundle path to the
exported tar archive.
```sh
docker build -t coulobre-web-smoke tests/web-node
bundle="$PWD/coulobre-web-plan-1.tar"
docker run --rm --network none \
--mount "type=bind,src=$bundle,dst=/test/site.tar,readonly" \
coulobre-web-smoke
```
The Ubuntu container installs a system user for the site, checks the Apache and
PHP-FPM configurations, and makes an HTTP request with the account's primary
domain. A passing check confirms PHP execution through the generated socket.
The container uses its own filesystem and loopback interface.
## Run the installed panel behind Apache
See [Single-server deployment](deployment.md) for Gunicorn, Apache, and the
systemd services for the panel, worker, and scheduler.
## MariaDB
Create a dedicated MariaDB database and application user. Install the MariaDB or
MySQL client headers, Python headers, a C compiler, and `pkg-config`, then add
the database driver with `python -m pip install -e '.[dev,mariadb]'`.
Set `COULOBRE_DB_NAME`, `COULOBRE_DB_USER`, and `COULOBRE_DB_PASSWORD` for your
database and rerun `python manage.py migrate`. Set `COULOBRE_DB_HOST` and
`COULOBRE_DB_PORT` if the database uses a different address from `127.0.0.1:3306`.
## Checks
Install the `dev` extra and set `COULOBRE_SECRET_KEY` as described above.
Use `ruff check --fix .` to apply safe lint fixes and `ruff format .` to
format Python. Install the `zstd` command to exercise compressed backup
fixtures. Then run the checks from the repository root.
```sh
ruff check .
ruff format --check .
sh -n tests/web-node/smoke.sh
sh -n deploy/certbot/reload-apache.sh
python manage.py check
python manage.py makemigrations --check --dry-run
python manage.py test coulobre
python -m unittest discover -s tests -p test_panel_installer.py
git diff --check
```