mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2025-12-31 08:19:45 -06:00
- Improve web interface layout for better user-friendliness and mobile responsiveness * Update CSS variables for consistent spacing and component sizing * Enhance card layouts with improved padding, borders, and shadows * Optimize button and form element dimensions for better touch targets * Add hover effects and animations for improved user interaction * Implement responsive grid system with mobile-first approach - Refactor mobile JavaScript to prevent duplicate initialization * Consolidate mobile enhancements into dedicated utility classes * Add initialization guards to prevent double loading * Implement MobileUtils and MobileNavigation classes * Remove duplicate event listeners and mobile enhancements - Fix circular import issue in logo handling * Replace problematic 'from app import app' with Flask's current_app * Add error handling for cases where current_app is unavailable * Improve logo path resolution with fallback mechanisms * Fix settings model to use proper Flask context - Clean up template code and remove duplication * Remove duplicate mobile enhancements from base template * Clean up dashboard template JavaScript * Centralize all mobile functionality in mobile.js * Add proper error handling and debugging - Update CSS variables and spacing system * Introduce --section-spacing and --card-spacing variables * Add mobile-specific spacing variables * Improve border-radius and shadow consistency * Enhance typography and visual hierarchy This commit resolves the double loading issue and logo import errors while significantly improving the overall user experience and mobile responsiveness of the web interface.
83 lines
2.6 KiB
Plaintext
83 lines
2.6 KiB
Plaintext
# Docker Database Initialization
|
|
|
|
This directory contains scripts and configuration for the TimeTracker Docker setup with automatic database initialization.
|
|
|
|
## Overview
|
|
|
|
The Docker setup now includes automatic database connection checking and initialization:
|
|
|
|
1. **Database Connection Check**: The app waits for the PostgreSQL database to be ready
|
|
2. **Initialization Check**: Verifies if the database has the required tables
|
|
3. **Automatic Initialization**: If needed, runs the Python initialization script to create tables and default data
|
|
|
|
## Files
|
|
|
|
### `start.sh`
|
|
Main startup script that:
|
|
- Waits for database connection
|
|
- Checks if database is initialized
|
|
- Runs initialization if needed
|
|
- Starts the Flask application
|
|
|
|
### `init-database.py`
|
|
Python script that:
|
|
- Connects to the database
|
|
- Creates all required tables using SQLAlchemy models
|
|
- Creates default admin user, settings, and project
|
|
- Handles errors gracefully
|
|
|
|
### `test-db.py`
|
|
Utility script to test database connectivity and show initialization status.
|
|
|
|
### `init.sql` and `init-db.sh`
|
|
Legacy initialization scripts (kept for reference, not used by default).
|
|
|
|
## How It Works
|
|
|
|
1. **Docker Compose** starts the PostgreSQL container
|
|
2. **Health Check** ensures PostgreSQL is ready
|
|
3. **App Container** waits for database to be healthy
|
|
4. **Startup Script** checks database connection
|
|
5. **Initialization Check** verifies required tables exist
|
|
6. **Python Script** creates tables and default data if needed
|
|
7. **Flask App** starts normally
|
|
|
|
## Environment Variables
|
|
|
|
The following environment variables are used:
|
|
|
|
- `DATABASE_URL`: PostgreSQL connection string
|
|
- `ADMIN_USERNAMES`: Comma-separated list of admin usernames
|
|
- `TZ`: Timezone setting
|
|
- `CURRENCY`: Currency setting
|
|
- `ROUNDING_MINUTES`: Time rounding setting
|
|
|
|
## Testing
|
|
|
|
To test the database setup manually:
|
|
|
|
```bash
|
|
# Test database connection and status
|
|
docker exec timetracker-app python /app/docker/test-db.py
|
|
|
|
# Manually initialize database (if needed)
|
|
docker exec timetracker-app python /app/docker/init-database.py
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Database Connection Issues
|
|
- Check if PostgreSQL container is running: `docker ps`
|
|
- Check PostgreSQL logs: `docker logs timetracker-db`
|
|
- Verify environment variables are set correctly
|
|
|
|
### Initialization Issues
|
|
- Check app container logs: `docker logs timetracker-app`
|
|
- Verify database permissions
|
|
- Check if tables exist: `docker exec timetracker-db psql -U timetracker -d timetracker -c "\dt"`
|
|
|
|
### Health Check Failures
|
|
- Ensure the `/_health` endpoint is accessible
|
|
- Check if the app is binding to the correct port
|
|
- Verify network connectivity between containers
|