62 lines
3.8 KiB
Markdown
62 lines
3.8 KiB
Markdown
# Backend deployment notes
|
|
|
|
Before saving any `secret=true` value in `sys_integration_config`, configure
|
|
`APP_INTEGRATION_ENCRYPTION_KEY` (preferably a randomly generated 32-byte or
|
|
longer secret) in the backend runtime environment. Do not commit the key or
|
|
place a real value in `src/main/resources/application.yml`.
|
|
|
|
## Payee bank-account protection
|
|
|
|
Before creating or changing a payee bank account, provide these runtime secrets:
|
|
|
|
- `APP_BANK_ACCOUNT_ENCRYPTION_KEYS`: comma-separated `version=Base64Key`
|
|
entries; every decoded AES key must be exactly 32 bytes. Keep old versions
|
|
present while old ciphertext still exists.
|
|
- `APP_BANK_ACCOUNT_ACTIVE_KEY_VERSION`: the version used for new ciphertext.
|
|
- `APP_BANK_ACCOUNT_FINGERPRINT_KEY`: a separate Base64-encoded 32-byte HMAC key.
|
|
|
|
Never reuse the integration key, JWT secret, database password, or an encryption
|
|
key as the fingerprint key. Keep all real values outside the repository.
|
|
|
|
For an existing database, apply
|
|
`V20261201_02__protect_payee_bank_accounts.sql` first. After a verified backup,
|
|
set `APP_BANK_ACCOUNT_LEGACY_BACKFILL_ENABLED=true` for one observed maintenance
|
|
run, then return it to `false`. The backfill is deliberately non-destructive: it
|
|
adds ciphertext, mask, fingerprint, and key version but does not clear the legacy
|
|
plaintext column. Final plaintext clearing requires a separate reviewed change,
|
|
explicit data-cleanup authorization, restore evidence, and post-change checks.
|
|
|
|
For rollout and operations of asynchronous Feishu directory synchronization,
|
|
see [`../financial_system_docs/feishu-directory-sync.md`](../financial_system_docs/feishu-directory-sync.md).
|
|
|
|
## Database contract
|
|
|
|
[`../financial_system_database/init_schema.sql`](../financial_system_database/init_schema.sql) is the clean-install
|
|
schema/bootstrap snapshot. Run it with a MySQL 8.4 LTS client only when
|
|
`finance_system` does not yet exist. It intentionally fails against an existing
|
|
or partial installation. The application keeps Hibernate `ddl-auto: validate`
|
|
and never changes the application-owned schema during startup. The optional,
|
|
explicitly authorized Kingdee table-preparation feature can create or alter only
|
|
its configured target tables; use a narrowly scoped DDL account for that action
|
|
or have a DBA pre-create those tables and keep the runtime account DML-only.
|
|
Existing installations use the closed manifest and chain runner documented in
|
|
[`../financial_system_docs/mysql-migration-runner.md`](../financial_system_docs/mysql-migration-runner.md), with
|
|
DBA review and staging rehearsal; never run the clean-install snapshot against them.
|
|
Deployment JDBC `serverTimezone` and `DB_TIME_ZONE` are both `UTC`. MySQL 8.4 LTS
|
|
is the runtime target; repository tests are not evidence of execution on a real
|
|
production-equivalent instance, so the exact manifest requires production-like rehearsal.
|
|
|
|
The clean-install snapshot creates built-in roles, groups, and group-role links,
|
|
but no person, default administrator, or personal group membership. Bootstrap the
|
|
first `SUPER_ADMIN` exactly once: the candidate first completes normal Feishu
|
|
login, two independent reviewers verify the immutable user ID and tenant against
|
|
the corporate directory, and a DBA runs an external, hashed, parameterized
|
|
transaction that adds only that `ACTIVE` user to `SUPER_ADMIN_GROUP`, checks the
|
|
affected row and unique membership, and records the evidence in the change ticket.
|
|
The candidate verifies `/api/auth/me`, the second reviewer closes the one-time
|
|
channel, and all later grants use normal IAM administration. Never store the
|
|
identity, script parameters, or secrets in the repository and never auto-promote
|
|
the first user. `LocalDataInitializer` is loaded only by the `local` profile, and
|
|
`finance.local-bootstrap.super-admin.enabled` defaults to `false`; neither the
|
|
profile nor the switch is permitted in production.
|