Previously, database migrations and seeding had to be run manually after
deployment, causing 500 errors on fresh deployments. This commit automates
the entire database setup process.
Changes to docker-entrypoint.sh:
- Wait for PostgreSQL to be ready before proceeding
- Run 'flask db upgrade' automatically on startup
- Check if database is already seeded (admin user exists)
- Run 'flask seed' only if needed (idempotent)
- Provides clear console output for each step
Changes to docker-compose.prod.yml:
- Bind to 0.0.0.0:5000 instead of 127.0.0.1:5000
- Allows access from reverse proxy on different machines
- Necessary for production deployments with external proxies
Benefits:
- Zero manual intervention required after 'docker-compose up'
- Idempotent: Safe to restart containers without data loss
- Works on fresh clones and existing deployments
- Clear logging for troubleshooting
Fixes:
- "relation users does not exist" error on login
- Manual migration/seeding requirement
- Network accessibility from external proxies
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Previously, the Dockerfile tried to copy the instance/ directory which is
gitignored and doesn't exist in fresh clones. This caused deployment to fail
with "instance/: not found" error.
Changes:
- Add docker-entrypoint.sh script to auto-generate JWT keys if missing
- Install openssl in container for key generation
- Remove COPY instance/ from Dockerfile (no longer needed)
- Create instance/ directory during build
- Set ENTRYPOINT to run initialization script before starting Gunicorn
This allows the application to deploy successfully on fresh clones without
requiring manual JWT key generation.
Fixes deployment issue on production servers.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>