Support single-server deployments on Debian 13 #82
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Coulobre local website HTTPS request
|
Description=Coulobre local website HTTPS request
|
||||||
After=apache2.service php8.5-fpm.service
|
After=apache2.service php8.4-fpm.service php8.5-fpm.service
|
||||||
CollectMode=inactive-or-failed
|
CollectMode=inactive-or-failed
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Coulobre local web activation request
|
Description=Coulobre local web activation request
|
||||||
After=apache2.service php8.5-fpm.service
|
After=apache2.service php8.4-fpm.service php8.5-fpm.service
|
||||||
CollectMode=inactive-or-failed
|
CollectMode=inactive-or-failed
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|||||||
+44
-19
@@ -1,8 +1,19 @@
|
|||||||
# Install Coulobre Panel on one server
|
# Install Coulobre Panel on one server
|
||||||
|
|
||||||
This setup runs the panel, its Celery worker and scheduler, MariaDB, RabbitMQ,
|
This setup runs the panel, its Celery worker and scheduler, MariaDB, RabbitMQ,
|
||||||
and Apache on one Ubuntu server. Use Ubuntu 24.04 or later. Apache serves the
|
and Apache on one server. Apache serves the panel and its static files and
|
||||||
panel and its static files and connects to Gunicorn over a Unix socket.
|
connects to Gunicorn over a Unix socket.
|
||||||
|
|
||||||
|
| Distribution | Panel | Managed websites | Local mailbox setup |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| Ubuntu 26.04 | Yes | PHP 8.5 FPM | Dovecot 2.4 |
|
||||||
|
| Debian 13 (Trixie) | Yes | PHP 8.4 FPM | Dovecot 2.4 |
|
||||||
|
| Ubuntu 24.04 | Yes | — | Dovecot 2.3 |
|
||||||
|
|
||||||
|
Use the distribution's PHP-FPM packages on a managed web node. Coulobre uses
|
||||||
|
their pool directory, configuration test command, and systemd service. Debian
|
||||||
|
13 supplies Python 3.13 for the panel virtual environment.
|
||||||
|
[Debian 13 release notes](https://www.debian.org/releases/trixie/release-notes/whats-new.en.html)
|
||||||
|
|
||||||
## Install the package and configure local services
|
## Install the package and configure local services
|
||||||
|
|
||||||
@@ -260,11 +271,22 @@ local services that the installation will offer before checking them.
|
|||||||
selected test mailbox to a fresh destination on that node. If SpamAssassin
|
selected test mailbox to a fresh destination on that node. If SpamAssassin
|
||||||
is enabled, verify normal delivery and the GTUBE test.
|
is enabled, verify normal delivery and the GTUBE test.
|
||||||
|
|
||||||
|
### Debian 13 verification
|
||||||
|
|
||||||
|
The single-server setup was verified on a fresh Debian 13 amd64 VM with the
|
||||||
|
distribution packages and systemd. The test covered direct and reverse-proxied
|
||||||
|
panel HTTPS, account access and plan limits, website activation and PHP-FPM
|
||||||
|
pool changes, service health, SFTP, ext4 user quotas, MariaDB provisioning,
|
||||||
|
Postfix delivery, Dovecot IMAP and quotas, and authoritative BIND9 publishing.
|
||||||
|
Certbot issued and renewed a hosted website certificate using a local ACME
|
||||||
|
test CA. An account backup restored an individual file, the complete website,
|
||||||
|
a MariaDB database, and a Dovecot mailbox.
|
||||||
|
|
||||||
## Activate local websites from the panel
|
## Activate local websites from the panel
|
||||||
|
|
||||||
Use the local activation worker when the panel and the Ubuntu 26.04 web node
|
Use the local activation worker when the panel and the web node share a
|
||||||
share a server. Install Apache and PHP 8.5 FPM on the host and follow the
|
Debian 13 or Ubuntu 26.04 server. Follow the
|
||||||
[web node setup](development.md#apply-a-manifest-on-an-ubuntu-web-node) and
|
[web node setup](development.md#apply-a-manifest-on-a-web-node) and
|
||||||
[socket setup](development.md#enable-local-web-activation).
|
[socket setup](development.md#enable-local-web-activation).
|
||||||
|
|
||||||
Create a dedicated account and install the worker. Its systemd unit grants
|
Create a dedicated account and install the worker. Its systemd unit grants
|
||||||
@@ -905,14 +927,16 @@ and cURL extensions. Serve phpMyAdmin on a dedicated HTTPS hostname with its
|
|||||||
own PHP-FPM pool. The pool needs read access to its bridge configuration and
|
own PHP-FPM pool. The pool needs read access to its bridge configuration and
|
||||||
write access to its private session directory.
|
write access to its private session directory.
|
||||||
|
|
||||||
The examples below use the Ubuntu 26.04 package paths. Adjust the TLS files,
|
Set `php_version` to the version for your distribution before running the
|
||||||
hostname, and panel origin in the example configurations before enabling the
|
commands below. Adjust the TLS files, hostname, and panel origin in the example
|
||||||
virtual host. If the distribution's Apache configuration exposes phpMyAdmin
|
configurations before enabling the virtual host. If the distribution's Apache
|
||||||
globally, disable it and include the package configuration only in the
|
configuration exposes phpMyAdmin globally, disable it and include the package
|
||||||
dedicated virtual host.
|
configuration only in the dedicated virtual host.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt install phpmyadmin php8.5-fpm php8.5-mysql php8.5-curl
|
php_version=8.5 # Use 8.4 on Debian 13.
|
||||||
|
sudo apt install phpmyadmin "php${php_version}-fpm" "php${php_version}-mysql" \
|
||||||
|
"php${php_version}-curl"
|
||||||
sudo useradd --system --user-group --no-create-home --home-dir /nonexistent \
|
sudo useradd --system --user-group --no-create-home --home-dir /nonexistent \
|
||||||
--shell /usr/sbin/nologin coulobre-phpmyadmin
|
--shell /usr/sbin/nologin coulobre-phpmyadmin
|
||||||
sudo install -d -g coulobre-phpmyadmin -m 0750 \
|
sudo install -d -g coulobre-phpmyadmin -m 0750 \
|
||||||
@@ -926,7 +950,7 @@ sudo install -m 0644 deploy/phpmyadmin/coulobre-signon.php \
|
|||||||
sudo install -m 0644 deploy/phpmyadmin/config.inc.php.example \
|
sudo install -m 0644 deploy/phpmyadmin/config.inc.php.example \
|
||||||
/etc/phpmyadmin/conf.d/99-coulobre-signon.php
|
/etc/phpmyadmin/conf.d/99-coulobre-signon.php
|
||||||
sudo install -m 0644 deploy/phpmyadmin/pool.conf.example \
|
sudo install -m 0644 deploy/phpmyadmin/pool.conf.example \
|
||||||
/etc/php/8.5/fpm/pool.d/coulobre-phpmyadmin.conf
|
"/etc/php/${php_version}/fpm/pool.d/coulobre-phpmyadmin.conf"
|
||||||
sudo install -m 0644 deploy/phpmyadmin/apache.conf.example \
|
sudo install -m 0644 deploy/phpmyadmin/apache.conf.example \
|
||||||
/etc/apache2/sites-available/coulobre-phpmyadmin.conf
|
/etc/apache2/sites-available/coulobre-phpmyadmin.conf
|
||||||
```
|
```
|
||||||
@@ -946,9 +970,9 @@ panel_manage migrate --noinput
|
|||||||
panel_manage collectstatic --noinput
|
panel_manage collectstatic --noinput
|
||||||
sudo a2enmod ssl proxy_fcgi
|
sudo a2enmod ssl proxy_fcgi
|
||||||
sudo a2ensite coulobre-phpmyadmin
|
sudo a2ensite coulobre-phpmyadmin
|
||||||
sudo php-fpm8.5 --test
|
sudo "php-fpm${php_version}" --test
|
||||||
sudo apache2ctl configtest
|
sudo apache2ctl configtest
|
||||||
sudo systemctl reload php8.5-fpm apache2
|
sudo systemctl reload "php${php_version}-fpm" apache2
|
||||||
sudo systemctl restart coulobre-panel
|
sudo systemctl restart coulobre-panel
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -960,13 +984,13 @@ database. Sign out of phpMyAdmin to end its session.
|
|||||||
|
|
||||||
### Open a mailbox in Roundcube
|
### Open a mailbox in Roundcube
|
||||||
|
|
||||||
On Ubuntu 26.04 with PHP 8.5, use the current Roundcube 1.7 Complete
|
Use the Roundcube 1.7 Complete release. Verify
|
||||||
release from [Roundcube Downloads](https://roundcube.net/download/). Verify
|
|
||||||
the archive and install Roundcube in `/opt/roundcube` following the
|
the archive and install Roundcube in `/opt/roundcube` following the
|
||||||
[upstream manual setup](https://github.com/roundcube/roundcubemail/wiki/Installation).
|
[upstream manual setup](https://github.com/roundcube/roundcubemail/wiki/Installation).
|
||||||
|
[Roundcube downloads](https://roundcube.net/download/)
|
||||||
The Ubuntu 26.04 package at version 1.6.11 cannot start with PHP 8.5.
|
The Ubuntu 26.04 package at version 1.6.11 cannot start with PHP 8.5.
|
||||||
Install the required PHP extensions for Roundcube and its database, as
|
Install the required PHP extensions for Roundcube and its database, as
|
||||||
well as `php8.5-curl` for the bridge.
|
well as the matching PHP cURL package for the bridge.
|
||||||
|
|
||||||
Use the mail server already configured for Coulobre. Confirm that a
|
Use the mail server already configured for Coulobre. Confirm that a
|
||||||
mailbox can sign in over TLS using its full email address. Configure a
|
mailbox can sign in over TLS using its full email address. Configure a
|
||||||
@@ -981,6 +1005,7 @@ Roundcube maintenance jobs. Keep the application code and configuration
|
|||||||
owned by root.
|
owned by root.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
php_version=8.5 # Use 8.4 on Debian 13.
|
||||||
sudo useradd --system --user-group --no-create-home --shell /usr/sbin/nologin coulobre-roundcube
|
sudo useradd --system --user-group --no-create-home --shell /usr/sbin/nologin coulobre-roundcube
|
||||||
sudo install -d -o root -g coulobre-roundcube -m 0750 /etc/coulobre-roundcube
|
sudo install -d -o root -g coulobre-roundcube -m 0750 /etc/coulobre-roundcube
|
||||||
sudo install -o root -g coulobre-roundcube -m 0640 /dev/null /etc/coulobre-roundcube/bridge.key
|
sudo install -o root -g coulobre-roundcube -m 0640 /dev/null /etc/coulobre-roundcube/bridge.key
|
||||||
@@ -988,7 +1013,7 @@ sudo sh -c 'openssl rand -hex 32 > /etc/coulobre-roundcube/bridge.key'
|
|||||||
sudo install -D -m 0644 deploy/roundcube/coulobre_webmail.php \
|
sudo install -D -m 0644 deploy/roundcube/coulobre_webmail.php \
|
||||||
/opt/roundcube/plugins/coulobre_webmail/coulobre_webmail.php
|
/opt/roundcube/plugins/coulobre_webmail/coulobre_webmail.php
|
||||||
sudo install -m 0644 deploy/roundcube/pool.conf.example \
|
sudo install -m 0644 deploy/roundcube/pool.conf.example \
|
||||||
/etc/php/8.5/fpm/pool.d/coulobre-roundcube.conf
|
"/etc/php/${php_version}/fpm/pool.d/coulobre-roundcube.conf"
|
||||||
sudo install -o root -g coulobre-roundcube -m 0640 deploy/roundcube/config.inc.php.example \
|
sudo install -o root -g coulobre-roundcube -m 0640 deploy/roundcube/config.inc.php.example \
|
||||||
/etc/coulobre-roundcube/webmail.inc.php
|
/etc/coulobre-roundcube/webmail.inc.php
|
||||||
sudoedit /etc/coulobre-roundcube/webmail.inc.php
|
sudoedit /etc/coulobre-roundcube/webmail.inc.php
|
||||||
@@ -1068,7 +1093,7 @@ To provision Postfix and Dovecot on another host, use the
|
|||||||
[separate-node setup](#provision-mail-and-dns-on-separate-servers).
|
[separate-node setup](#provision-mail-and-dns-on-separate-servers).
|
||||||
|
|
||||||
Set up [Postfix and Dovecot](development.md#apply-a-mailbox-manifest) on the
|
Set up [Postfix and Dovecot](development.md#apply-a-mailbox-manifest) on the
|
||||||
Ubuntu 24.04 or 26.04 panel host and enable the
|
panel host and enable the
|
||||||
[mailbox provisioning socket](development.md#enable-local-mailbox-provisioning).
|
[mailbox provisioning socket](development.md#enable-local-mailbox-provisioning).
|
||||||
Install the dedicated worker that connects to that socket.
|
Install the dedicated worker that connects to that socket.
|
||||||
|
|
||||||
|
|||||||
+19
-18
@@ -311,7 +311,7 @@ notation for `responsible_name`, such as `hostmaster.example.net` for
|
|||||||
by hand.
|
by hand.
|
||||||
|
|
||||||
Render the zone file and validate it with the `named-checkzone` utility
|
Render the zone file and validate it with the `named-checkzone` utility
|
||||||
provided by the Ubuntu `bind9-utils` package. The rendered zone is written to
|
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).
|
standard output. See the [BIND9 command reference](https://bind9.readthedocs.io/en/stable/manpages.html#named-checkzone).
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -351,7 +351,7 @@ the strings in the TXT record. [RFC 1035](https://www.rfc-editor.org/rfc/rfc1035
|
|||||||
|
|
||||||
### Apply a zone manifest
|
### Apply a zone manifest
|
||||||
|
|
||||||
Install `bind9` and `bind9-utils` on an Ubuntu DNS node. Use BIND9's default
|
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.
|
IN view and enable `allow-new-zones yes;` in the existing `options` block.
|
||||||
On an authoritative-only DNS node, set `recursion no;` and configure
|
On an authoritative-only DNS node, set `recursion no;` and configure
|
||||||
`allow-transfer` to match your secondary servers. Set
|
`allow-transfer` to match your secondary servers. Set
|
||||||
@@ -415,11 +415,11 @@ coulobre-mail-node inspect coulobre-mailbox-1.json
|
|||||||
|
|
||||||
### Apply a mailbox manifest
|
### Apply a mailbox manifest
|
||||||
|
|
||||||
Use Ubuntu 24.04 with Dovecot 2.3 or Ubuntu 26.04 with Dovecot 2.4. Install
|
Install Postfix, `dovecot-imapd`, and `dovecot-lmtpd`. Debian 13 and Ubuntu
|
||||||
Postfix, `dovecot-imapd`, and `dovecot-lmtpd`. Install Coulobre in a root-owned
|
26.04 use Dovecot 2.4. Ubuntu 24.04 uses Dovecot 2.3. Install Coulobre in a
|
||||||
virtual environment on the node. Use a Postfix hostname outside the set of
|
root-owned virtual environment on the node. Use a Postfix hostname outside
|
||||||
hosted mail domains and keep those domains in Postfix's virtual mailbox
|
the set of hosted mail domains and keep those domains in Postfix's virtual
|
||||||
address class. See the [Postfix virtual domain guide](https://www.postfix.org/VIRTUAL_README.html).
|
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.
|
On a fresh mail node, create the virtual mail user and empty lookup files.
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ service lmtp {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Dovecot 2.4 on Ubuntu 26.04
|
#### Dovecot 2.4 on Debian 13 and Ubuntu 26.04
|
||||||
|
|
||||||
For a fresh, dedicated mail node, use the
|
For a fresh, dedicated mail node, use the
|
||||||
[Dovecot 2.4 configuration example](../deploy/dovecot/coulobre-2.4.conf.example)
|
[Dovecot 2.4 configuration example](../deploy/dovecot/coulobre-2.4.conf.example)
|
||||||
@@ -785,20 +785,21 @@ 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
|
coulobre-web-node render coulobre-web-plan-1.json php-fpm > php-fpm.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
The command reads the manifest and packaged templates locally. The isolated
|
The command reads the manifest and packaged templates locally.
|
||||||
Ubuntu check below demonstrates loading the configuration.
|
|
||||||
|
|
||||||
## Apply a manifest on an Ubuntu web node
|
## Apply a manifest on a web node
|
||||||
|
|
||||||
Use a dedicated Ubuntu 26.04 node with Apache and PHP 8.5 FPM installed from
|
Install Apache and PHP-FPM from the distribution packages. Use PHP 8.4 on
|
||||||
the distribution packages. Enable FastCGI in Apache and start the native
|
Debian 13 and PHP 8.5 on Ubuntu 26.04. Enable FastCGI in Apache and start the
|
||||||
services before applying a manifest.
|
services before applying a manifest. Each site's virtual host connects to its
|
||||||
|
own FPM socket.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt install apache2 php8.5-fpm
|
php_version=8.5 # Use 8.4 on Debian 13.
|
||||||
|
sudo apt install apache2 "php${php_version}-fpm"
|
||||||
sudo a2enmod proxy_fcgi
|
sudo a2enmod proxy_fcgi
|
||||||
sudo service php8.5-fpm start
|
sudo systemctl enable --now "php${php_version}-fpm"
|
||||||
sudo service apache2 restart
|
sudo systemctl restart apache2
|
||||||
```
|
```
|
||||||
|
|
||||||
Install the matching Coulobre package in a root-owned virtual environment on
|
Install the matching Coulobre package in a root-owned virtual environment on
|
||||||
@@ -838,7 +839,7 @@ 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
|
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.
|
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
|
Website aliases reuse the activation and HTTPS sockets. The web node stores
|
||||||
alias reservations under `/var/lib/coulobre/web-node/aliases/` and creates
|
alias reservations under `/var/lib/coulobre/web-node/aliases/` and creates
|
||||||
separate Apache virtual hosts that share the primary site's document root and
|
separate Apache virtual hosts that share the primary site's document root and
|
||||||
PHP-FPM socket. Existing website deployment manifests use the primary domain
|
PHP-FPM socket. Existing website deployment manifests use the primary domain
|
||||||
|
|||||||
@@ -142,6 +142,19 @@ class MailboxBackupTests(SimpleTestCase):
|
|||||||
|
|
||||||
self.assertFalse((self.home / "Maildir").exists())
|
self.assertFalse((self.home / "Maildir").exists())
|
||||||
|
|
||||||
|
def test_archive_can_read_the_root_owned_snapshot_directory(self):
|
||||||
|
def archive(directory, account, output):
|
||||||
|
self.assertEqual(stat.S_IMODE(directory.stat().st_mode), 0o750)
|
||||||
|
os.chown.assert_any_call(directory, 0, account.pw_gid)
|
||||||
|
|
||||||
|
with (
|
||||||
|
patch.object(mail_node_backup, "copy_mailbox"),
|
||||||
|
patch.object(
|
||||||
|
mail_node_backup, "archive_snapshot", side_effect=archive
|
||||||
|
),
|
||||||
|
):
|
||||||
|
mail_node_backup.backup_mailbox(self.mailbox, self.archive)
|
||||||
|
|
||||||
def test_incomplete_dovecot_sync_leaves_no_archive(self):
|
def test_incomplete_dovecot_sync_leaves_no_archive(self):
|
||||||
with (
|
with (
|
||||||
patch.object(mail_node_backup.subprocess, "run") as command,
|
patch.object(mail_node_backup.subprocess, "run") as command,
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ from django.urls import reverse
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from coulobre.php_pool_settings import PhpPoolSettings
|
from coulobre.php_pool_settings import PhpPoolSettings
|
||||||
|
from coulobre.php_runtime import PHP_FPM_BINARY, PHP_SERVICE
|
||||||
from coulobre.web_node import WebPhpRequest, WebSite, parse_web_request
|
from coulobre.web_node import WebPhpRequest, WebSite, parse_web_request
|
||||||
from coulobre.web_node_apply import (
|
from coulobre.web_node_apply import (
|
||||||
PHP_SERVICE,
|
|
||||||
SitePaths,
|
SitePaths,
|
||||||
install_configurations,
|
install_configurations,
|
||||||
)
|
)
|
||||||
@@ -284,7 +284,7 @@ class NativePhpSettingsTests(SimpleTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.runner.call_args_list,
|
self.runner.call_args_list,
|
||||||
[
|
[
|
||||||
call("/usr/sbin/php-fpm8.5", "--test"),
|
call(PHP_FPM_BINARY, "--test"),
|
||||||
call("/usr/sbin/service", PHP_SERVICE, "reload"),
|
call("/usr/sbin/service", PHP_SERVICE, "reload"),
|
||||||
call("/usr/sbin/service", PHP_SERVICE, "reload"),
|
call("/usr/sbin/service", PHP_SERVICE, "reload"),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -5,10 +5,30 @@ from unittest.mock import call, patch
|
|||||||
|
|
||||||
from django.test import SimpleTestCase
|
from django.test import SimpleTestCase
|
||||||
|
|
||||||
|
from coulobre.php_runtime import PHP_FPM_BINARY, PHP_SERVICE, php_fpm_version
|
||||||
from coulobre.web_node import WebSite
|
from coulobre.web_node import WebSite
|
||||||
from coulobre.web_node_apply import install_configurations, site_status
|
from coulobre.web_node_apply import install_configurations, site_status
|
||||||
|
|
||||||
|
|
||||||
|
class PhpRuntimeTests(SimpleTestCase):
|
||||||
|
@patch("coulobre.php_runtime.freedesktop_os_release")
|
||||||
|
def test_selects_the_packaged_fpm_version(self, release):
|
||||||
|
for distribution, version, expected in (
|
||||||
|
("debian", "13", "8.4"),
|
||||||
|
("ubuntu", "26.04", "8.5"),
|
||||||
|
):
|
||||||
|
with self.subTest(distribution=distribution, version=version):
|
||||||
|
release.return_value = {
|
||||||
|
"ID": distribution,
|
||||||
|
"VERSION_ID": version,
|
||||||
|
}
|
||||||
|
self.assertEqual(php_fpm_version(), expected)
|
||||||
|
|
||||||
|
@patch("coulobre.php_runtime.freedesktop_os_release", side_effect=OSError)
|
||||||
|
def test_missing_os_release_keeps_the_default_version(self, release):
|
||||||
|
self.assertEqual(php_fpm_version(), "8.5")
|
||||||
|
|
||||||
|
|
||||||
class WebNodeConfigurationTests(SimpleTestCase):
|
class WebNodeConfigurationTests(SimpleTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
directory = Path(self.enterContext(TemporaryDirectory()))
|
directory = Path(self.enterContext(TemporaryDirectory()))
|
||||||
@@ -40,9 +60,9 @@ class WebNodeConfigurationTests(SimpleTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.runner.call_args_list,
|
self.runner.call_args_list,
|
||||||
[
|
[
|
||||||
call("/usr/sbin/php-fpm8.5", "--test"),
|
call(PHP_FPM_BINARY, "--test"),
|
||||||
call("/usr/sbin/apache2ctl", "configtest"),
|
call("/usr/sbin/apache2ctl", "configtest"),
|
||||||
call("/usr/sbin/service", "php8.5-fpm", "reload"),
|
call("/usr/sbin/service", PHP_SERVICE, "reload"),
|
||||||
call("/usr/sbin/service", "apache2", "reload"),
|
call("/usr/sbin/service", "apache2", "reload"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@@ -68,7 +88,7 @@ class WebNodeConfigurationTests(SimpleTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.runner.call_args_list[-2:],
|
self.runner.call_args_list[-2:],
|
||||||
[
|
[
|
||||||
call("/usr/sbin/service", "php8.5-fpm", "reload"),
|
call("/usr/sbin/service", PHP_SERVICE, "reload"),
|
||||||
call("/usr/sbin/service", "apache2", "reload"),
|
call("/usr/sbin/service", "apache2", "reload"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ def backup_mailbox(mailbox, archive):
|
|||||||
TemporaryDirectory(dir=home.parent) as directory,
|
TemporaryDirectory(dir=home.parent) as directory,
|
||||||
):
|
):
|
||||||
scratch = Path(directory)
|
scratch = Path(directory)
|
||||||
scratch.chmod(0o711)
|
os.chown(scratch, 0, account.pw_gid)
|
||||||
|
scratch.chmod(0o750)
|
||||||
snapshot = scratch / MAILDIR
|
snapshot = scratch / MAILDIR
|
||||||
mail_node_apply.ensure_mail_home(snapshot, account, create=True)
|
mail_node_apply.ensure_mail_home(snapshot, account, create=True)
|
||||||
copy_mailbox(mailbox, snapshot)
|
copy_mailbox(mailbox, snapshot)
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
from platform import freedesktop_os_release
|
||||||
|
|
||||||
|
|
||||||
|
def php_fpm_version():
|
||||||
|
try:
|
||||||
|
release = freedesktop_os_release()
|
||||||
|
except OSError:
|
||||||
|
release = {}
|
||||||
|
if release.get("ID") == "debian" and release.get("VERSION_ID") == "13":
|
||||||
|
return "8.4"
|
||||||
|
return "8.5"
|
||||||
|
|
||||||
|
|
||||||
|
PHP_VERSION = php_fpm_version()
|
||||||
|
PHP_SERVICE = f"php{PHP_VERSION}-fpm"
|
||||||
|
PHP_FPM_BINARY = f"/usr/sbin/php-fpm{PHP_VERSION}"
|
||||||
|
PHP_POOL_DIRECTORY = Path(f"/etc/php/{PHP_VERSION}/fpm/pool.d")
|
||||||
@@ -4,12 +4,14 @@ import subprocess
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import StrEnum
|
from enum import StrEnum
|
||||||
|
|
||||||
|
from .php_runtime import PHP_SERVICE, PHP_VERSION
|
||||||
|
|
||||||
SERVICES = {
|
SERVICES = {
|
||||||
"panel": ("Coulobre Panel", "coulobre-panel.service"),
|
"panel": ("Coulobre Panel", "coulobre-panel.service"),
|
||||||
"worker": ("Coulobre worker", "coulobre-worker.service"),
|
"worker": ("Coulobre worker", "coulobre-worker.service"),
|
||||||
"scheduler": ("Coulobre scheduler", "coulobre-beat.service"),
|
"scheduler": ("Coulobre scheduler", "coulobre-beat.service"),
|
||||||
"apache": ("Apache", "apache2.service"),
|
"apache": ("Apache", "apache2.service"),
|
||||||
"php-fpm": ("PHP 8.5 FPM", "php8.5-fpm.service"),
|
"php-fpm": (f"PHP {PHP_VERSION} FPM", f"{PHP_SERVICE}.service"),
|
||||||
"mariadb": ("MariaDB", "mariadb.service"),
|
"mariadb": ("MariaDB", "mariadb.service"),
|
||||||
"rabbitmq": ("RabbitMQ", "rabbitmq-server.service"),
|
"rabbitmq": ("RabbitMQ", "rabbitmq-server.service"),
|
||||||
"bind9": ("BIND9", "named.service"),
|
"bind9": ("BIND9", "named.service"),
|
||||||
|
|||||||
@@ -310,9 +310,7 @@ def main(argv=None):
|
|||||||
)
|
)
|
||||||
render.add_argument("manifest", type=Path)
|
render.add_argument("manifest", type=Path)
|
||||||
render.add_argument("configuration", choices=CONFIGURATIONS)
|
render.add_argument("configuration", choices=CONFIGURATIONS)
|
||||||
apply = commands.add_parser(
|
apply = commands.add_parser("apply", help="Install a site on a web node.")
|
||||||
"apply", help="Install a site on an Ubuntu web node."
|
|
||||||
)
|
|
||||||
apply.add_argument("manifest", type=Path)
|
apply.add_argument("manifest", type=Path)
|
||||||
commands.add_parser(
|
commands.add_parser(
|
||||||
"apply-request",
|
"apply-request",
|
||||||
|
|||||||
@@ -16,13 +16,12 @@ from .node_files import (
|
|||||||
require_root_directory,
|
require_root_directory,
|
||||||
write_new_file,
|
write_new_file,
|
||||||
)
|
)
|
||||||
|
from .php_runtime import PHP_FPM_BINARY, PHP_POOL_DIRECTORY, PHP_SERVICE
|
||||||
|
|
||||||
STATE_DIRECTORY = Path("/var/lib/coulobre/web-node")
|
STATE_DIRECTORY = Path("/var/lib/coulobre/web-node")
|
||||||
WEB_ROOT = Path("/srv/coulobre/web")
|
WEB_ROOT = Path("/srv/coulobre/web")
|
||||||
APACHE_AVAILABLE = Path("/etc/apache2/sites-available")
|
APACHE_AVAILABLE = Path("/etc/apache2/sites-available")
|
||||||
APACHE_ENABLED = Path("/etc/apache2/sites-enabled")
|
APACHE_ENABLED = Path("/etc/apache2/sites-enabled")
|
||||||
PHP_POOL_DIRECTORY = Path("/etc/php/8.5/fpm/pool.d")
|
|
||||||
PHP_SERVICE = "php8.5-fpm"
|
|
||||||
SITE_SHELL = "/usr/sbin/nologin"
|
SITE_SHELL = "/usr/sbin/nologin"
|
||||||
|
|
||||||
|
|
||||||
@@ -322,7 +321,7 @@ def install_configurations(
|
|||||||
)
|
)
|
||||||
enable_apache_site(apache, enabled, created)
|
enable_apache_site(apache, enabled, created)
|
||||||
|
|
||||||
run("/usr/sbin/php-fpm8.5", "--test")
|
run(PHP_FPM_BINARY, "--test")
|
||||||
run("/usr/sbin/apache2ctl", "configtest")
|
run("/usr/sbin/apache2ctl", "configtest")
|
||||||
reload_attempts.append(PHP_SERVICE)
|
reload_attempts.append(PHP_SERVICE)
|
||||||
run("/usr/sbin/service", PHP_SERVICE, "reload")
|
run("/usr/sbin/service", PHP_SERVICE, "reload")
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ def change_php_pool(paths, old, wanted):
|
|||||||
replace_pool_file(paths.pool, wanted)
|
replace_pool_file(paths.pool, wanted)
|
||||||
reload_attempted = False
|
reload_attempted = False
|
||||||
try:
|
try:
|
||||||
web.run("/usr/sbin/php-fpm8.5", "--test")
|
web.run(web.PHP_FPM_BINARY, "--test")
|
||||||
reload_attempted = True
|
reload_attempted = True
|
||||||
reload_php_pool(paths.socket)
|
reload_php_pool(paths.socket)
|
||||||
except (OSError, ValueError, KeyboardInterrupt) as error:
|
except (OSError, ValueError, KeyboardInterrupt) as error:
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ def detach_site(site, paths, key_file, apache, retirement):
|
|||||||
for path, _, _, label in apache:
|
for path, _, _, label in apache:
|
||||||
archive_path(path, retirement.directory / label)
|
archive_path(path, retirement.directory / label)
|
||||||
archive_path(paths.pool, retirement.directory / "php-pool")
|
archive_path(paths.pool, retirement.directory / "php-pool")
|
||||||
web.run("/usr/sbin/php-fpm8.5", "--test")
|
web.run(web.PHP_FPM_BINARY, "--test")
|
||||||
web.run("/usr/sbin/service", web.PHP_SERVICE, "reload")
|
web.run("/usr/sbin/service", web.PHP_SERVICE, "reload")
|
||||||
archive_path(key_file, retirement.directory / "authorized-keys")
|
archive_path(key_file, retirement.directory / "authorized-keys")
|
||||||
archive_data_directory(
|
archive_data_directory(
|
||||||
|
|||||||
Reference in new issue
Block a user