3.6 KiB
Local development
Use Python 3.12 or later. From the repository root, install the panel and its development tools in a virtual environment.
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/.
The local database defaults to db.sqlite3. Set COULOBRE_SQLITE_PATH to use a
different file. Keep COULOBRE_DEBUG for local development.
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.
celery -A coulobre worker --pool=solo
celery -A coulobre beat
Open an account in Hosting accounts and select 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 to find earlier previews. Each 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.
Run an isolated PHP test site
Open a completed preview for the account's current domain and select Download test bundle. 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 downloaded tar archive.
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.
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
ruff check .
ruff format --check .
python manage.py check
python manage.py makemigrations --check --dry-run
python manage.py test coulobre
git diff --check