Temporal¶
In this article
Information
Temporal is an open-source platform for building reliable distributed applications. It addresses one of the key challenges in modern development: ensuring the execution of critical processes in unstable environments. It allows developers to focus on business logic rather than handling infrastructure failures.
Temporal. Main Features¶
- Workflow Orchestration: Provides robust execution of long-running business processes. Automatically handles failures and retries, guaranteeing task completion.
- Distributed Transactions: Ensures consistent operation execution across different services without using distributed locks.
- Timeouts and Scheduling: Allows setting timers and scheduling tasks with high precision even for long processes.
- Scalability: Supports horizontal scaling to handle high loads. Components can be scaled independently.
- Historical Debugging: Preserves the history of process execution, enabling analysis and debugging of workflows.
- Versioning: Supports safe workflow updates without interrupting running tasks.
- Observability: Integrates with monitoring and tracing systems for application control.
- Multi-tenancy: Provides isolation and resource management for multiple teams or applications.
Deployment Features¶
ID | Compatible OS | VM | BM | VGPU | GPU | Min CPU (Cores) | Min RAM (Gb) | Min HDD/SDD (Gb) | Active |
---|---|---|---|---|---|---|---|---|---|
266 | Ubuntu 22.04 | + | + | + | + | 2 | 2 | 30 | Yes |
- Pre-installed dependencies:
- Docker;
- docker-compose;
- Git (for repository cloning).
- Additional components:
- Nginx (for reverse proxy);
- Postgresql (database);
- Elasticsearch (for workflow history storage);
- Grafana (for monitoring);
- Prometheus (for metrics collection);
- Jaeger (for distributed tracing);
- OpenTelemetry Collector (for telemetry collection).
- Project directory:
/root/docker-compose
- Customization file:
/root/docker-compose/docker-compose-multirole_edited.yaml
Main components with a web interface:
Name | Local address and port | External address |
---|---|---|
Temporal UI | localhost:8080 | https://temporal{server_id_from_invapi}.hostkey.in |
Grafana | localhost:8085 | https://temporal{server_id_from_invapi}.hostkey.in/grafana/ |
Prometheus | localhost:9090 | https://temporal{server_id_from_invapi}.hostkey.in/prometheus/ |
Prometheus Metrics | - | https://temporal{server_id_from_invapi}.hostkey.in/prometheus/metrics |
Getting Started After Deploying Temporal¶
After payment, a notification about the server's readiness will be sent to your registered email address. It will include the VPS IP address and login credentials for access. Our company clients manage the hardware via the server management panel and API — Invapi.
After following the link from the webpanel tag, an authorization window will open.
Authorization data can be found in the Info >> Tags tab of the server management panel or in the sent email:
- Link for access to the Temporal management panel via web interface: in the webpanel tag;
- Login and Password for managing the server: provided in an email upon server handover.
Home Screen and Navigation¶
After following the link from the webpanel tag, the Temporal web interface will open:
The main screen displays a list of workflows (Workflows) in the selected namespace. The message "No Workflows running in this Namespace" indicates the absence of active processes at that moment.
Main elements of the interface:
- Sidebar on the left provides access to different sections of the system;
- Top bar shows the current namespace (by default, "default");
Start Workflowbutton in the top right corner for starting new processes;- Process table with columns Status, Workflow ID, Run ID, Type, Start, End.
Functional capabilities
-
Starting a New Workflow Process:
- Click on the
Start Workflowbutton in the top-right corner; - Fill out the necessary parameters in the appearing form;
- Confirm process creation.
- Click on the
-
Viewing and Filtering Processes:
- Use the
Filterbutton to select processes based on various criteria; - Choose any process from the table for detailed information viewing.
- Use the
-
Code Examples:
- Access integration examples via GitHub repository links:
- samples-go - Go examples;
- samples-java - Java examples;
- samples-typescript - TypeScript examples;
- samples-python - Python examples;
- samples-dotnet - .NET examples;
- samples-php - PHP examples.
-
Changing Settings:
- UTC selector in the top-right corner for time zone changes;
button is intended for accessing additional interface settings.
Typical Use Cases:
- Monitoring Processes: Regularly checking the status of running tasks;
- Debugging: Detailed analysis of errors in case of failures;
- Managing Workloads: Starting, pausing, and canceling processes;
- Developing New Processes: Using code examples to create custom workflows.
Note
Detailed information on using Temporal can be found in the official developer documentation.
Testing Temporal with Go (Optional)¶
Info
Below is the process for installing necessary components and testing Temporal using a Saga pattern example in Go. This test demonstrates the platform's key capability of reliably executing long-lived business processes with automatic failure handling. The Saga pattern addresses the problem of transaction atomicity in distributed systems through a mechanism of compensating actions.
1. Install Go¶
Before starting testing, install Go on the server:
Update package lists
Install dependencies Download the latest version of Go (as of this writing, it is 1.22.1) Extract the archive to/usr/local
Set environment variables Activate changes in the current session Verify installation 2. Clone the Temporal Examples Repository¶
Go to the home directory
Clone the Go examples repository Navigate to the examples directory3. Test Using the Saga Example¶
The Saga pattern is used for managing distributed transactions, ensuring the ability to roll back (compensate) in case of errors.
Structure of the Saga example
saga/
├── worker/main.go # Worker process handling tasks
├── start/main.go # Initializes the worker process
├── activity.go # Definition of actions (withdraw/deposit funds)
├── workflow.go # Sequence of actions definition
└── shared.go # Common definitions
Run the test:
-
Start the worker (execute in the first terminal):
The worker will register with Temporal and wait for a task. Log messages about attempts to get tasks will appear. -
Start the starter (execute in the second terminal):
The starter initiates the money transfer process from one account to another.
Expected result:
In the worker's logs, you will see:
- Money withdrawal from account 001-001;
- Money deposit on account 002-002;
- A specially created error in activity
StepWithError
; - Three attempts to execute the faulty activity;
- Launch of compensating actions:
- Return funds to the original account;
- Cancel money withdrawal.
4. Verify Results through Temporal Web Interface¶
- Open the Temporal web interface in your browser (via the webpanel tag);
- In the interface, find the workflow with ID
transfer-money-workflow
; - You will see the complete execution history of the workflow, including all activities and compensating actions:
Info
In the Temporal web interface, you will see that the transfer-money-workflow
has a status of "Failed." This is not an error in the configuration or execution of the test but is expected behavior for the Saga example. This example is specially designed to demonstrate the compensation mechanism upon encountering an error. The activity StepWithError
intentionally generates an error after performing the withdrawal and deposit operations, demonstrating how compensating actions are initiated. The "Failed" status in this example indicates that the compensation mechanism worked correctly, and the system returned to a consistent state after detecting the error.
Ordering a Temporal Server via API¶
To install this software using the API, follow this instruction.
Some of the content on this page was created or translated using AI.