# Backend deployment notes ## Configuration file-only deployment Runtime configuration is read from `./config/application.yml`. Spring Boot loads that file automatically when IDEA or the packaged JAR starts with the backend directory as its working directory; no environment variables or additional JVM arguments are required. Copy `config/application.example.yml` when preparing a new server and replace every `CHANGE_ME` value before startup. `config/application.yml` contains database credentials and cryptographic keys and is intentionally ignored by Git. Include it in the private deployment package, restrict its filesystem permissions to the service account, and never publish it to a source repository. The classpath `src/main/resources/application.yml` keeps fail-fast placeholders so a missing private configuration cannot silently start with shared credentials. Before saving any `secret=true` value in `sys_integration_config`, configure `app.integration-encryption-key` in the private configuration file with a random 32-byte-or-longer secret. ## Payee bank-account protection Before creating or changing a payee bank account, provide these values in the private configuration file: - `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 `database.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.