Feature #55
openFeature #33: Canofy Control Centre Backend Development
Feature #46: Canofy Control Centre Onboarding Process
# [CANOFY-109] Bootstrap Server (apt, MariaDB, Node, Redis)
0%
Description
[CANOFY-109] Bootstrap Server (apt, MariaDB, Node, Redis)¶
Type: Story
Epic: New Client Onboarding — Automated AWS + Frappe Provisioning
Stage key: server_bootstrap (pipeline stage 9 of 15)
Component: utils/onboarding_executor.py, utils/ssm_client.py
User Story¶
As an operations engineer,
I want the base OS packages and system services a Frappe bench needs
installed and configured automatically over SSM,
so that every client server has an identical, correctly-configured
foundation (MariaDB charset/collation, Node version, Redis) without manual
per-server setup.
Description¶
Execute, via SSM (no SSH, ever), in sequence:
-
apt update && apt upgrade -y(non-interactive). - Install: git, curl, build tools, wkhtmltopdf, nginx, supervisor,
mariadb-server/client, and other bench prerequisites. - Install Node 18 + yarn.
- Install Redis.
- Write MariaDB's
utf8mb4/innodbconfig viatee(not an interactive
editor). - Restart MariaDB, then secure it non-interactively: set root password,
remove anonymous users, remove thetestdatabase, flush privileges —
equivalent tomysql_secure_installationbut scriptable.
The generated MariaDB root password must be produced fresh per server
(never reused, never hardcoded) and handed to stage 10 for site creation,
then stored in the Credential vault.
Configuration / Prerequisites¶
- Depends on stage 8 (SSM online).
- Base AMI must be Ubuntu 22.04 (or whatever OS version the bootstrap
commands target) — a mismatched OS breaks every command in this stage.
Acceptance Criteria¶
-
All commands run non-interactively (no step can block waiting for a
TTY prompt — this is a hard requirement since SSM has no interactive
terminal). -
MariaDB's collation/charset config matches what Frappe requires
(utf8mb4,utf8mb4_unicode_ci). -
MariaDB root password is randomly generated, never logged in plaintext
anywhere (SSM command output, Frappe logs,Onboarding Request.error_log). -
testdatabase and anonymous MySQL users are removed. - Node/Redis versions match what the target Frappe version requires.
Test Cases¶
| ID | Scenario | Steps | Expected Result |
|---|---|---|---|
| TC-1 | Happy path | Run stage on a fresh Ubuntu 22.04 instance | All packages install; MariaDB, Redis, nginx, supervisor all running afterward |
| TC-2 | No plaintext password leak | Search stage output/logs/error_log for the generated MariaDB password after the run | Not found anywhere in plaintext |
| TC-3 | MariaDB security | Attempt to connect to MariaDB as an anonymous user, or query the test database |
Both fail — anonymous users and test db removed |
| TC-4 | Charset correctness | Query MariaDB's default charset/collation after config | Matches utf8mb4/utf8mb4_unicode_ci
|
| TC-5 | Idempotent re-run | Retry this stage after a downstream failure |
apt commands don't fail on "already installed"; MariaDB re-securing doesn't fail on "password already changed" |
| TC-6 | Command failure surfaces clearly | Simulate an apt package install failure (e.g. mirror unreachable) | Stage fails with the actual apt error text surfaced, not a generic "exit status 1" |
No data to display