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(-)
5.2 KiB
Local Testing with SQLite
This document explains how to run TimeTracker locally for testing using SQLite instead of PostgreSQL.
Overview
The local test environment uses:
- SQLite database instead of PostgreSQL (no separate database container needed)
- Development mode with debug logging enabled
- Local data persistence through Docker volumes
- Simplified setup for quick testing and development
Quick Start
Option 1: Using Scripts (Recommended)
Windows:
scripts\start-local-test.bat
Linux/macOS:
./scripts/start-local-test.sh
PowerShell:
.\scripts\start-local-test.ps1
Option 2: Manual Docker Compose
docker-compose -f docker-compose.local-test.yml up --build
Configuration
The local test environment uses these key settings:
- Database: SQLite at
/data/timetracker.db(persisted in Docker volume) - Port: 8080 (same as production)
- Environment: Development mode with debug enabled
- Security: Secure cookies disabled for local testing
- Logs: Available in
./logs/directory
Environment Variables
You can override default settings using environment variables:
# Timezone
export TZ=Europe/Brussels
# Currency
export CURRENCY=EUR
# Admin users (comma-separated)
export ADMIN_USERNAMES=admin,testuser
# Secret key (change for security)
export SECRET_KEY=your-local-test-secret-key
# Start with custom settings
docker-compose -f docker-compose.local-test.yml up --build
Data Persistence
- SQLite database: Stored in Docker volume
app_data_local_test - Uploads: Stored in
/data/uploads(persisted in Docker volume) - Logs: Stored in
./logs/directory (mounted from host)
Stopping the Environment
# Stop containers
docker-compose -f docker-compose.local-test.yml down
# Stop and remove volumes (WARNING: This will delete all data)
docker-compose -f docker-compose.local-test.yml down -v
Accessing the Application
Once started, the application will be available at:
- URL: http://localhost:8080
- Health Check: http://localhost:8080/_health
Database Management
Viewing SQLite Database
You can access the SQLite database directly:
# Copy database from container to host
docker cp timetracker-app-local-test:/data/timetracker.db ./local-db.sqlite
# Use sqlite3 command line tool
sqlite3 local-db.sqlite
# Or use any SQLite browser tool
Resetting Database
To start with a fresh database:
# Stop and remove volumes
docker-compose -f docker-compose.local-test.yml down -v
# Start again
docker-compose -f docker-compose.local-test.yml up --build
Troubleshooting
Container Won't Start
-
Check Docker is running:
docker info -
Check port 8080 is available:
netstat -an | grep 8080 -
View container logs:
docker-compose -f docker-compose.local-test.yml logs app
Database Issues
-
Check database file exists:
docker exec timetracker-app-local-test ls -la /data/ -
Reset database:
docker-compose -f docker-compose.local-test.yml down -v docker-compose -f docker-compose.local-test.yml up --build
Permission Issues
The local test setup includes a custom entrypoint that automatically handles permissions. If you still encounter issues:
# Check container logs for permission errors
docker-compose -f docker-compose.local-test.yml logs app
# If needed, fix permissions manually
docker exec timetracker-app-local-test chown -R timetracker:timetracker /data
Entrypoint Issues
If you encounter issues with the entrypoint script (like su-exec: not found), you can use the simplified entrypoint:
-
Edit docker-compose.local-test.yml and change the entrypoint line:
# Change this line: entrypoint: ["/app/docker/entrypoint-local-test.sh"] # To this: entrypoint: ["/app/docker/entrypoint-local-test-simple.sh"] -
Restart the container:
docker-compose -f docker-compose.local-test.yml down docker-compose -f docker-compose.local-test.yml up --build
The simplified entrypoint runs everything as root, which avoids user switching issues but is less secure (fine for local testing).
Differences from Production
| Feature | Local Test | Production |
|---|---|---|
| Database | SQLite | PostgreSQL |
| Debug Mode | Enabled | Disabled |
| Secure Cookies | Disabled | Enabled |
| Data Volume | app_data_local_test |
app_data |
| Container Name | timetracker-app-local-test |
timetracker-app |
Development Tips
- Hot Reload: The development environment supports hot reloading for Python changes
- Logs: Check
./logs/timetracker.logfor detailed application logs - Database: Use SQLite browser tools for easier database inspection
- Testing: This environment is perfect for testing new features before production deployment
Security Note
⚠️ Important: This local test environment is configured for development only:
- Secure cookies are disabled
- Debug mode is enabled
- Uses a default secret key
Never use these settings in production!