feat: Remove license server and add multi-tenant SaaS infrastructure

BREAKING CHANGE: Removed legacy license server in favor of Stripe billing

Major changes:
- Remove license server system (563 lines removed from license_server.py)
- Add multi-tenant support with organizations and memberships
- Integrate Stripe billing and subscription management
- Enhance authentication with 2FA, password reset, and JWT tokens
- Add provisioning and onboarding flows for new customers
- Implement row-level security (RLS) for data isolation
- Add GDPR compliance features and data retention policies
- Enhance admin dashboard with billing reconciliation and customer management
- Add security scanning tools (Bandit, Gitleaks, GitHub Actions workflow)
- Implement rate limiting and enhanced password policies
- Update all routes to support organization context
- Enhance user model with billing and security fields
- Add promo code system for marketing campaigns
- Update Docker initialization for better database setup

Modified files:
- Core: app.py, app/__init__.py, app/config.py
- Models: Enhanced user model (+175 lines), updated all models for multi-tenancy
- Routes: Enhanced admin routes (+479 lines), updated all routes for org context
- Templates: Updated login, admin dashboard, and settings
- Docker: Enhanced database initialization scripts
- Dependencies: Added stripe, pyotp, pyjwt, and security packages

Deleted files:
- app/utils/license_server.py
- docs/LICENSE_SERVER_*.md (3 files)
- templates/admin/license_status.html
- test_license_server.py

New features:
- Organizations and membership management
- Stripe billing integration with webhook handling
- Enhanced authentication (2FA, password reset, refresh tokens)
- GDPR compliance and data export/deletion
- Onboarding checklist for new customers
- Promo code system
- Security enhancements (rate limiting, password policies)
- Admin tools for customer and billing management

Net change: 46 files changed, 1490 insertions(+), 1968 deletions(-)
This commit is contained in:
Dries Peeters
2025-10-07 22:06:19 +02:00
parent 3f4b273b18
commit 3b564f83d7
153 changed files with 33698 additions and 1974 deletions

View File

@@ -181,22 +181,6 @@ If you encounter issues with the entrypoint script (like `su-exec: not found`),
The simplified entrypoint runs everything as root, which avoids user switching issues but is less secure (fine for local testing).
### License Server Errors
If you see license server 404 errors, they should be automatically disabled in the local test environment. If you still see them:
1. **Verify environment variable is set**:
```bash
docker exec timetracker-app-local-test env | grep LICENSE_SERVER_ENABLED
```
2. **Should show**: `LICENSE_SERVER_ENABLED=false`
3. **If not set correctly, restart the container**:
```bash
docker-compose -f docker-compose.local-test.yml restart
```
## Differences from Production
| Feature | Local Test | Production |