Fix multiple issues encountered during local Docker deployment: Docker Configuration: - Fix Dockerfile to handle package-lock.json properly (use npm install if missing) - Update .dockerignore to include package-lock.json in builds - Add docker/sync-models.js script to sync Sequelize models before migrations - Update docker-compose.yml to sync models before running migrations - Configure API to use port 3001 (to avoid conflict with port 3000) - Update docker-compose.yml to read PORT from .env file Database Configuration: - Update config/config.json for Docker environment (host: db, password: postgres) - Make migrations resilient by checking table existence before operations - Update all three migrations to skip if tables don't exist (tables created by model sync) Nginx Configuration: - Fix nginx.conf log format (body_size_sent -> body_bytes_sent) - Update nginx upstream to proxy to api:3001 instead of api:3000 Entrypoint Script: - Add model sync step to entrypoint.sh before migrations These changes ensure: - Containers start successfully without migration errors - Database tables are created via model sync before migrations run - Migrations are idempotent and can run on fresh databases - Port configuration is consistent across all services - Local development works with port 3001 to avoid conflicts
|
||
| 8 | 8 |
|
| 9 | 9 |
|
| 10 | 10 |
|
| 11 |
|
|
| 11 |
|
|
| 12 |
|
|
| 12 | 13 |
|
| 13 | 14 |
|
| 14 | 15 |
|
|
||
| 39 | 40 |
|
| 40 | 41 |
|
| 41 | 42 |
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 43 | 45 |
|
| 44 | 46 |
|
| 45 | 47 |
|
|
||
| 1 | 1 |
|
| 2 | 2 |
|
| 3 | 3 |
|
| 4 |
|
|
| 4 |
|
|
| 5 | 5 |
|
| 6 |
|
|
| 6 |
|
|
| 7 | 7 |
|
| 8 |
|
|
| 8 |
|
|
| 9 |
|
|
| 9 | 10 |
|
| 10 | 11 |
|
| 11 | 12 |
|
| 12 |
|
|
| 13 |
|
|
| 13 | 14 |
|
| 14 |
|
|
| 15 |
|
|
| 15 | 16 |
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 17 | 19 |
|
| 18 | 20 |
|
| 19 | 21 |
|
| 20 |
|
|
| 22 |
|
|
| 21 | 23 |
|
| 22 |
|
|
| 24 |
|
|
| 23 | 25 |
|
| 24 |
|
|
| 26 |
|
|
| 27 |
|
|
| 25 | 28 |
|
| 26 | 29 |
|
|
||
| 33 | 33 |
|
| 34 | 34 |
|
| 35 | 35 |
|
| 36 |
|
|
| 36 |
|
|
| 37 | 37 |
|
| 38 | 38 |
|
| 39 | 39 |
|
|
||
| 50 | 50 |
|
| 51 | 51 |
|
| 52 | 52 |
|
| 53 |
|
|
| 53 |
|
|
| 54 | 54 |
|
| 55 | 55 |
|
| 56 | 56 |
|
|
||
| 59 | 59 |
|
| 60 | 60 |
|
| 61 | 61 |
|
| 62 |
|
|
| 62 |
|
|
| 63 | 63 |
|
| 64 | 64 |
|
| 65 | 65 |
|
|
||
| 30 | 30 |
|
| 31 | 31 |
|
| 32 | 32 |
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 33 | 50 |
|
| 34 | 51 |
|
| 35 | 52 |
|
|
||
| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
|
||
| 3 | 3 |
|
| 4 | 4 |
|
| 5 | 5 |
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
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