feat: implement license platform business flows and delivery tooling
Some checks failed
Check / delivery-static (push) Has been cancelled
Check / api (push) Has been cancelled
Check / web (push) Has been cancelled

Add admin and customer interfaces, orders, signed activation and leases, protected package delivery, keyring verification, migrations, security controls, tests and deployment documentation.

Co-Authored-By: Craft Agent <agents-noreply@craft.do>
This commit is contained in:
2026-10-09 15:33:22 +08:00
parent 3ab651d3a8
commit 54c318c615
142 changed files with 11105 additions and 178 deletions

100
compose.yaml Normal file
View File

@@ -0,0 +1,100 @@
# Local delivery rehearsal only. Not a production security profile.
name: license-platform-dev
services:
mysql:
image: mysql:8.0
environment:
MYSQL_DATABASE: license_platform
MYSQL_USER: license_app
MYSQL_PASSWORD_FILE: /run/secrets/mysql_app
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql_root
secrets: [mysql_app, mysql_root]
volumes: [mysql_data:/var/lib/mysql]
networks: [private]
healthcheck:
test: [CMD-SHELL, 'MYSQL_PWD=$$(cat /run/secrets/mysql_app) mysql -h 127.0.0.1 -u license_app license_platform -e "SELECT 1" >/dev/null 2>&1']
interval: 5s
timeout: 5s
retries: 30
redis:
profiles: [cache]
image: redis:7-alpine
command: [redis-server, --save, '', --appendonly, 'no']
networks: [private]
healthcheck:
test: [CMD, redis-cli, ping]
interval: 5s
timeout: 3s
retries: 10
api:
build:
context: .
dockerfile: deploy/Dockerfile.api
environment:
HTTP_ADDR: 0.0.0.0:18080
HTTP_TRUSTED_PROXY_CIDRS: ${HTTP_TRUSTED_PROXY_CIDRS:-}
SESSION_COOKIE_SECURE: ${SESSION_COOKIE_SECURE:-false}
MYSQL_PASSWORD_FILE: /run/secrets/mysql_app
LICENSE_SIGNING_PRIVATE_KEY_FILE: /run/secrets/signing_key
PACKAGE_STORAGE_ROOT: /srv/license-packages
GIN_MODE: release
METRICS_ADDR: 127.0.0.1:19090
ENTRY_LIMIT_MODE: ${ENTRY_LIMIT_MODE:-redis}
ENTRY_REDIS_ADDR: ${ENTRY_REDIS_ADDR:-}
ENTRY_REDIS_NAMESPACE: ${ENTRY_REDIS_NAMESPACE:-license-platform:entry:}
secrets: [mysql_app, signing_key]
volumes:
- type: bind
source: ${PACKAGE_STORAGE_HOST:?Set an absolute trusted existing package directory}
target: /srv/license-packages
bind:
create_host_path: false
read_only: true
tmpfs: [/tmp]
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
networks: [private]
depends_on:
mysql: {condition: service_healthy}
healthcheck:
test: [CMD, wget, -q, -O, /dev/null, 'http://127.0.0.1:19090/api/v1/health/ready']
interval: 5s
timeout: 3s
retries: 10
migrate:
extends: api
profiles: [tools]
command: [/app/migrate, up]
healthcheck: {disable: true}
web:
build:
context: .
dockerfile: deploy/Dockerfile.web
ports: ['127.0.0.1:18083:8080']
volumes:
- type: bind
source: ${PACKAGE_STORAGE_HOST:?Set an absolute trusted existing package directory}
target: /srv/license-packages
read_only: true
bind:
create_host_path: false
depends_on:
api: {condition: service_healthy}
networks: [private, edge]
healthcheck:
test: [CMD, wget, -q, -O, /dev/null, 'http://127.0.0.1:8080/api/v1/health/live']
interval: 5s
timeout: 3s
retries: 10
networks:
private: {internal: true}
edge: {}
volumes:
mysql_data: {}
secrets:
mysql_app:
file: ${MYSQL_APP_SECRET_FILE:?Set protected app database password file}
mysql_root:
file: ${MYSQL_ROOT_SECRET_FILE:?Set protected root database password file}
signing_key:
file: ${LICENSE_SIGNING_KEY_HOST_FILE:?Set protected persistent P256 PEM file}