3.7 KiB
3.7 KiB
Quick Deployment Guide - Timezone Fix
For Production Server
-
SSH into your server where Docker is running
-
Navigate to project directory
cd /path/to/panel -
Pull latest code (includes timezone fixes)
git pull origin main -
Stop running containers
docker-compose -f docker-compose.prod.yml down -
Rebuild Docker images (this is critical - it bakes in the timezone configuration)
docker-compose -f docker-compose.prod.yml build --no-cache -
Start containers
docker-compose -f docker-compose.prod.yml up -d -
Verify timezone is correct
# Check container timezone docker-compose -f docker-compose.prod.yml exec app date # Should show Polish time with CEST/CET timezone # Example output: # Sat Oct 4 19:45:00 CEST 2025 -
Test the fix
- Post a new note at a known time (e.g., 19:45)
- Verify it displays the same time (19:45)
- Test both project notes and task notes
What Changed
Code Changes
- ✅ Fixed
datetime('now', 'localtime')in all database queries - ✅ Updated display formatters to use Europe/Warsaw timezone
- ✅ Fixed note display in components
Docker Changes (Critical!)
- ✅ Set
ENV TZ=Europe/Warsawin Dockerfile - ✅ Configured system timezone in containers
- ✅ Added TZ environment variable to docker-compose files
Why Rebuild is Necessary
The timezone configuration is baked into the Docker image during build time:
ENV TZ=Europe/Warsaw- Set during image buildRUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime- Executed during image build
Just restarting containers (docker-compose restart) will NOT apply these changes!
Troubleshooting
If times are still wrong after deployment:
-
Verify you rebuilt the images
docker images | grep panel # Check the "CREATED" timestamp - should be recent -
Check if container has correct timezone
docker-compose -f docker-compose.prod.yml exec app dateShould show Polish time, not UTC!
-
Check SQLite is using correct time
docker-compose -f docker-compose.prod.yml exec app node -e "const db = require('better-sqlite3')('./data/database.sqlite'); console.log(db.prepare(\"SELECT datetime('now', 'localtime') as time\").get());"Should show current Polish time
-
Force rebuild if needed
docker-compose -f docker-compose.prod.yml down docker system prune -f docker-compose -f docker-compose.prod.yml build --no-cache docker-compose -f docker-compose.prod.yml up -d
Expected Behavior After Fix
Before Fix (Docker in UTC):
User posts note at 10:30 Poland time
→ Docker sees 08:30 UTC as "local time"
→ SQLite stores: 08:30
→ Display shows: 08:30 ❌ (2 hours off!)
After Fix (Docker in Europe/Warsaw):
User posts note at 10:30 Poland time
→ Docker sees 10:30 Poland time as "local time"
→ SQLite stores: 10:30
→ Display shows: 10:30 ✅ (correct!)
Important Notes
- Old notes: Notes created before this fix may still show incorrect times (they were stored in UTC)
- New notes: All new notes after deployment will show correct times
- Audit logs: Continue to work correctly (they always used ISO format)
- Zero downtime: Can't achieve - need to stop/rebuild/start containers
Quick Check Command
After deployment, run this one-liner to verify everything:
docker-compose -f docker-compose.prod.yml exec app sh -c 'date && node -e "console.log(new Date().toLocaleString(\"pl-PL\"))"'
Both outputs should show the same Polish time!