Guide to Setting Up Temporal.io on VPS: Optimal Solution for Complex Background Jobs and Long-Running Tasks
A detailed guide to setting up Temporal.io on a VPS for handling complex, long-running, and highly reliable background jobs. Covers configuration, performance optimization,...
Temporal.io is an open-source platform designed to manage complex, long-running, and highly reliable background jobs. With built-in state management, fault tolerance, and recovery capabilities, Temporal is ideal for AI systems, API gateways, and real-time applications requiring high reliability. This guide walks through setting up Temporal.io on a VPS to optimize complex background jobs and long-running workloads.
Prerequisites for Setup
To deploy Temporal.io on a VPS, ensure the following requirements are met:
- A VPS with at least 4GB RAM and 2 CPU cores (8GB RAM or more recommended).
- Linux operating system (Ubuntu 20.04/22.04 or Debian 11/12).
- Stable internet connection.
- SSH access to the VPS.
- Docker and Docker Compose installed (required for Docker-based deployment).
Deploying Temporal.io on VPS
We’ll use Docker for deployment due to its simplicity, ease of management, and fast setup.
1. Install Docker and Docker Compose
Update the system and install Docker on the VPS:
sudo apt update && sudo apt upgrade -y
sudo apt install -y docker.io docker-compose
sudo systemctl enable docker
sudo systemctl start docker
2. Create docker-compose.yml File
Create a new directory and generate the docker-compose.yml file:
mkdir temporal && cd temporal
nano docker-compose.yml
Insert the following content:
version: '3.8'
services:
temporal:
image: temporalio/server:1.23.0
ports:
- "7233:7233"
- "7234:7234"
- "7235:7235"
- "7236:7236"
volumes:
- ./data:/data
environment:
- TEMPORAL_CLI_ADDRESS=temporal:7233
- TEMPORAL_DC_ID=dc1
- TEMPORAL_LOG_LEVEL=info
- TEMPORAL_DC_NAME=dc1
restart: unless-stopped
temporal-web:
image: temporalio/web:1.23.0
ports:
- "8088:8088"
depends_on:
- temporal
environment:
- TEMPORAL_ADDRESS=temporal:7233
- TEMPORAL_DC_ID=dc1
restart: unless-stopped
3. Start the Services
Run the following command to launch Temporal and its web interface:
docker-compose up -d
Performance Optimization for VPS
To ensure Temporal runs efficiently on your VPS, apply the following optimizations:
- Optimize Linux Kernel: Use the XanMod kernel to enhance performance for AI and database workloads. Refer to the guide on Optimizing Linux Kernel with XanMod.
- Increase Swap Memory: If RAM is limited, increase swap space to prevent out-of-memory errors.
- Optimize Filesystem: Use ext4 or XFS with journaling enabled to ensure data integrity.
Verification and Testing
After deployment, verify Temporal is running correctly:
- Access the Temporal web interface at http://
:8088 . - Check service logs for errors:
docker-compose logs temporal
Ensure no connection or initialization errors are present.
Troubleshooting Common Issues
During deployment, you may encounter the following issues:
- Connection Error on Port 7233: Verify that the firewall (ufw or iptables) allows traffic on required ports.
- Database Initialization Failure: Ensure the
/datadirectory exists and has write permissions. - Service Fails to Start: Check logs using
docker-compose logs temporalto identify the specific error.
References
- Temporal.io Official Documentation
- Deploy and Run Local LLM AI on VPS with Ollama and Open WebUI
- Building a Log Analysis System with Signoz
Related infrastructure & engineering guides: High-RAM Cloud VPS for Self-Hosted LLMs & API Gateways
High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache
Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.
VPS-4E
10% VAT included
- CPU: 4 vCPU
- RAM: 8 GB
- SSD: 50 GB NVMe
