Maxun: Web Data Platform Deployment Guide
This guide provides comprehensive instructions for deploying and using Maxun, an open-source no-code platform for web scraping, crawling, search, and AI data extraction.
1. Prerequisites
Before you begin, ensure you have the following installed:
- Node.js: Version 18 or higher.
- npm or Yarn: For package management.
- Docker and Docker Compose: Recommended for simplified setup and production deployments.
- PostgreSQL: A running PostgreSQL instance is required for Maxun's database.
- Git: For cloning the repository.
2. Installation
Maxun can be installed and run using Docker Compose (recommended) or directly on your local machine.
2.1. Clone the Repository
First, clone the Maxun repository:
git clone https://github.com/getmaxun/maxun.git
cd maxun
2.2. Setup with Docker Compose (Recommended)
This method simplifies the setup by orchestrating all necessary services (database, Maxun server).
-
Create
.envfile: Copy the example environment file and configure it.cp .env.example .envRefer to the Configuration section for details on environment variables.
-
Start Services:
docker-compose up -dThis command will build the Docker images, create the necessary containers, and start them in detached mode.
2.3. Setup without Docker (Local)
This method requires you to manage dependencies and services manually.
-
Install Dependencies:
npm install -
Database Setup: Ensure you have a PostgreSQL database running and accessible. Create a database for Maxun.
-
Create
.envfile: Copy the example environment file and configure it.cp .env.example .envRefer to the Configuration section for details on environment variables, especially database connection strings.
-
Run Database Migrations:
npm run migrate
3. Configuration
Maxun relies on environment variables for configuration. A .env.example file is provided in the repository root. Copy this to .env and modify the values.
Essential Environment Variables:
-
Database Connection:
DB_USER: PostgreSQL username.DB_PASSWORD: PostgreSQL password.DB_HOST: PostgreSQL host (e.g.,localhost,db).DB_PORT: PostgreSQL port (default:5432).DB_NAME: PostgreSQL database name (e.g.,maxun).DATABASE_URL: Full PostgreSQL connection string (e.g.,postgresql://user:password@host:port/database). This often overrides individualDB_variables if present.
-
Application Settings:
PORT: Port for the Maxun server (default:3000).JWT_SECRET: A strong, unique secret for JWT token signing.ENCRYPTION_KEY: A strong, unique key for encrypting sensitive data (e.g., intypeorpressactions within workflows). This is used by thedecryptfunction inserver/src/utils/auth.tsandserver/src/workflow-management/classes/Interpreter.ts.MINIO_ENDPOINT,MINIO_PORT,MINIO_ACCESS_KEY,MINIO_SECRET_KEY,MINIO_USE_SSL: Configuration for MinIO or S3-compatible storage for binary outputs (e.g., screenshots).PG_BOSS_CONNECTION_STRING: Connection string for PgBoss, typically derived from the main database connection. Ensure this is correctly set for the PgBoss worker (server/src/pgboss-worker.ts).
Example .env (Docker Compose):
PORT=3000
DATABASE_URL=postgresql://user:password@db:5432/maxun
DB_USER=user
DB_PASSWORD=password
DB_HOST=db
DB_PORT=5432
DB_NAME=maxun
JWT_SECRET=your_jwt_secret_here
ENCRYPTION_KEY=your_encryption_key_here
# MinIO/S3 Configuration (optional, for binary outputs)
MINIO_ENDPOINT=minio
MINIO_PORT=9000
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
MINIO_USE_SSL=false
4. Build & Run
4.1. Development Mode (Local)
To run Maxun in development mode (without Docker):
- Install dependencies and set up
.envas described in Installation without Docker and Configuration. - Start the server:
This will typically start the server onnpm run devhttp://localhost:3000(or your configuredPORT).
4.2. Production Mode
Using Docker Compose (Recommended)
If you followed the Setup with Docker Compose instructions, Maxun is already running in a production-ready setup.
- Ensure
.envis configured for production. - Start services:
docker-compose up -d
Building and Running without Docker
- Install dependencies and set up
.envas described in Installation without Docker and Configuration. - Build the application:
npm run build - Start the server:
npm start
5. Deployment
Maxun can be deployed to various cloud platforms that support Docker containers and PostgreSQL databases.
5.1. Self-Hosting with Docker & Portainer
The official documentation suggests using Portainer for self-hosting with Docker. This provides a GUI for managing your Docker environment.
- Install Docker and Portainer on your server.
- Clone the Maxun repository and configure your
.envfile as described in Configuration. - Deploy using Docker Compose: You can use Portainer to deploy a stack from your
docker-compose.ymlfile. Upload thedocker-compose.ymland your.envfile, then deploy the stack.
5.2. Cloud Platforms (e.g., AWS, Google Cloud, Azure)
For cloud deployments, consider the following architecture:
- Container Orchestration: Use services like AWS ECS/EKS, Google Kubernetes Engine (GKE), or Azure Kubernetes Service (AKS) to run Maxun's Docker containers.
- Database: Utilize managed PostgreSQL services (e.g., AWS RDS, Google Cloud SQL for PostgreSQL, Azure Database for PostgreSQL) for high availability and scalability.
- Object Storage: For storing binary outputs (screenshots, etc.), use AWS S3, Google Cloud Storage, or Azure Blob Storage, configured via the
MINIO_environment variables. - Load Balancer: Place a load balancer in front of your Maxun instances for traffic distribution and SSL termination.
General Steps for Cloud Deployment:
- Containerize Maxun: The
Dockerfilein the repository allows building a production-ready Docker image.docker build -t maxun-app . - Push to Container Registry: Push your built image to a cloud container registry (e.g., AWS ECR, Google Container Registry).
- Provision Database: Set up a managed PostgreSQL instance.
- Configure Environment Variables: Ensure all necessary environment variables (especially database credentials and
JWT_SECRET,ENCRYPTION_KEY) are securely passed to your container instances. - Deploy Containers: Deploy Maxun containers to your chosen orchestration service, ensuring they can connect to the database and object storage.
- Set up Networking: Configure networking, including load balancers, firewalls, and domain mapping.
6. Troubleshooting
6.1. Database Connection Issues
- Error Message:
Failed to start pgboss worker: one or more required environment variables are missing.or similar database connection errors. - Solution:
- Double-check your
DB_USER,DB_PASSWORD,DB_HOST,DB_PORT,DB_NAME, andDATABASE_URLin your.envfile. - Ensure your PostgreSQL database is running and accessible from the Maxun server. If using Docker Compose, verify the
dbservice is healthy. - Check firewall rules if deploying to a remote server.
- Double-check your
6.2. ENCRYPTION_KEY Missing
- Error Message: Errors related to decryption failures or missing encryption key.
- Solution: Ensure
ENCRYPTION_KEYis set in your.envfile. This key is crucial for decrypting sensitive information stored in workflows (e.g., inputs fortypeorpressactions).
6.3. Playwright Browser Issues
- Error Message: Errors related to browser launch, connection, or Playwright.
- Solution:
- Ensure your Docker environment has sufficient resources (memory, CPU).
- If running locally, ensure all Playwright dependencies are installed. Maxun's Docker image includes necessary browser dependencies.
- Check logs for more specific Playwright errors. The
browser-management/classes/RemoteBrowser.tsandbrowser-management/controller.tsfiles handle browser interactions.
6.4. Workflow Execution Problems
- Issue: Workflows are not executing as expected, or data is not being extracted.
- Solution:
- Check Maxun UI: The Maxun application provides logs and run details for executed robots.
- Server Logs: Review the Maxun server logs for errors during workflow interpretation (
workflow-management/classes/Interpreter.ts) or generation (workflow-management/classes/Generator.ts). - Rate Limiting/Blocking: Websites might block or rate-limit scraping attempts. Consider using proxies (Maxun supports proxy configuration) or adjusting the robot's speed.
- Selector Issues: If using Recorder Mode, website changes can break selectors. Re-record or manually adjust the workflow.
- Scrape List Limit: Note that
scrapeListactions have a default limit of 5 in certain contexts ifcheckLimitis true (as seen inserver/src/routes/storage.tsandserver/src/workflow-management/classes/Interpreter.ts). This might affect the amount of data extracted.
6.5. PgBoss Worker Not Starting
- Error Message:
Failed to start pgboss worker: one or more required environment variables are missing.(specifically fromserver/src/pgboss-worker.ts). - Solution:
- Verify that all
DB_USER,DB_PASSWORD,DB_HOST,DB_PORT, andDB_NAMEenvironment variables are correctly set and accessible to the PgBoss worker process. - Ensure the PostgreSQL database is running and the connection string is valid.
- Verify that all
For further assistance, refer to the official Maxun documentation or join the Discord community.