Compare commits

..
10 Commits
Author SHA1 Message Date
parkel c0f3f6c4fa Merge pull request 'Prepare Coulobre 0.13.0 release candidate 4' (#186) from release/0.13.0-rc.4 into main
Coulobre Panel CI / Checks (Python 3.12) (push) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (push) Canceled after 0s
Reviewed-on: #186
2026-11-24 13:22:16 +01:00
parkel e0fa131ad8 Prepare Coulobre 0.13.0 release candidate 4
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Canceled after 0s
2026-11-24 13:03:46 +01:00
parkel 9994e27a07 Merge pull request 'Guide customer creation and first-time workspace setup' (#185) from feature/workspace-onboarding into main
Coulobre Panel CI / Checks (Python 3.12) (push) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (push) Canceled after 0s
Reviewed-on: #185
2026-11-24 13:02:50 +01:00
parkel fe2ced25dd Guide first-time setup in each panel workspace
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Canceled after 0s
2026-11-24 13:01:38 +01:00
parkel 16eb16b792 Merge pull request 'Clarify APT package setup and first-run instructions' (#181) from improve/debian-package-onboarding into main
Coulobre Panel CI / Checks (Python 3.12) (push) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (push) Canceled after 0s
Reviewed-on: #181
2026-11-24 12:38:34 +01:00
parkel e658bf5b30 Explain setup choices and database service failures
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Canceled after 0s
2026-11-24 12:15:16 +01:00
parkel 3812e37d5b Document named APT sources for Ubuntu and Debian
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Canceled after 0s
2026-11-24 11:55:11 +01:00
parkel b97036778e Show the next setup command after staging a Debian package 2026-11-24 11:55:11 +01:00
parkel 7d0365e54f Merge pull request 'Prepare Coulobre 0.13.0 release candidate 3' (#179) from release/0.13.0-rc.3 into main
Coulobre Panel CI / Checks (Python 3.12) (push) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (push) Canceled after 0s
Reviewed-on: #179
2026-11-24 11:05:46 +01:00
parkel 5fdc47bf1a Prepare Coulobre 0.13.0 release candidate 3
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Canceled after 0s
2026-11-24 10:58:11 +01:00
26 changed files with 876 additions and 95 deletions

No files matched your search

+1 -1
View File
@@ -208,4 +208,4 @@ python tools/web_update_manifest.py dist/coulobre_panel-0.10.2rc1-py3-none-any.w
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
[apt-installation]: docs/deployment.md#use-the-coulobre-apt-repository
+2
View File
@@ -12,6 +12,8 @@ perform audited support actions on their behalf.
See [Local development](docs/development.md) to run it.
Use the [installer or manual deployment guide](docs/deployment.md) to set up
Apache, MariaDB, and RabbitMQ.
For Ubuntu 26.04 LTS or Debian 13, see the
[Coulobre APT setup](docs/deployment.md#use-the-coulobre-apt-repository).
## Roadmap and releases
+9 -1
View File
@@ -1,7 +1,15 @@
#!/bin/sh
set -eu
if [ "$1" != configure ] || [ ! -e /etc/coulobre/panel.env ]; then
if [ "$1" != configure ]; then
exit 0
fi
if [ ! -e /etc/coulobre/panel.env ]; then
printf '%s\n' \
'The Coulobre installer is ready. After APT exits, start setup with the command below.' \
' sudo coulobre-install --interactive' \
'Run coulobre-install --help for config-file and web setup.'
exit 0
fi
+8
View File
@@ -31,3 +31,11 @@ mode = "off"
# ssh_identity. ssh_identity is a root-owned 0600 file on the panel host.
# For remote mail installation, set mail_hostname to the public service
# hostname. Provide tls = "acme" or certificate and key paths on that host.
[hosting]
# Addresses clients use for hosted websites. Used in default A and AAAA records.
# public_addresses = ["192.0.2.21", "2001:db8::21"]
# Authoritative nameservers for new NS records. Set delegation at the registrar.
# nameservers = ["ns1.example.net", "ns2.example.net"]
# Public outbound SMTP addresses, including the NAT address if used. Used for SPF.
# mail_sending_addresses = ["192.0.2.25"]
+46 -15
View File
@@ -6,6 +6,7 @@ from getpass import getpass
from pathlib import Path
from tempfile import TemporaryDirectory
from . import guidance
from .config import (
REMOTE_MODES,
InstallError,
@@ -18,7 +19,9 @@ from .config import (
from .engine import Installer
def prompt(label, default=""):
def prompt(label, default="", *, hint=""):
if hint:
print(f" {hint}", flush=True)
value = input(f"{label}{f' [{default}]' if default else ''}: ").strip()
return value or default
@@ -37,7 +40,9 @@ def comma_separated(values):
def interactive_plan(previous=None):
if previous is None:
preset = prompt(
"Installation profile (full-service or custom)", "full-service"
"Installation profile (full-service or custom)",
"full-service",
hint=guidance.PROFILE,
)
if preset not in {"full-service", "custom"}:
raise InstallError("Choose full-service or custom.")
@@ -46,18 +51,25 @@ def interactive_plan(previous=None):
preset = "custom"
defaults = export_parameters(previous, None)
def ask(label, section, name, fallback=""):
def ask(label, section, name, fallback="", *, hint=""):
return prompt(
label, str(defaults.get(section, {}).get(name, fallback))
label,
str(defaults.get(section, {}).get(name, fallback)),
hint=hint,
)
full_service = preset == "full-service"
panel = {"hostname": ask("Panel hostname", "panel", "hostname")}
panel = {
"hostname": ask(
"Panel hostname", "panel", "hostname", hint=guidance.PANEL_HOSTNAME
)
}
access = panel["access"] = ask(
"Panel access (tls, acme, or proxy)",
"panel",
"access",
"acme" if full_service else "tls",
hint=guidance.PANEL_ACCESS,
)
if access == "tls":
panel["certificate"] = ask(
@@ -66,9 +78,17 @@ def interactive_plan(previous=None):
panel["key"] = ask("Panel private key path", "panel", "key")
elif access == "proxy":
panel["origin_ip"] = ask(
"Private origin address", "panel", "origin_ip"
"Private origin address",
"panel",
"origin_ip",
hint=guidance.ORIGIN_ADDRESS,
)
panel["proxy_ip"] = ask(
"Trusted proxy address",
"panel",
"proxy_ip",
hint=guidance.PROXY_ADDRESS,
)
panel["proxy_ip"] = ask("Trusted proxy address", "panel", "proxy_ip")
panel["origin_port"] = number(
ask("Origin port", "panel", "origin_port", "8080"), "the origin"
)
@@ -78,7 +98,12 @@ def interactive_plan(previous=None):
"username": ask(
"Administrator username", "admin", "username", "operator"
),
"email": ask("Administrator email", "admin", "email"),
"email": ask(
"Administrator email",
"admin",
"email",
hint=guidance.ADMIN_EMAIL,
),
},
}
for name in ("dns", "mail"):
@@ -87,6 +112,7 @@ def interactive_plan(previous=None):
name,
"mode",
"local" if full_service else "off",
hint=guidance.DNS_ROLE if name == "dns" else guidance.MAIL_ROLE,
)
target = data[name] = {"mode": mode}
if mode in REMOTE_MODES:
@@ -97,14 +123,20 @@ def interactive_plan(previous=None):
ask("SSH port", name, "port", "22"), f"the {name} node"
)
target["host_key"] = ask(
"Verified SSH host public key file", name, "host_key"
"Verified SSH host public key file",
name,
"host_key",
hint=guidance.SSH_HOST_KEY,
)
if mode == "remote-install":
target["ssh_user"] = ask(
"SSH administrator username", name, "ssh_user"
)
target["ssh_identity"] = ask(
"SSH administrator private key file", name, "ssh_identity"
"SSH administrator private key file",
name,
"ssh_identity",
hint=guidance.SSH_IDENTITY,
)
if name == "mail" and mode in {"local", "remote-install"}:
field = "host" if mode == "local" else "mail_hostname"
@@ -113,12 +145,14 @@ def interactive_plan(previous=None):
name,
field,
panel["hostname"] if mode == "local" else "",
hint=guidance.MAIL_HOSTNAME,
)
target["tls"] = ask(
"Mail TLS (provided or acme)",
name,
"tls",
"acme" if access == "acme" and mode == "local" else "provided",
hint=guidance.MAIL_TLS,
)
if target["tls"] == "provided":
target["certificate"] = ask(
@@ -128,11 +162,7 @@ def interactive_plan(previous=None):
"Private key path on the mail host", name, "key"
)
hosting = data["hosting"] = {}
for name, label in (
("public_addresses", "IP addresses for hosted websites"),
("nameservers", "Nameservers for new DNS zones"),
("mail_sending_addresses", "Public sending IPs for hosted email"),
):
for name, label, hint in guidance.HOSTING_FIELDS:
if name == "nameservers" and data["dns"]["mode"] == "off":
continue
if name == "mail_sending_addresses" and data["mail"]["mode"] not in {
@@ -144,6 +174,7 @@ def interactive_plan(previous=None):
value = prompt(
f"{label} (comma-separated, or none)",
", ".join(previous_values) or "none",
hint=hint,
)
hosting[name] = [] if value == "none" else comma_separated(value)
return parse_plan(data)
+9 -2
View File
@@ -485,8 +485,15 @@ class Installer:
("RabbitMQ", "rabbitmq-server.service"),
):
with self.step(f"Starting {name} on loopback"):
systemctl("enable", "--now", unit)
systemctl("restart", unit)
try:
systemctl("enable", "--now", unit)
systemctl("restart", unit)
except InstallError:
self.progress(
f"Read the {name} service log with "
f"sudo journalctl -b -u {unit} -n 60 --no-pager"
)
raise
def mariadb(sql):
return run(
+68
View File
@@ -0,0 +1,68 @@
"""Help text shared by the interactive installer and browser wizard."""
PROFILE = (
"Full-service preselects local DNS and mail with Let's Encrypt. "
"Custom starts with DNS and mail off."
)
PANEL_HOSTNAME = (
"The full DNS name administrators and customers use to sign in."
)
PANEL_ACCESS = (
"Use acme for Let's Encrypt, tls for an existing certificate on this "
"server, or proxy when a trusted reverse proxy handles HTTPS."
)
ORIGIN_ADDRESS = (
"The private address on this server that the proxy connects to."
)
PROXY_ADDRESS = "The source IP of the trusted proxy as seen by this server."
ADMIN_EMAIL = (
"Use an inbox you can open now. Coulobre uses this address for notices "
"and Let's Encrypt registration when enabled."
)
DNS_ROLE = (
"Use local to serve zones here, or off to manage DNS elsewhere. "
"Use remote for an existing Coulobre DNS node or remote-install to "
"set one up over SSH."
)
MAIL_ROLE = (
"Use local to host mail here, or off to use a separate mail provider. "
"Use remote for an existing Coulobre mail node or remote-install to "
"set one up over SSH."
)
MAIL_HOSTNAME = (
"The public name mail clients and other mail servers use to reach "
"this mail service."
)
MAIL_TLS = (
"Use acme for Let's Encrypt or provided for certificate and key files "
"already available on the mail server."
)
SSH_HOST_KEY = "A file with the verified public host key of the remote server."
SSH_IDENTITY = (
"The private key file on this panel server used to sign in as the "
"SSH administrator."
)
HOSTING_FIELDS = (
(
"public_addresses",
"IP addresses for hosted websites",
"Public IPv4 or IPv6 addresses used in default A and AAAA records. "
"Use the addresses visitors connect to, or leave unset to add them "
"later.",
),
(
"nameservers",
"Nameservers for new DNS zones",
"Authoritative nameserver hostnames, such as ns1.example.net. "
"Coulobre uses them in new NS records. Set public delegation "
"separately at the registrar, or leave unset to configure later.",
),
(
"mail_sending_addresses",
"Public sending IPs for hosted email",
"The public outbound SMTP addresses, including the NAT address "
"if used. Coulobre uses them to prepare SPF and managed mail DNS. "
"Leave unset to configure those records separately.",
),
)
+58 -18
View File
@@ -9,6 +9,7 @@ from http.server import BaseHTTPRequestHandler, HTTPServer
from threading import Thread
from urllib.parse import parse_qs
from . import guidance
from .cli import comma_separated, number
from .config import REMOTE_MODES, InstallError, parse_plan, port
from .engine import SOURCE, Installer
@@ -21,28 +22,34 @@ FORM = """<form method="post" action="/review">
websites, databases, DNS and mail run locally. Adjust the settings below
for a different deployment.</p>
<fieldset><legend>Panel</legend>
<label>Hostname<input name="hostname" autocomplete="off" required></label>
<label>Access<select name="access">
<label>Hostname<input name="hostname" aria-describedby="hostname-hint"
autocomplete="off" required></label>
{hostname_hint}
<label>Access<select name="access" aria-describedby="access-hint">
<option value="acme">HTTPS with Let's Encrypt</option>
<option value="tls">HTTPS on this server</option>
<option value="tls">HTTPS with an existing certificate</option>
<option value="proxy">Trusted external HTTPS proxy</option></select></label>
{access_hint}
<label>Panel certificate path<input name="certificate"></label>
<label>Panel private key path<input name="key"></label>
<label>Private origin address<input name="origin_ip"></label>
<label>Trusted proxy address<input name="proxy_ip"></label>
<label>Private origin address
<input name="origin_ip" aria-describedby="origin_ip-hint"></label>
{origin_hint}
<label>Trusted proxy address
<input name="proxy_ip" aria-describedby="proxy_ip-hint"></label>
{proxy_hint}
<label>Origin port<input name="origin_port" type="number" value="8080"></label>
</fieldset>
<fieldset><legend>Administrator</legend>
<label>Username<input name="username" value="operator" required></label>
<label>Email<input name="email" type="email" required></label>
<label>Email<input name="email" type="email" aria-describedby="email-hint"
required></label>
{email_hint}
</fieldset>
{dns}{mail}
<fieldset><legend>New hosting accounts</legend>
<p>Separate multiple values with commas. You can also set these later.</p>
<label>IP addresses for hosted websites<input name="public_addresses"></label>
<label>Nameservers for new DNS zones<input name="nameservers"></label>
<label>Public sending IPs for hosted email
<input name="mail_sending_addresses"></label>
<p>Separate multiple values with commas.</p>
{hosting}
</fieldset>
<button type="submit">Review installation</button></form>"""
STYLE = """:root{color-scheme:light}
@@ -51,6 +58,8 @@ h1 img{width:1.9rem;height:1.9rem;flex:none}
body{font:1rem system-ui,sans-serif;max-width:46rem;margin:auto;
padding:1rem;color:#14372e} fieldset{margin:1rem 0;border:1px solid #a9beb2;
border-radius:.4rem;padding:1rem} label{display:block;margin-bottom:.75rem}
label:has(+.field-hint){margin-bottom:.25rem}
.field-hint{display:block;margin-bottom:.75rem;color:#3f5c52}
input,select{display:block;box-sizing:border-box;width:100%;padding:.45rem;
margin-top:.25rem} button{background:#195a46;color:white;border:0;
border-radius:.3rem;padding:.75rem 1.1rem;font:inherit} summary{cursor:pointer}
@@ -58,15 +67,26 @@ border-radius:.3rem;padding:.75rem 1.1rem;font:inherit} summary{cursor:pointer}
[role=alert]{color:#8c2828}"""
def field_hint(name, message):
return (
f'<small class="field-hint" id="{name}-hint">{escape(message)}</small>'
)
def role_form(name):
title = name.upper() if name == "dns" else "Mail"
local = (
"<label>Public mail hostname"
'<input name="mail_local_host"></label>'
'<label>Mail TLS<select name="mail_tls">'
'<input name="mail_local_host" '
'aria-describedby="mail_local_host-hint">'
"</label>"
f"{field_hint('mail_local_host', guidance.MAIL_HOSTNAME)}"
'<label>Mail TLS<select name="mail_tls" '
'aria-describedby="mail_tls-hint">'
'<option value="acme">Let&#39;s Encrypt</option>'
'<option value="provided">Existing certificate</option>'
"</select></label>"
f"{field_hint('mail_tls', guidance.MAIL_TLS)}"
"<label>Certificate path on the mail host"
'<input name="mail_certificate"></label>'
"<label>Private key path on the mail host"
@@ -74,22 +94,28 @@ def role_form(name):
if name == "mail"
else ""
)
role_hint = guidance.DNS_ROLE if name == "dns" else guidance.MAIL_ROLE
return f"""<fieldset><legend>{title}</legend>
<label>Role<select name="{name}_mode">
<label>Role<select name="{name}_mode" aria-describedby="{name}_mode-hint">
<option value="local">Local service</option>
<option value="off">Disabled</option>
<option value="remote">Connect an existing Coulobre node</option>
<option value="remote-install">Install and connect a Coulobre node</option>
</select></label>
{field_hint(f"{name}_mode", role_hint)}
{local}
<details><summary>Separate node settings</summary>
<label>SSH hostname or address<input name="{name}_host"></label>
<label>SSH port<input name="{name}_port" type="number" value="22"></label>
<label>Verified SSH host public key file<input name="{name}_host_key"></label>
<label>Verified SSH host public key file
<input name="{name}_host_key" aria-describedby="{name}_host_key-hint"></label>
{field_hint(f"{name}_host_key", guidance.SSH_HOST_KEY)}
<label>SSH administrator username for installation
<input name="{name}_ssh_user"></label>
<label>SSH administrator key file for installation
<input name="{name}_ssh_identity"></label>
<input name="{name}_ssh_identity" aria-describedby="{name}_ssh_identity-hint">
</label>
{field_hint(f"{name}_ssh_identity", guidance.SSH_IDENTITY)}
</details></fieldset>"""
@@ -155,7 +181,21 @@ def form_plan(fields):
def installation_form(values):
html = FORM.format(dns=role_form("dns"), mail=role_form("mail"))
hosting = "".join(
f'<label>{label}<input name="{name}" aria-describedby="{name}-hint">'
f"</label>{field_hint(name, hint)}"
for name, label, hint in guidance.HOSTING_FIELDS
)
html = FORM.format(
dns=role_form("dns"),
mail=role_form("mail"),
hosting=hosting,
hostname_hint=field_hint("hostname", guidance.PANEL_HOSTNAME),
access_hint=field_hint("access", guidance.PANEL_ACCESS),
origin_hint=field_hint("origin_ip", guidance.ORIGIN_ADDRESS),
proxy_hint=field_hint("proxy_ip", guidance.PROXY_ADDRESS),
email_hint=field_hint("email", guidance.ADMIN_EMAIL),
)
def restore_field(match):
tag = match[0]
@@ -171,7 +211,7 @@ def installation_form(values):
return re.sub(
r'<input name="(?P<input>[a-z_]+)"[^>]*>|'
r'<select name="(?P<select>[a-z_]+)">.*?</select>',
r'<select name="(?P<select>[a-z_]+)"[^>]*>.*?</select>',
restore_field,
html,
flags=re.DOTALL,
+76 -24
View File
@@ -55,6 +55,12 @@ sudo ./deploy/install-panel.py --interactive
Review the hostname, network mode, administrator, and mail and DNS
choices before confirming. Enter the password in the terminal or use
`--admin-password-file` to read it from a root-owned `0600` file.
For hosted website DNS, enter the public IPv4 or IPv6 addresses that clients
use to reach hosted sites. Choosing `none` leaves the default A and AAAA
records unset until you configure hosting addresses.
For Coulobre-managed DNS, enter the hostnames of the authoritative
nameservers that will serve new zones. For a public domain, set the delegation
at its registrar as well.
### Automated command line
@@ -138,31 +144,67 @@ sudo coulobre-install --interactive
```
On a fresh server the package stages the release wheel, installer, and remote
installation service. Run `coulobre-install` after APT exits. It accepts the
same `--interactive`, `--config`, and `--web` options as the source installer
and installs the selected operating system services and Python dependencies.
installation service. APT prints the setup command when the package is ready.
Run `coulobre-install` after APT exits. It accepts the same `--interactive`,
`--config`, and `--web` options as the source installer and installs the
selected operating system services and Python dependencies.
### Use the Gitea APT repository
### Use the Coulobre APT repository
Use the `resolute` suite on Ubuntu 26.04 or `trixie` on Debian 13. The `main`
component carries final releases. Use `candidate` on a test host to opt in to
release candidates. A version like `0.13.0~rc1` sorts before `0.13.0` in APT.
Install the repository signing key, then use the source entry for your OS.
If you previously added a Coulobre entry to `gitea.list` or
`hippogrief.list`, remove that entry before enabling `coulobre.sources`.
```sh
suite=resolute
component=main
registry=https://code.hosting.hippogrief.nl/api/packages/hippogrief/debian
sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsS "$registry/repository.key" -o /etc/apt/keyrings/hippogrief.asc
sudo chmod 0644 /etc/apt/keyrings/hippogrief.asc
printf 'deb [signed-by=/etc/apt/keyrings/hippogrief.asc] %s %s %s\n' \
"$registry" "$suite" "$component" | sudo tee /etc/apt/sources.list.d/hippogrief.list
sudo apt update
sudo apt install coulobre-panel
sudo curl -fsS https://code.hosting.hippogrief.nl/api/packages/hippogrief/debian/repository.key \
-o /etc/apt/keyrings/coulobre.asc
sudo chmod 0644 /etc/apt/keyrings/coulobre.asc
```
Set `component=candidate` when testing a release candidate. Gitea adds the
`main` component to each suite when its first final package is published.
#### Ubuntu 26.04 LTS
```sh
sudo tee /etc/apt/sources.list.d/coulobre.sources >/dev/null <<'EOF'
Types: deb
URIs: https://code.hosting.hippogrief.nl/api/packages/hippogrief/debian
Suites: resolute
Components: main
Architectures: all
Signed-By: /etc/apt/keyrings/coulobre.asc
EOF
```
#### Debian 13
```sh
sudo tee /etc/apt/sources.list.d/coulobre.sources >/dev/null <<'EOF'
Types: deb
URIs: https://code.hosting.hippogrief.nl/api/packages/hippogrief/debian
Suites: trixie
Components: main
Architectures: all
Signed-By: /etc/apt/keyrings/coulobre.asc
EOF
```
#### Install the package
The `main` component becomes available when the first final package is
published. For release candidates, run the following command before updating
APT. A candidate such as `0.13.0~rc1` sorts before `0.13.0`.
```sh
sudo sed -i 's/^Components: main$/Components: candidate/' /etc/apt/sources.list.d/coulobre.sources
```
Install the package and start the installer on a fresh server.
```sh
sudo apt update
sudo apt install coulobre-panel
sudo coulobre-install --interactive
```
[Gitea Debian registry documentation](https://docs.gitea.com/usage/packages/debian/)
@@ -2708,12 +2750,22 @@ changes to manager policy and account assignments made through the panel.
### Onboard customers
Managers can open **Add User** to create a customer login and its first
hosting account together. Choose an allowed hosting package and give the
customer's email address to send a welcome email with a link to set their
password. Preview the email before creating the account. To add a login
for an existing unassigned hosting account, open the account and choose
**Add customer login** or **Link existing customer**.
Operators and managers can open **Add User** to create a customer login and
its first hosting account together. Choose a hosting package and enter the
customer's email address to send a welcome email with a password setup link.
Use **Preview** to review the email before creating the account. Operators
can assign a manager during setup or use **Create a login only** to stage
access separately. Managers choose from their assigned hosting packages.
To add a login for an existing unassigned hosting account, open the account
and choose **Add customer login** or **Link existing customer**.
**Getting started** on the hosting overview shows setup steps for the active
workspace. Dismiss or reopen the checklist independently in each workspace.
Operators and managers can use **Enable Customer workspace** to access their
own hosting through the same login. A server administrator verifies their
second factor before enabling the role. An operator can also select **For my
own hosting** when adding a hosting account. Coulobre uses the operator's
manager profile by default.
Operators can open **Contact and invitation** from **Show All Users** to
review the welcome email and send a fresh password setup link to a pending
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "coulobre-panel"
version = "0.13.0rc2"
version = "0.13.0rc4"
description = "A web hosting control panel for hosting providers and resellers."
readme = "README.md"
requires-python = ">=3.12"
+85 -17
View File
@@ -46,7 +46,7 @@ from .reseller_accounts import (
from .resource_requests import lock_hosting_account, require_open_account
class ManagerOnboardingForm(InviteLoginForm):
class CustomerOnboardingForm(InviteLoginForm):
primary_domain = HostingAccount._meta.get_field(
"primary_domain"
).formfield(required=True)
@@ -77,14 +77,36 @@ class ManagerOnboardingForm(InviteLoginForm):
help_text="Leave blank to use a password setup link.",
)
def __init__(self, *args, manager, defaults, **kwargs):
def __init__(
self,
*args,
manager,
defaults,
capabilities,
may_assign_manager,
**kwargs,
):
super().__init__(*args, **kwargs)
self.fields["plan"].queryset = manager.hosting_plans.order_by("name")
self.fields["manage_dns"].disabled = not default_dns_zones_allowed(
defaults
plans = manager.hosting_plans if manager else HostingPlan.objects
self.fields["plan"].queryset = plans.order_by("name")
if may_assign_manager:
self.fields["manager"] = forms.ModelChoiceField(
queryset=Reseller.objects.filter(user__is_active=True)
.select_related("user")
.order_by("user__username"),
required=False,
empty_label="Direct customer",
help_text="Give this manager access to the new account.",
)
self.order_fields(
["username", "email", "primary_domain", "plan", "manager"]
)
self.fields["manage_dns"].disabled = not (
capabilities["manage_dns"] and default_dns_zones_allowed(defaults)
)
self.fields["manage_mail"].disabled = not panel_feature_allowed(
"LOCAL_MAILBOX_PROVISIONING"
self.fields["manage_mail"].disabled = not (
capabilities["manage_mail"]
and panel_feature_allowed("LOCAL_MAILBOX_PROVISIONING")
)
def clean_primary_domain(self):
@@ -118,8 +140,8 @@ class ManagerOnboardingForm(InviteLoginForm):
@method_decorator(
sensitive_post_parameters("initial_password"), name="dispatch"
)
class ManagerOnboardingView(UserPassesTestMixin, FormView):
form_class = ManagerOnboardingForm
class CustomerOnboardingView(UserPassesTestMixin, FormView):
form_class = CustomerOnboardingForm
template_name = "hosting/workspace_form.html"
extra_context = {
"title": "Add user",
@@ -129,12 +151,38 @@ class ManagerOnboardingView(UserPassesTestMixin, FormView):
def test_func(self):
self.manager = reseller_for_user(self.request.user)
return self.manager is not None
return self.manager is not None or can_onboard_customer(
self.request.user
)
def get_context_data(self, **kwargs):
return super().get_context_data(
login_only_url=reverse_lazy("panel:customer_create")
if self.manager is None
else None,
**kwargs,
)
def capabilities(self):
from .views import ACTIVATE_WEB, PROVISION_MAILBOX, PUBLISH_DNS
actor = self.request.user
return {
key: self.manager is not None or actor.has_perms(required)
for key, required in (
("website", ACTIVATE_WEB),
("manage_dns", (*PUBLISH_DNS, "hosting.add_hostingdnszone")),
("manage_mail", PROVISION_MAILBOX),
)
}
def get_form_kwargs(self):
return super().get_form_kwargs() | {
"manager": self.manager,
"defaults": zone_defaults(),
"capabilities": self.capabilities(),
"may_assign_manager": self.manager is None
and self.request.user.has_perm("hosting.view_reseller"),
}
def form_valid(self, form):
@@ -156,21 +204,27 @@ class ManagerOnboardingView(UserPassesTestMixin, FormView):
self.get_context_data(form=form, welcome_preview=preview)
)
try:
capabilities = self.capabilities()
manager = self.manager or data.get("manager")
with transaction.atomic():
user = form.save(commit=False)
if data["initial_password"]:
user.set_password(data["initial_password"])
user.save()
customer = Customer.objects.create(
user=user, reseller=self.manager
)
customer = Customer.objects.create(user=user, reseller=manager)
account = HostingAccount(
name=user.get_username(),
primary_domain=data["primary_domain"],
customer=customer,
hosting_plan=data["plan"],
reseller=manager,
)
create_reseller_account(self.manager, account)
if self.manager is not None:
create_reseller_account(self.manager, account)
else:
save_operator_account(
account, self.request.user.get_username()
)
DomainServicePolicy.objects.create(
account=account,
domain=account.primary_domain,
@@ -181,9 +235,8 @@ class ManagerOnboardingView(UserPassesTestMixin, FormView):
setup_new_account(
account,
{
"setup_website": panel_feature_allowed(
"LOCAL_WEB_ACTIVATION"
),
"setup_website": capabilities["website"]
and panel_feature_allowed("LOCAL_WEB_ACTIVATION"),
"setup_dns": data["manage_dns"],
"setup_email": data["manage_mail"],
"setup_www": defaults.include_www,
@@ -215,6 +268,18 @@ class ManagerOnboardingView(UserPassesTestMixin, FormView):
return redirect(account)
def can_onboard_customer(user):
return user.has_perms(
(
"hosting.view_customer",
"hosting.add_customer",
"hosting.view_hostingaccount",
"hosting.add_hostingaccount",
"hosting.view_hostingplan",
)
)
class ManagerPackagesView(UserPassesTestMixin, ListView):
template_name = "hosting/manager_packages.html"
context_object_name = "plans"
@@ -265,6 +330,9 @@ class AllUsersView(OperatorOnlyMixin, PermissionRequiredMixin, ListView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["has_combined_onboarding"] = can_onboard_customer(
self.request.user
)
profiles = [
getattr(user, "hosting_customer", None)
for user in context["logins"]
@@ -0,0 +1,45 @@
# Generated by Django 5.2.19 on 2026-11-24 11:58
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hosting", "0078_manager_labels"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="OnboardingDismissal",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("role", models.CharField(max_length=16)),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"constraints": [
models.UniqueConstraint(
fields=("user", "role"),
name="hosting_onboarding_dismissal",
)
],
},
),
]
+14
View File
@@ -1540,6 +1540,20 @@ class PanelFactorEnrollment(models.Model):
expires_at = models.DateTimeField(db_index=True)
class OnboardingDismissal(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL, on_delete=models.CASCADE
)
role = models.CharField(max_length=16)
class Meta:
constraints = [
models.UniqueConstraint(
fields=("user", "role"), name="hosting_onboarding_dismissal"
)
]
class PanelRecoveryCode(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL, on_delete=models.CASCADE
+9 -2
View File
@@ -38,11 +38,18 @@ def assigned_roles(user):
roles = {}
if user.is_superuser:
roles[PanelRole.ADMIN] = user.pk
manager = getattr(user, "hosting_reseller", None)
customer = getattr(user, "hosting_customer", None)
own_customer = (
customer is not None
and manager is not None
and customer.reseller_id == manager.pk
)
if manager is not None and own_customer:
roles[PanelRole.MANAGER] = manager.pk
if customer is not None:
roles[PanelRole.CUSTOMER] = customer.pk
manager = getattr(user, "hosting_reseller", None)
if manager is not None:
if manager is not None and not own_customer:
roles[PanelRole.MANAGER] = manager.pk
return roles
@@ -4,7 +4,7 @@
<header class="page-heading">
<div>
<h1>{% if is_customer %}My hosting{% elif is_reseller %}Customer hosting{% else %}Hosting accounts{% endif %}</h1>
{% if is_operator %}<p class="heading-meta">Manage domains and their hosting services. Link a customer to give them access.</p>{% endif %}
{% if is_operator %}<p class="heading-meta">Manage domains and their hosting services. A linked customer login can manage them in the panel.</p>{% endif %}
<p class="heading-meta">{{ paginator.count }} account{{ paginator.count|pluralize }}{% if search %} matching your search{% endif %}</p>
{% if account_allowance %}<p class="heading-meta">{{ account_allowance.used }} of {{ account_allowance.limit }} accounts allocated</p>{% endif %}
</div>
@@ -27,6 +27,7 @@
</div>
{% endblock %}
{% block page_content %}
{% include "hosting/workspace_onboarding.html" %}
{% if is_reseller %}
<section class="surface section-heading" aria-label="Customer access">
<p>Manage the logins for your assigned customers.</p>
@@ -2,7 +2,9 @@
{% block title %}All users · Coulobre Panel{% endblock %}
{% block page_title %}All users{% endblock %}
{% block page_actions %}
{% if perms.hosting.add_customer %}
{% if has_combined_onboarding %}
<a class="button primary" href="{% url 'panel:customer_onboarding' %}">Add user</a>
{% elif perms.hosting.add_customer %}
<a class="button primary" href="{% url 'panel:customer_create' %}">Add user</a>
{% endif %}
{% endblock %}
@@ -24,7 +26,7 @@
<tr>
<th scope="row">{{ login.get_username }}</th>
<td>{% if login.is_superuser %}Operator{% elif login.hosting_reseller %}Manager{% else %}Customer{% endif %}</td>
<td>{{ login.hosting_customer.reseller|default:"Unassigned" }}</td>
<td>{% if login.hosting_customer %}{{ login.hosting_customer.reseller|default_if_none:"Unassigned" }}{% else %}<span class="muted" aria-label="No customer profile">—</span>{% endif %}</td>
<td>{{ login.account_count }}</td>
{% include "hosting/account_metrics_cells.html" %}
<td>{{ login.date_joined|date:"j M Y" }}</td>
@@ -2,6 +2,9 @@
{% block title %}{{ title }} · Coulobre Panel{% endblock %}
{% block page_title %}{{ title }}{% endblock %}
{% block page_content %}
{% if login_only_url %}
<p class="heading-meta">Create a panel login and set up the customer’s first domain on a hosting package. <a href="{{ login_only_url }}">Create a login only</a></p>
{% endif %}
<div class="surface editor-surface">
<form method="post" class="editor">
{% csrf_token %}
@@ -0,0 +1,34 @@
{% if onboarding.dismissed %}
<form method="post" action="{% url 'panel:onboarding_preference' %}" class="form-actions">
{% csrf_token %}
<button class="button secondary" name="action" value="show">Getting started</button>
</form>
{% elif onboarding.steps or onboarding.enable_customer %}
<section class="surface" aria-labelledby="onboarding-heading">
<header class="section-heading">
<h2 id="onboarding-heading">{{ onboarding.title }}</h2>
<form method="post" action="{% url 'panel:onboarding_preference' %}">
{% csrf_token %}
<button class="button secondary" name="action" value="dismiss">Dismiss checklist</button>
</form>
</header>
<ul>
{% for label, url, complete in onboarding.steps %}
<li>
{% if complete %}<span class="muted">Done · </span>{% endif %}
{% if url %}<a href="{{ url }}">{{ label }}</a>{% else %}{{ label }}{% endif %}
{% if not url and not complete %}
<span class="muted">{% if onboarding.role == "manager" %} · Ask your operator for an assigned package and available account allocation.{% else %} · Ask your hosting provider to link your hosting account.{% endif %}</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% if onboarding.enable_customer %}
<form method="post" action="{% url 'panel:enable_customer_workspace' %}" class="form-actions">
{% csrf_token %}
<button class="button secondary" type="submit">Enable Customer workspace</button>
<span class="muted">Use this login to manage your own hosting.</span>
</form>
{% endif %}
</section>
{% endif %}
@@ -143,6 +143,10 @@ class OperatorOwnHostingTests(TestCase):
account = HostingAccount.objects.get(primary_domain=domain)
self.assertRedirects(response, account.get_absolute_url())
self.assertEqual(account.customer.user_id, self.operator.pk)
self.assertEqual(
account.customer.reseller.user_id, self.operator.pk
)
self.assertEqual(account.reseller_id, account.customer.reseller_id)
self.assertEqual(
Customer.objects.filter(user=self.operator).count(), 1
)
+116 -3
View File
@@ -5,6 +5,7 @@ from django.contrib.auth.models import Permission
from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils import timezone
from django_otp.plugins.otp_totp.models import TOTPDevice
from .models import (
Customer,
@@ -17,6 +18,120 @@ from .models import (
class WorkspaceTests(TestCase):
def test_operator_creates_and_links_the_first_hosting_account(self):
users = get_user_model().objects
operator = users.create_superuser("operator")
manager = Reseller.objects.create(user=users.create_user("manager"))
plan = HostingPlan.objects.create(name="Shared")
self.client.force_login(operator)
url = reverse("panel:customer_onboarding")
self.assertContains(self.client.get(url), "Create a login only")
data = {
"username": "new-customer",
"email": "customer@example.test",
"primary_domain": "first.example.test",
"plan": plan.pk,
"manager": manager.pk,
"send_invitation": "on",
}
with patch(
"coulobre.hosting.account_administration.queue_invitation"
) as invite:
preview = self.client.post(url, data | {"action": "preview"})
self.assertContains(preview, "first.example.test")
self.assertFalse(Customer.objects.exists())
response = self.client.post(url, data)
account = HostingAccount.objects.get(
primary_domain="first.example.test"
)
self.assertRedirects(response, account.get_absolute_url())
self.assertEqual(account.hosting_plan, plan)
self.assertEqual(account.reseller, manager)
self.assertEqual(account.customer.reseller, manager)
self.assertEqual(
account.customer.user.get_username(), "new-customer"
)
invite.assert_called_once_with(
account.customer.user, welcome_message=""
)
self.client.force_login(account.customer.user)
self.assertEqual(self.client.get(url).status_code, 403)
def test_onboarding_follows_the_current_workspace_across_sign_ins(self):
operator = get_user_model().objects.create_superuser("operator")
device = TOTPDevice.objects.create(user=operator, name="Panel")
home = reverse("panel:accounts")
preference = reverse("panel:onboarding_preference")
enable = reverse("panel:enable_customer_workspace")
switch = reverse("panel:switch_panel_role")
self.client.force_login(operator)
self.assertEqual(self.client.post(enable).status_code, 403)
session = self.client.session
session["otp_device_id"] = device.persistent_id
session.save()
self.assertContains(
self.client.get(home), "Getting started as server administrator"
)
self.assertRedirects(self.client.post(enable), home)
self.assertRedirects(self.client.post(enable), home)
customer = Customer.objects.get(user=operator)
self.assertEqual(customer.reseller.user_id, operator.pk)
self.assertRedirects(
self.client.post(preference, {"action": "dismiss"}), home
)
self.assertTrue(
self.client.get(home).context["onboarding"]["dismissed"]
)
for role in ("manager", "customer"):
self.assertRedirects(
self.client.post(switch, {"role": role}), home
)
self.assertContains(
self.client.get(home), f"Getting started as {role}"
)
self.assertEqual(self.client.post(enable).status_code, 403)
self.client.logout()
self.client.force_login(operator)
self.assertTrue(
self.client.get(home).context["onboarding"]["dismissed"]
)
self.assertRedirects(
self.client.post(preference, {"action": "show"}), home
)
self.assertContains(
self.client.get(home), "Getting started as server administrator"
)
def test_manager_can_enable_customer_workspace_and_keeps_manager_default(
self,
):
user = get_user_model().objects.create_user("manager")
manager = Reseller.objects.create(user=user)
self.client.force_login(user)
home = reverse("panel:accounts")
self.assertContains(
self.client.get(home), "Getting started as manager"
)
self.assertRedirects(
self.client.post(reverse("panel:enable_customer_workspace")), home
)
self.assertEqual(Customer.objects.get(user=user).reseller, manager)
self.assertContains(
self.client.get(home), "Getting started as manager"
)
self.assertRedirects(
self.client.post(
reverse("panel:switch_panel_role"), {"role": "customer"}
),
home,
)
self.assertContains(
self.client.get(home), "Getting started as customer"
)
self.assertNotContains(
self.client.get(home), "Get an assigned hosting package"
)
def test_operator_navigation_keeps_creation_and_package_links_together(
self,
):
@@ -25,7 +140,7 @@ class WorkspaceTests(TestCase):
landing = self.client.get(reverse("panel:accounts"))
links = dict(landing.context["navigation_groups"])["Account Manager"]
actions = [
(reverse("panel:customer_create"), "Add User"),
(reverse("panel:customer_onboarding"), "Add User"),
(reverse("panel:reseller_create"), "Add Manager"),
(reverse("panel:operator_create"), "Add Operator"),
(reverse("panel:hosting_plans"), "Hosting Packages"),
@@ -214,8 +329,6 @@ class WorkspaceTests(TestCase):
)
for label in ("first", "second")
]
from django_otp.plugins.otp_totp.models import TOTPDevice
device = TOTPDevice.objects.create(user=operator, name="test")
self.client.force_login(operator)
session = self.client.session
+16 -2
View File
@@ -4,7 +4,7 @@ from django.urls import path
from . import themes, views
from .account_administration import (
AllUsersView,
ManagerOnboardingView,
CustomerOnboardingView,
ManagerPackagesView,
MoveHostingView,
OperatorCreateView,
@@ -106,6 +106,10 @@ from .update_views import ChangelogView, UpdateView
from .website_file_views import WebsiteFilesView
from .website_job_views import WebsiteJobEditor, WebsiteJobList
from .website_usage_views import WebsiteUsageView
from .workspace_onboarding import (
enable_customer_workspace,
onboarding_preference,
)
from .workspaces import customer_workspace, system_workspace
app_name = "panel"
@@ -236,7 +240,7 @@ urlpatterns = [
path("users/", AllUsersView.as_view(), name="all_users"),
path(
"users/new/",
ManagerOnboardingView.as_view(),
CustomerOnboardingView.as_view(),
name="customer_onboarding",
),
path("users/move/", MoveHostingView.as_view(), name="move_accounts"),
@@ -293,6 +297,16 @@ urlpatterns = [
name="operator_settings",
),
path("account/role/", switch_panel_role, name="switch_panel_role"),
path(
"account/getting-started/",
onboarding_preference,
name="onboarding_preference",
),
path(
"account/customer-workspace/",
enable_customer_workspace,
name="enable_customer_workspace",
),
path(
"logins/assign-role/",
AssignPanelRoleView.as_view(),
+15 -2
View File
@@ -180,6 +180,7 @@ from .website_aliases import (
from .website_file_views import can_manage_website_files
from .website_job_views import can_manage_website_jobs
from .website_jobs import website_job_limit
from .workspace_onboarding import onboarding_context
VIEW_ACCOUNTS = "hosting.view_hostingaccount"
CHANGE_ACCOUNTS = "hosting.change_hostingaccount"
@@ -390,6 +391,8 @@ class AccountList(TenantScopeMixin, PermissionRequiredMixin, ListView):
def get_context_data(self, **kwargs):
context = super().get_context_data(search=self.search, **kwargs)
if not self.search and not self.request.GET.get("customer"):
context["onboarding"] = onboarding_context(self.request)
context["show_customer_website_link"] = settings.WEBSITE_USAGE
reseller = reseller_for_user(self.request.user)
if reseller is not None:
@@ -468,6 +471,7 @@ class AccountCreate(PermissionRequiredMixin, AccountEditor, CreateView):
"in the Customer workspace."
),
required=False,
initial=self.request.GET.get("own") == "1",
)
reseller = reseller_for_user(actor) is not None
defaults = zone_defaults()
@@ -543,9 +547,18 @@ class AccountCreate(PermissionRequiredMixin, AccountEditor, CreateView):
try:
with transaction.atomic():
if own_hosting:
customer, created = Customer.objects.get_or_create(
user_id=actor.pk
manager = self.object.reseller or actor.hosting_reseller
customer, created = (
Customer.objects.select_for_update().get_or_create(
user_id=actor.pk,
defaults={"reseller": manager},
)
)
if customer.reseller_id is None:
customer.reseller = manager
customer.save(update_fields=["reseller"])
if self.object.reseller_id is None:
self.object.reseller_id = customer.reseller_id
self.object.customer = customer
if created:
LogEntry.objects.log_actions(
@@ -0,0 +1,179 @@
from django.contrib.admin.models import ADDITION, LogEntry
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.http import HttpResponseBadRequest
from django.shortcuts import redirect
from django.urls import reverse
from django.views.decorators.http import require_POST
from .access import PanelRole, customer_for_user, reseller_for_user
from .account_administration import can_onboard_customer
from .models import (
Customer,
HostingAccount,
HostingPlan,
OnboardingDismissal,
PanelRecoveryCode,
ServiceHealth,
)
from .panel_roles import ROLE_LABELS
def workspace_role(request):
if getattr(request, "impersonation", None):
return None
if customer_for_user(request.user):
return PanelRole.CUSTOMER
if reseller_for_user(request.user):
return PanelRole.MANAGER
if request.user.has_perm("hosting.view_hostingaccount"):
return PanelRole.ADMIN
return None
def customer_workspace_manager(user):
if user.is_superuser and user.is_verified():
return getattr(user, "hosting_reseller", None)
return reseller_for_user(user)
def onboarding_context(request):
role = workspace_role(request)
if role is None:
return None
user = request.user
title = f"Getting started as {ROLE_LABELS[role].lower()}"
if OnboardingDismissal.objects.filter(user_id=user.pk, role=role).exists():
return {"title": title, "dismissed": True}
active = HostingAccount.objects.filter(retired_at__isnull=True)
steps = []
if role == PanelRole.ADMIN:
if user.has_perm("hosting.view_servicehealth"):
steps.append(
(
"Check that services report their status",
reverse("panel:service_health"),
ServiceHealth.objects.exists(),
)
)
if user.has_perms(
("hosting.view_hostingplan", "hosting.add_hostingplan")
):
steps.append(
(
"Create a hosting package",
reverse("panel:hosting_plan_create"),
HostingPlan.objects.exists(),
)
)
if can_onboard_customer(user):
steps.append(
(
"Create a customer login and hosting account",
reverse("panel:customer_onboarding"),
active.filter(customer__user__is_superuser=False).exists(),
)
)
if user.is_superuser and user.is_verified():
steps.append(
(
"Set up hosting for your own login",
reverse("panel:account_create", query={"own": "1"}),
active.filter(customer__user_id=user.pk).exists(),
)
)
elif role == PanelRole.MANAGER:
manager = reseller_for_user(user)
has_packages = manager.hosting_plans.exists()
accounts = active.filter(reseller=manager)
may_create = (
has_packages
and manager.hostingaccount_set.count() < manager.account_limit
)
steps.extend(
(
(
"Get an assigned hosting package",
reverse("panel:manager_packages"),
has_packages,
),
(
"Create a customer login and hosting account",
reverse("panel:customer_onboarding") if may_create else "",
accounts.exclude(customer__user_id=user.pk)
.filter(customer__isnull=False)
.exists(),
),
)
)
else:
customer = customer_for_user(user)
account = active.filter(customer=customer).order_by("pk").first()
steps.extend(
(
(
"Set up recovery codes",
reverse("panel:account_security"),
PanelRecoveryCode.objects.filter(user_id=user.pk).exists(),
),
(
"Get a hosting account",
account.get_absolute_url() if account else "",
account is not None,
),
)
)
enable_customer = (
role != PanelRole.CUSTOMER
and not hasattr(user, "hosting_customer")
and customer_workspace_manager(user) is not None
)
return {
"title": title,
"steps": steps,
"enable_customer": enable_customer,
"role": role,
}
@login_required
@require_POST
def onboarding_preference(request):
role = workspace_role(request)
if role is None:
raise PermissionDenied
action = request.POST.get("action")
if action == "dismiss":
OnboardingDismissal.objects.get_or_create(
user_id=request.user.pk, role=role
)
elif action == "show":
OnboardingDismissal.objects.filter(
user_id=request.user.pk, role=role
).delete()
else:
return HttpResponseBadRequest()
return redirect("panel:accounts")
@login_required
@require_POST
@transaction.atomic
def enable_customer_workspace(request):
if getattr(request, "impersonation", None):
raise PermissionDenied
user = request.user
manager = customer_workspace_manager(user)
if manager is None:
raise PermissionDenied
customer, created = Customer.objects.get_or_create(
user_id=user.pk, defaults={"reseller": manager}
)
if created:
LogEntry.objects.log_actions(
user.pk, [customer], ADDITION, "Enabled own Customer workspace."
)
return redirect("panel:accounts")
+9 -1
View File
@@ -369,12 +369,20 @@ def groups_for(request, *, customer, manager):
)
]
else:
from .account_administration import can_onboard_customer
accounts = []
for permission, route, label in (
(("view_hostingaccount",), "accounts", "Hosting accounts"),
(("view_customer",), "all_users", "Show All Users"),
(("view_reseller",), "resellers", "Managers"),
(("view_customer", "add_customer"), "customer_create", "Add User"),
(
("view_customer", "add_customer"),
"customer_onboarding"
if can_onboard_customer(user)
else "customer_create",
"Add User",
),
(
("view_reseller", "add_reseller"),
"reseller_create",
+58 -2
View File
@@ -3,11 +3,13 @@ import shlex
import stat
import tempfile
import unittest
from contextlib import redirect_stdout
from io import StringIO
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import Mock, patch
from deploy.panel_installer.cli import save_interactive_plan
from deploy.panel_installer.cli import interactive_plan, save_interactive_plan
from deploy.panel_installer.config import (
InstallError,
parse_plan,
@@ -15,7 +17,12 @@ from deploy.panel_installer.config import (
read_plan,
)
from deploy.panel_installer.engine import Installer, install_worker
from deploy.panel_installer.web import Wizard, WizardHandler, form_plan
from deploy.panel_installer.web import (
Wizard,
WizardHandler,
form_plan,
installation_form,
)
PROXY = {
"hostname": "Panel.Example.NET",
@@ -139,6 +146,39 @@ class InstallerParametersTests(unittest.TestCase):
self.assertEqual(stat.S_IMODE(path.stat().st_mode), 0o600)
self.assertEqual(parse_plan(read_plan(path)), plan)
def test_interactive_hosting_hints_explain_dns_and_keep_defaults(self):
replies = [
"",
"panel.example.net",
"",
"",
"ops@example.net",
"",
"",
"",
"",
"192.0.2.21",
"ns1.example.net",
"",
]
output = StringIO()
with (
patch("builtins.input", side_effect=replies),
redirect_stdout(output),
):
plan = interactive_plan()
self.assertEqual(plan.dns.mode, "local")
self.assertEqual(plan.mail.mode, "local")
self.assertEqual(plan.hosting.public_addresses, ("192.0.2.21",))
self.assertEqual(plan.hosting.nameservers, ("ns1.example.net",))
self.assertEqual(plan.hosting.mail_sending_addresses, ())
self.assertIn("default A and AAAA records", output.getvalue())
self.assertIn(
"delegation separately at the registrar", output.getvalue()
)
self.assertIn("SPF and managed mail DNS", output.getvalue())
def test_browser_and_parameter_file_share_the_same_plan(self):
with tempfile.TemporaryDirectory() as folder:
params = Path(folder) / "panel.toml"
@@ -260,6 +300,22 @@ class InstallerParametersTests(unittest.TestCase):
class SetupWizardTests(unittest.TestCase):
def test_form_hints_are_linked_and_saved_choices_are_restored(self):
html = installation_form(
{
"access": "proxy",
"dns_mode": "off",
"mail_tls": "provided",
"public_addresses": "192.0.2.21",
}
)
for name in ("access", "dns_mode", "mail_tls", "public_addresses"):
self.assertIn(f'aria-describedby="{name}-hint"', html)
self.assertIn(f'id="{name}-hint"', html)
for value in ("proxy", "off", "provided"):
self.assertIn(f'<option value="{value}" selected>', html)
self.assertIn('value="192.0.2.21"', html)
def handler(self):
handler = WizardHandler.__new__(WizardHandler)
handler.server = SimpleNamespace(
+5 -1
View File
@@ -58,10 +58,14 @@ def build_package(source, wheel, ref, output):
f"Package: coulobre-panel\nVersion: {version}\n"
"Architecture: all\nSection: web\nPriority: optional\n"
"Maintainer: Hippogrief <info@hippogrief.nl>\n"
"Homepage: https://code.hosting.hippogrief.nl/hippogrief/coulobre\n"
"Depends: python3 (>= 3.12), python3-venv, ca-certificates, "
"openssh-client\n"
"Description: Coulobre web hosting control panel\n"
" Deployment assets for supported Ubuntu and Debian systems.\n"
" Deployment package for Ubuntu 26.04 LTS (resolute) and "
"Debian 13 (trixie).\n"
" On a fresh host, run sudo coulobre-install --interactive "
"after APT exits.\n"
)
metadata.chmod(0o644)
sbin = root / "usr/sbin"