This document contains instructions for deploying the Browser-use API on a VPS using Easypanel and Nixpacks 1.30.
- A VPS with Easypanel installed
- Basic knowledge of Git and Docker
- API keys for the language models you intend to use
- Clone this repository on your local machine or directly on the VPS
- Copy the
.env.examplefile to.envand fill in the required environment variables
Access the Easypanel panel installed on your VPS through your browser.
- Click on "Create project"
- Choose the "Website" or "Custom" option
- Fill in the project name (e.g., "browser-use-api")
- Configure the domain or subdomain to access the API
On the project configuration screen:
- Select Build from source
- Enter your Git repository URL (GitHub, GitLab, etc.)
- Under "Build settings," select Dockerfile as the builder (recommended)
- Alternatively, you can use Nixpacks with version 1.30 or higher
- Leave the "Start command" blank (the command is defined in Dockerfile/nixpacks.toml)
Configure resources according to the application's needs:
- CPU: At least 1 vCPU recommended
- RAM: Minimum of 2GB for proper operation
- Storage: 10GB or more
Configure the required environment variables:
- Go to the "Environment Variables" section
- Add all variables from your
.envfile - Ensure you add at least:
OPENAI_API_KEYor another required API key for the language modelGOOGLE_API_KEY- Required for Google Generative AIPORT(set to 8000)BROWSER_USE_HEADLESS=true- Recommended for greater stability in production
- Click "Deploy" to start the build and deployment process
- Monitor the logs to verify the build is running correctly
- Once completed, the API will be available at the configured domain
After deployment, test the API by sending an HTTP request to the /health endpoint:
curl https://your-domain.com/health If the response is {"status": "healthy"}, the API is working correctly.
To test full functionality, send a request to the /run endpoint:
curl -X POST https://your-domain.com/run \
-H "Content-Type: application/json" \
-d '{
"task": "Get the title of Google's homepage",
"llm_config": {
"provider": "openai",
"model_name": "gpt-4o",
"temperature": 0.0
},
"browser_config": {
"headless": true,
"disable_security": true
},
"max_steps": 5,
"use_vision": true
}' If the server gets stuck on messages like "Checking Playwright browser installation..." or "Starting server with xvfb-run..." for more than 10 minutes:
-
Check full logs: Use
docker logs -f container-nameto view all application logs and identify where it's stuck. -
Check system resources: Ensure the VPS has enough memory (minimum 2GB recommended). Playwright installation may fail silently if there isn't enough memory.
-
Enable pure headless mode:
- Add the environment variable
BROWSER_USE_HEADLESS=truein the project settings. - This will make the browser run in pure headless mode, without relying on Xvfb.
- Add the environment variable
-
Access the container and check status:
docker exec -it container-name bash ps aux # To view running processes kill -9 PID # To kill stuck processes if necessary
-
Restart the container: From the Easypanel dashboard, restart the application container.
-
Verify Playwright execution:
docker exec -it container-name bash python3 -c "from playwright.sync_api import sync_playwright; print('OK!' if sync_playwright().__enter__() else 'Failed')"
-
Last-resort solution: If nothing works, modify the
start.shfile directly in the container to skip Playwright verification and force pure headless mode:docker exec -it container-name bash echo '#!/bin/bash export BROWSER_USE_HEADLESS=true exec python3 server.py' > /app/start.sh chmod +x /app/start.sh
Then restart the container.
If the Docker build fails or takes too long:
-
Build locally: Build the image locally and upload it to a registry like Docker Hub.
docker build -t your-username/browser-use:latest . docker push your-username/browser-use:latest -
Use a pre-built image: In Easypanel, choose "Use existing image" and specify
your-username/browser-use:latest. -
Disable Playwright installation during build: Edit the Dockerfile and comment out the line installing Playwright, allowing it to be installed only during startup.
If you encounter errors like Unable to locate package xvfb-run or Unable to locate package gnumake during the build:
-
Correct package names: Ensure you're using the correct Debian package names. For example, use
makeinstead ofgnumakeand verify thatxvfbis being installed. -
Custom xvfb-run script: The Dockerfile includes a custom script to create the
xvfb-runutility if it's not available in the system. -
X11 dependencies: Ensure the
x11-utilspackage is installed for tools likexdpyinfo.
If you encounter errors like python: command not found or ModuleNotFoundError: No module named 'X':
-
Use the provided Dockerfile: We strongly recommend using the provided Dockerfile, which is pre-configured with all necessary dependencies, including the correct Python version.
-
Langchain dependencies: The server requires several Langchain dependencies, including:
langchain-google-genai- For Google Generative AI integration- Other dependencies listed in
requirements.txtorpyproject.toml
-
Manually install dependencies: If using an existing container, install missing dependencies:
pip install langchain-google-genai
-
Check startup errors: If the server doesn't show logs after startup, check import errors by running the script manually:
python3 server.py
If you encounter errors like undefined variable 'package-name' during Nixpacks build:
- Verify the package name is correct and exists in the Nix repository.
- For
xvfbissues, usexvfb-run, which already includes the required functionality. - If needed, edit
nixpacks.tomland remove problematic packages. - Alternative nixpacks.toml: If issues persist, rename
nixpacks.toml.alternativetonixpacks.tomland try again. This version uses a more direct approach to install required packages.
If there are issues with Chrome/Chromium:
- Check application logs for specific errors.
- Ensure Easypanel is using
nixpacks.tomlor the Dockerfile. - If needed, add the environment variable
PLAYWRIGHT_BROWSERS_PATH=/tmp/playwright-browsersto allow Playwright to download and install browsers automatically.
If the browser fails to start correctly, try:
- Verifying all system dependencies are installed.
- Setting
headlesstotruein the configuration. - Allocating more memory to the service in Easypanel.
Due to common issues with Nixpacks, we strongly recommend using Docker for deployment:
- In Easypanel, choose "Custom" as the project type.
- Under "Build settings," select Dockerfile as the builder.
- The system will use the provided Dockerfile, which includes all necessary dependencies.
The Dockerfile is specially configured to resolve common dependency and Python setup issues.
A Playwright-based browser automation system with automatic session management and performance metrics.
- Python 3.8+
- PostgreSQL 12+
- Playwright
- psutil
- Clone the repository:
git clone https://github.com/your-username/browser-use.git
cd browser-use - Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows - Install dependencies:
pip install -r requirements.txt - Configure the
.envfile:
cp .env.example .env
# Edit the .env file with your settings - Install Playwright browsers:
playwright install - Start the server:
./start.sh - Task Execution
curl -X POST http://localhost:8000/run \
-H "Content-Type: application/json" \
-d '{
"task": "navigate",
"config": {
"url": "https://google.com",
"timeout": 30000,
"viewport": {
"width": 1280,
"height": 720
}
}
}' - System Metrics
curl http://localhost:8000/metrics - Task Management
# List tasks
curl http://localhost:8000/tasks
# Get task details
curl http://localhost:8000/tasks/{task_id}
# Create new task
curl -X POST http://localhost:8000/tasks \
-H "Content-Type: application/json" \
-d '{"task": "navigate", "config": {...}}'
# Update task
curl -X PUT http://localhost:8000/tasks/{task_id} \
-H "Content-Type: application/json" \
-d '{"status": "completed"}'
# Delete task
curl -X DELETE http://localhost:8000/tasks/{task_id} The system can be configured via the .env file. Key settings include:
- Database: PostgreSQL configurations
- Server: Host and port
- Playwright: Browser paths and headless mode
- Logging: Log level and output file
- Security: Secret key and allowed origins
- Cache: Time-to-live and activation
- Sessions: Timeout and maximum number
The system collects detailed metrics on:
- Task execution time
- Resource usage (CPU, memory, disk)
- Session statistics
- Errors and exceptions
- API response time
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.