This guide will help you deploy Skyvern on Railway with the optimized configuration.
- A Railway account (sign up at railway.app)
- A PostgreSQL database (Railway provides this)
- API keys for your preferred LLM provider (OpenAI, Anthropic, etc.)
- Go to railway.app and create a new project
- Choose "Deploy from GitHub repo" and select your Skyvern repository
- Railway will automatically detect the
railway.tomlconfiguration
- In your Railway project dashboard, click "New Service"
- Select "Database" → "PostgreSQL"
- Railway will automatically create a PostgreSQL instance and set the
DATABASE_URLenvironment variable
Add the following environment variables in your Railway project settings:
# Database (automatically set by Railway PostgreSQL service)
DATABASE_URL=postgresql://username:password@host:port/database
# LLM Provider (choose one or more)
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key
GEMINI_API_KEY=your_gemini_api_key
# LLM Configuration
ENABLE_OPENAI=true
LLM_KEY=OPENAI_GPT4O
# OR for Anthropic
# ENABLE_ANTHROPIC=true
# LLM_KEY=ANTHROPIC_CLAUDE3.5_SONNET# Browser Configuration
BROWSER_TYPE=chromium-headless
ENABLE_CODE_BLOCK=true
# Bitwarden Integration (optional)
BITWARDEN_CLIENT_ID=your_bitwarden_client_id
BITWARDEN_CLIENT_SECRET=your_bitwarden_client_secret
BITWARDEN_MASTER_PASSWORD=your_bitwarden_master_password
# AWS Integration (optional)
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_REGION=us-west-2- Push your code to GitHub (if not already done)
- Railway will automatically build and deploy using the
Dockerfile.railway - The deployment process will:
- Build the Docker image with optimized dependencies
- Run database migrations
- Start the Skyvern application
- Set up the virtual display for browser automation
Once deployed, Railway will provide you with a public URL. You can access:
- API:
https://your-app.railway.app/api/v1 - Health Check:
https://your-app.railway.app/api/v1/health
- Properly initialized the
artifactsmodule inskyvern/client/artifacts/__init__.py - This resolves the import error that was causing deployment failures
- Uses multi-stage build for smaller image size
- Optimized for Railway's ephemeral filesystem
- Uses
/tmpdirectories for temporary files - Includes all necessary system dependencies for browser automation
- Automatically converts Railway's
DATABASE_URLto Skyvern's expectedDATABASE_STRING - Uses Railway's provided
PORTenvironment variable - Configures headless browser mode for better performance
- Uses
chromium-headlessbrowser type for lower memory usage - Optimized virtual display setup
- Proper cleanup on container shutdown
-
Database Connection Errors
- Ensure the PostgreSQL service is running in Railway
- Check that
DATABASE_URLis properly set
-
Browser Automation Issues
- The deployment uses headless Chrome which should work in Railway's environment
- If you encounter issues, check the logs for Xvfb startup messages
-
Memory Issues
- Railway's free tier has memory limits
- Consider upgrading to a paid plan for production workloads
- Monitor memory usage in Railway's metrics dashboard
-
Build Timeouts
- The initial build may take 10-15 minutes due to Playwright browser installation
- Subsequent builds will be faster due to Docker layer caching
Access logs through Railway's dashboard:
- Go to your project in Railway
- Click on your service
- Navigate to the "Logs" tab
The application includes a health check endpoint at /api/v1/health that Railway uses to monitor the service status.
For production deployments:
- Database: Use Railway's PostgreSQL with appropriate resources
- Memory: Ensure adequate memory allocation for browser automation
- Storage: Use external storage (S3) for artifacts and videos
- Monitoring: Set up proper logging and monitoring
- Never commit API keys to your repository
- Use Railway's environment variables for all sensitive data
- Consider using Railway's private networking for database connections
- Regularly rotate API keys and credentials
If you encounter issues:
- Check the Railway deployment logs
- Review the Skyvern documentation
- Open an issue on the Skyvern GitHub repository