Feature #59
openFeature #33: Canofy Control Centre Backend Development
Feature #46: Canofy Control Centre Onboarding Process
# [CANOFY-113] Configure Frappe Application Settings
0%
Description
[CANOFY-113] Configure Frappe Application Settings¶
Type: Story
Epic: New Client Onboarding — Automated AWS + Frappe Provisioning
Stage key: frappe_config (pipeline stage 13 of 15)
Component: utils/onboarding_executor.py
Reference: Canofy-Frappe Production Instance Setup runbook, sections
1.1–2.2
User Story¶
As an operations engineer,
I want the freshly-provisioned site's de-branding, security, and
attachment/S3 configuration applied automatically via REST calls,
so that I no longer have to manually work through the Production
Instance Setup spreadsheet's Website Settings / System Settings / Navbar
Settings / Attachment records / S3 config steps for every client.
Description¶
Log in as Administrator (session-cookie auth — plain HTTP Basic Auth with
the account password does not work against modern Frappe REST endpoints)
and, over REST, apply:
Website Settings
-
app_name = "Canofy". - Upload branding images (App Logo, Brand Image, Splash Image, FavIcon) from
a known local asset path and set the corresponding fields
(app_logo,banner_image,splash_image,favicon). Skip + log
(non-fatal) any asset file that isn't present, rather than uploading a
placeholder as a client's real logo.
System Settings
-
session_expiry = "00:30". - Disable "login with email link".
- Enable "allow login using username".
- Set consecutive-attempt and lockout-duration limits (3 attempts, 120s
lockout). - Enable onboarding, enable "one session per user".
- A fresh site's
language/time_zoneare blank and mandatory — both must
be set together, first, before any other System Settings field, because
frappe.client.set_valuevalidates the whole document on save.
Attachments — doctype name is Attachments, not "Attachment List."
Each record needs a child table (attachments_required_for, child doctype
Attachments Required For, field doctype_name) — not a flat
comma-separated string. Records to create:
| attachment_name | attachments_required_for |
|---|---|
| AWB_HBL | Bill of Entry, FTWZ BOE, FTWZ DTA |
| Invoice | Bill of Entry, FTWZ BOE, FTWZ DTA |
| Bill of Entry | Bill of Entry, FTWZ BOE, FTWZ DTA |
| Packing List | Bill of Entry, FTWZ BOE, FTWZ DTA |
| Attachment Type | Bill of Entry (only — not all three) |
S3 File Settings — doctype name is S3 File Settings, not "S3 File
Attachment." Three fields, not one:
-
bucket_name= the site's own domain (site_name), not the physical
S3 bucket name created in stage 5. -
region_name= the request's AWS region. -
folder_name= the client'sclient_code.
Navbar Settings
- Help dropdown: hide "About" and "Frappe Support", add an "About Canofy"
action item (frappe.ui.toolbar.show_custom_about()).
Configuration / Prerequisites¶
- Depends on stage 10 (Administrator password) and stage 12 (site
reachable — either via real HTTPS or the IP-override fallback). - Branding asset PNGs must exist at a known path (e.g.
canofy_control_centre/public/images/branding/{app_logo,brand_image, splash_image,favicon}.png) for the upload sub-step to do anything. -
Canofy Client.client_codemust be set (used forfolder_name).
Acceptance Criteria¶
-
Every sub-step targets the real doctype names verified against a live
site (Attachments,S3 File Settings) — not the names as originally
spec'd in the runbook, which don't exist. -
Attachmentsrecords post with correctly structured child table rows,
one per required doc type, not a flat string. -
Attachment Type's required-for list is scoped toBill of Entry
only. -
S3 File Settingshas all three fields set correctly, with
bucket_name= site domain -
A missing branding asset file is skipped with a clear log line, never
silently ignored and never causes a placeholder upload. -
System Settings'
language/time_zoneare set before any other field
on that doctype, soMandatoryErrornever blocks the rest of the
stage. -
Every sub-step failure is caught and logged individually — one
sub-step failing (e.g. an Attachments record) must not abort the
remaining sub-steps in this stage.
Test Cases¶
| ID | Scenario | Steps | Expected Result |
|---|---|---|---|
| TC-1 | Happy path, full run | Run stage against a freshly provisioned site with branding assets present | All sub-steps succeed: Website/System/Navbar Settings configured, 5 Attachments records created with correct child rows, S3 File Settings set, all 4 branding images uploaded |
| TC-2 | Attachments child table shape | Fetch a created Attachments record via REST after the stage |
attachments_required_for is a populated child table with correct doctype_name values, not a flat string field |
| TC-3 | Attachment Type scoping | Fetch the Attachment Type record |
attachments_required_for contains exactly one row: Bill of Entry
|
| TC-4 | S3 File Settings fields | Fetch S3 File Settings after the stage |
bucket_name = site domain, region_name = request's AWS region, folder_name = client code |
| TC-5 | Missing branding assets | Run stage with no PNG files present at the branding path | Stage completes successfully; output log shows 4 "skipped, not found" lines; Website Settings image fields remain unset |
| TC-6 | Partial failure isolation | Force one sub-step to fail (e.g. simulate a 500 on one Attachments record) | Stage output shows that one failure, but System Settings, Navbar Settings, and S3 File Settings still complete |
| TC-7 | Mandatory-field ordering | Run against a truly fresh site (blank language/time_zone) | No MandatoryError raised; language/time_zone set before any other System Settings field |
| TC-8 | Re-run via retry | Retry this stage after a prior partial failure | Settings are idempotently reapplied — no duplicate Attachments records created for names that already exist |
No data to display