Automating business processes is the foundation of operational efficiency. Many cloud-based automation platforms offer convenience but often limit users with execution quotas, workflow counts, and escalating monthly costs as businesses grow. Self-hosting n8n, a powerful open-source workflow automation tool, on a Virtual Private Server (VPS) provides full control, data sovereignty, and crucially, unlimited execution without quotas. This article guides you through deploying n8n with a stable queue mode architecture using PostgreSQL and Redis on a Hostinger KVM VPS.
Why Self-Host n8n & AI Agents?
Choosing the path of self-hosting n8n, especially with its AI Agent integration capabilities, offers several strategic advantages:
- Full Control & Data Sovereignty: All your automation data and workflows reside on your own server. This is crucial for regulatory compliance and safeguarding sensitive business information.
- Long-Term Cost Efficiency: With self-hosting, you pay a stable monthly or annual VPS fee, not fluctuating per-execution or per-workflow costs from cloud services. Eliminating expensive monthly bills allows for better budget allocation.
- Unlimited Flexibility: There are no limits on the number of workflows, nodes, or executions. You are free to create as many and as complex automations as your business requires.
- Advanced AI Integration: n8n can be integrated with various AI APIs (such as OpenAI, Hugging Face, or your custom AI models) to create intelligent AI Agents. This enables automation with more complex logic, such as sentiment analysis, data classification, or personalized communication.
Choosing Hostinger KVM VPS for Your Automation
For running n8n in a production environment with PostgreSQL and Redis, VPS stability and performance are key. Hostinger KVM VPS offers a suitable solution:
- KVM Performance: KVM (Kernel-based Virtual Machine) virtualization provides better resource isolation compared to OpenVZ, ensuring stable and consistent performance for your applications.
- Competitive Pricing: Hostinger offers KVM VPS packages at affordable prices. For this setup, a minimum of Hostinger KVM 2 VPS or higher is recommended for optimal performance.
- Discount Coupon: Take advantage of the referral link and discount coupon for the best price: https://www.hostinger.com/id?REFERRALCODE=6X5PUTERARQL with coupon:
6X5PUTERARQL. - Scalability: Should your automation needs grow, Hostinger allows for easy upgrading of VPS resources.
n8n Queue Mode Architecture: Stable & Scalable
For production environments, running n8n in queue mode is highly recommended. This architecture separates the workflow execution process from the user interface, enhancing stability and scalability:
- PostgreSQL: Used as the primary database to store n8nās workflow data, credentials, and configurations. PostgreSQL is a robust and proven relational database for production applications.
- Redis: Functions as a queue broker and cache. Redis handles the queue of workflow execution tasks, ensuring that workflows are processed sequentially and efficiently, even under high load.
n8n Implementation Guide on Hostinger KVM VPS
Follow these steps to deploy n8n on your Hostinger KVM VPS:
1. Prepare Your Hostinger KVM VPS
- Order VPS: Visit https://www.hostinger.com/id?REFERRALCODE=6X5PUTERARQL, select the KVM 2 VPS plan or higher, and use the coupon
6X5PUTERARQL. - OS Installation: Once the VPS is active, install your preferred operating system, for example, Ubuntu 22.04 LTS.
- System Update: Access your VPS via SSH and run the following commands to update the system:
sudo apt update && sudo apt upgrade -y
2. Install Docker & Docker Compose
Install Docker and Docker Compose, which will be used to manage the n8n, PostgreSQL, and Redis containers.
- Install Docker:
sudo apt install docker.io -y sudo systemctl start docker sudo systemctl enable docker sudo usermod -aG docker ${USER} newgrp docker # Logout and login again or run this command - Install Docker Compose:
sudo apt install docker-compose -y
3. Configure Docker Compose for n8n, PostgreSQL, and Redis
Create a docker-compose.yml file to define your services.
-
Create a directory for n8n and navigate into it:
mkdir n8n-automation cd n8n-automation -
Create the
docker-compose.ymlfile:nano docker-compose.yml -
Copy and paste the following configuration. Be sure to replace
your-domain.comwith your actual domain or VPS IP, and substituteN8N_POSTGRES_PASSWORDandN8N_BASIC_AUTH_PASSWORDwith strong passwords.version: '3.8' services: n8n: image: n8nio/n8n restart: always environment: DB_TYPE: postgresdb DB_POSTGRES_HOST: postgres DB_POSTGRES_PORT: 5432 DB_POSTGRES_DATABASE: n8n DB_POSTGRES_USER: n8n_user DB_POSTGRES_PASSWORD: your_strong_postgres_password # Change this QUEUE_HEALTH_CHECK_ACTIVE: 'true' QUEUE_BULL_REDIS_HOST: redis QUEUE_BULL_REDIS_PORT: 6379 N8N_HOST: your-domain.com # Replace with your domain or VPS IP N8N_PORT: 5678 N8N_PROTOCOL: http # Use https if you set up a reverse proxy with SSL WEBHOOK_URL: http://your-domain.com:5678/ # Replace with your domain or VPS IP GENERIC_TIMEZONE: Asia/Jakarta # Adjust your timezone N8N_BASIC_AUTH_ACTIVE: 'true' N8N_BASIC_AUTH_USER: admin N8N_BASIC_AUTH_PASSWORD: your_strong_n8n_password # Change this NODE_ENV: production TZ: Asia/Jakarta volumes: - n8n_data:/home/node/.n8n ports: - "5678:5678" depends_on: - postgres - redis postgres: image: postgres:15 restart: always environment: POSTGRES_DB: n8n POSTGRES_USER: n8n_user POSTGRES_PASSWORD: your_strong_postgres_password # Must match DB_POSTGRES_PASSWORD in n8n volumes: - postgres_data:/var/lib/postgresql/data redis: image: redis:7 restart: always volumes: - redis_data:/data volumes: n8n_data: postgres_data: redis_data:
4. Run n8n
Save the docker-compose.yml file (Ctrl+X, Y, Enter) and start the Docker Compose services:
docker compose up -d
Verify that all containers are running correctly:
docker compose ps
Now you can access the n8n interface via your browser at http://your-domain.com:5678/ (replace your-domain.com with your domain or VPS IP). You will be prompted to enter the basic auth credentials you set up.
5. Integrating AI Agents
Once n8n is running, you can start building workflows that integrate AI Agents:
- AI Nodes: n8n has various nodes to interact with popular AI services like OpenAI (GPT-3/4), Hugging Face, or custom AI APIs. You can use the HTTP Request node to interact with other AI APIs.
- Implementation Example: Create a workflow that receives data (e.g., customer reviews from a webhook), sends it to an AI API for sentiment analysis, and then takes action based on the results (e.g., sending an automated WhatsApp notification if the sentiment is negative, or updating a status in your CRM).
Use Cases for Automation with n8n & AI Agents
With self-hosted n8n, you can build powerful automations:
- Intelligent WhatsApp Notifications: Receive new orders from e-commerce, use AI to filter or personalize messages, then send automated WhatsApp notifications to customers or internal teams. This also applies to incoming messages that need automated responses with AI assistance.
- Automated Data Synchronization: Connect various business systems (CRM, ERP, Google Sheets, marketing platforms) for real-time or scheduled data synchronization without manual intervention.
- Automated Reports: Collect data from various sources, process it with AI logic (e.g., summarizing key points), and generate periodic reports delivered via email or Slack.
Conclusion
Self-hosting n8n on a Hostinger KVM VPS is a smart investment for businesses seeking a powerful, flexible, and cost-effective automation solution. With full control over your infrastructure and data, coupled with the ability to integrate AI Agents without quota limitations, you can drive operational efficiency to new heights. Start your automation journey today and experience the freedom of unlimited workflow execution.
Ready-to-Post Social Copy
Copy text and open platform composer in 1 click
Tired of hitting monthly workflow quotas on cloud automation tools? Paying more every time your business scales? š¤ Self-hosting n8n on a KVM VPS gives you unlimited workflows with zero per-execution fees.
By deploying n8n in queue mode with PostgreSQL and Redis, your business gets rock-solid background workers capable of running complex multi-agent workflows 24/7.
Hostinger KVM VPS provides high-speed NVMe storage, dedicated RAM, and 300 Mb/s ports that keep your webhooks instant. Use coupon '6X5PUTERARQL' for an extra discount.
Read our complete production deployment blueprint with Docker Compose: https://bijaktechnology.com/en/blog/cara-self-host-n8n-ai-agent-otomatisasi-bisnis-hostinger-vps #n8n #Automation