fix(db,firehose): Fix database migration and profile creation race condition
This commit addresses two critical issues that were preventing the application from functioning correctly:
1. **Database Migration Failure:** The database migration script, which runs inside the Docker container on startup, was failing silently. The `drizzle.config.ts` file requires the `dotenv` package, but this was not included in the production Docker image because it is a dev dependency. This resulted in an empty database, causing all subsequent data operations to fail. The fix involves adding `dotenv` to the `npm install` command in the `Dockerfile`'s production stage.
2. **Profile Creation Race Condition:** The event processor (`server/services/event-processor.ts`) was creating user profiles with the user's DID as a placeholder for their handle. A separate `identity` event would later update the handle. This created a race condition where a profile could be requested by its handle before the handle was correctly set, leading to "Profile not found" errors. The fix is to proactively resolve the user's handle using the `didResolver` at the time of user creation in both the `ensureUser` and `processProfile` functions. This ensures the handle is correct from the moment the profile is indexed.
Together, these changes ensure that the database is correctly initialized and that user data is ingested reliably, resolving the user's reported issues.