-
Notifications
You must be signed in to change notification settings - Fork 3.3k
improvement(db): remove vercel, remove railway, remove crons, improve DB connection config #1519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… DB connection config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This PR implements a comprehensive infrastructure cleanup that removes dependencies on Vercel and Railway deployment platforms while standardizing database connection configuration. The changes eliminate platform-specific environment variables, configuration files, and cron jobs in favor of a more streamlined, Docker-based deployment approach.The core changes include:
- Database Connection Standardization: All database connections now use
DATABASE_URLexclusively, removing thePOSTGRES_URLfallback that was previously used for Railway compatibility. This affects the main database client (packages/db/index.ts), socket server operations, and various scripts throughout the codebase. - Platform Configuration Removal: Complete removal of
vercel.jsonandrailway.jsonconfiguration files, eliminating scheduled cron jobs (schedule execution, email webhook polling, log cleanup) and platform-specific deployment settings. - Environment Variable Cleanup: Removal of Vercel-specific variables like
NEXT_PUBLIC_VERCEL_URLfrom CORS configurations and@vercel/analyticsdependency from package.json. - Database Connection Improvements: Enhanced connection pooling (increased max connections from 60 to 80), added development-mode connection caching to prevent pool exhaustion during hot reloads, and simplified connection string validation.
These changes align with a move toward container-based deployments using Docker, as evidenced by the existing Dockerfile configurations. The removal of Vercel cron jobs suggests migration to an alternative scheduling system like Trigger.dev, which is already configured in the environment variables.
Important Files Changed
Changed Files
| Filename | Score | Overview |
|---|---|---|
vercel.json |
3/5 | Complete removal of Vercel cron configuration eliminating 5 scheduled jobs including schedule execution and webhook polling |
railway.json |
5/5 | Complete removal of Railway deployment configuration for socket server |
packages/db/index.ts |
4/5 | Standardized database connection to use only DATABASE_URL, increased max connections to 80, added dev connection caching |
packages/db/drizzle.config.ts |
4/5 | Simplified database URL configuration removing POSTGRES_URL fallback |
apps/sim/lib/env.ts |
4/5 | Removed optional POSTGRES_URL environment variable from server configuration |
apps/sim/lib/auth-client.ts |
4/5 | Simplified base URL function removing Vercel-specific environment handling |
apps/sim/socket-server/config/socket.ts |
5/5 | Removed NEXT_PUBLIC_VERCEL_URL from CORS allowed origins |
apps/sim/socket-server/rooms/manager.ts |
4/5 | Standardized database connection to use only DATABASE_URL |
apps/sim/socket-server/database/operations.ts |
5/5 | Removed POSTGRES_URL fallback from database connection string |
apps/sim/app/workspace/[workspaceId]/knowledge/hooks/use-knowledge-upload.ts |
4/5 | Removed VERCEL_MAX_BODY_SIZE constant while maintaining 4MB upload threshold |
packages/db/scripts/register-sso-provider.ts |
4/5 | Standardized to use DATABASE_URL only for database connections |
package.json |
4/5 | Removed @vercel/analytics dependency as part of Vercel cleanup |
.devcontainer/docker-compose.yml |
5/5 | Removed redundant POSTGRES_URL environment variable |
docker/app.Dockerfile |
5/5 | Removed redundant POSTGRES_URL from Docker build environment |
Confidence score: 3/5
- This PR introduces significant infrastructure changes that could break existing deployments relying on Vercel cron jobs or Railway-specific configurations
- Score reflects the high-impact nature of removing critical scheduled tasks like webhook polling and log cleanup without clear migration path documented
- Pay close attention to
vercel.jsonremoval as it eliminates 5 scheduled cron jobs that may be critical for application functionality
Sequence Diagram
sequenceDiagram
participant User
participant DevContainer as "Dev Container"
participant App as "Sim App"
participant SocketServer as "Socket Server"
participant DB as "PostgreSQL Database"
participant Realtime as "Realtime Service"
participant Storage as "Cloud Storage"
User->>DevContainer: "Start development environment"
DevContainer->>DB: "Start PostgreSQL with pgvector"
DB-->>DevContainer: "Database ready"
DevContainer->>App: "Run migrations"
App->>DB: "CREATE/ALTER tables"
DB-->>App: "Migration complete"
DevContainer->>App: "Start application on port 3000"
DevContainer->>Realtime: "Start realtime service on port 3002"
DevContainer->>SocketServer: "Start socket server on port 3001"
User->>App: "Upload knowledge files"
App->>Storage: "Get presigned URLs"
Storage-->>App: "Return upload URLs"
App->>Storage: "Upload files directly"
Storage-->>App: "Files uploaded"
App->>DB: "Store file metadata"
User->>App: "Join workflow room"
App->>SocketServer: "Connect to workflow"
SocketServer->>DB: "Get workflow state"
DB-->>SocketServer: "Return workflow data"
SocketServer-->>App: "Workflow state synchronized"
User->>App: "Modify workflow blocks"
App->>SocketServer: "Send workflow changes"
SocketServer->>DB: "Persist block operations"
SocketServer->>App: "Broadcast to other users"
Additional Comments (1)
-
apps/sim/app/workspace/[workspaceId]/knowledge/hooks/use-knowledge-upload.ts, line 213 (link)style: The error message still mentions 4MB limit but no longer references the specific platform constraint. Consider updating the error message to be more generic about the API route limitation.
14 files reviewed, 1 comment
Summary
Type of Change
Testing
Manually,
Checklist