Run Temporal Locally
Lesson 3: Setting Up Your Development Environment
π― Objective: Understand Temporal server architecture, run Temporal locally for development, and explore monitoring and debugging tools.
ποΈ Temporal Server Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Temporal Server β
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββ β
β β Frontend β β History β β Matching β β
β β Service β β Service β β Service β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββ β
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββ β
β β Worker β β Internal β β Database β β
β β Service β β Frontend β β (SQLite/MySQL/etc.) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β Web UI β
β (Port 8233) β
βββββββββββββββββββ
Core Services Overview
Frontend Service (Port 7233)
- Main API endpoint for clients and workers
- Handles routing and authentication
History Service
- Stores workflow event history for replay and recovery
Matching Service
- Routes tasks to workers
- Manages task queues with load balancing
More Core Services
Worker Service
- Runs internal Temporal system workflows
Database
- Persistent storage layer
- SQLite for dev, MySQL/Postgres for production
Web UI (Port 8233)
- Visual interface for monitoring and debugging
βοΈ Development vs Production
Development Setup
temporal server start-dev
Features:
- β Single-node server with embedded SQLite DB
- β Web UI available on port 8233
- β Zero config, no auth
- β Perfect for local dev and learning
Production Setup Example
# docker-compose.yml
version: '3.8'
services:
temporal:
image: temporalio/auto-setup:latest
environment:
- DB=postgresql
- DB_PORT=5432
- POSTGRES_USER=temporal
- POSTGRES_PWD=temporal
ports:
- 7233:7233
depends_on:
- postgresql
Production Features
Production Setup Includes:
- β Multi-node clustering
- β External DB (Postgres, MySQL, Cassandra)
- β Authentication
- β Monitoring
- β High availability
- β Scaling capabilities
π§ Temporal CLI Quick Commands
Server Operations
# Start basic dev server
temporal server start-dev
# Custom ports
temporal server start-dev --port 7234 --http-port 8234
# Persistent database
temporal server start-dev --db-filename temporal.db
CLI: Namespace Management
# List namespaces
temporal operator namespace list
# Create namespace
temporal operator namespace create my-namespace
# Describe namespace
temporal operator namespace describe default
Why Namespaces Matter:
- π’ Multi-tenancy - Separate different applications
- π Isolation - Keep environments separate
- π Organization - Group related workflows
π§ What is namespace temporal-system?
Itβs the default internal namespace Temporal uses to run its own workflows β not yours.
Think of it like Temporalβs βadminβ namespace β itβs where it handles system-level workflows, heartbeats, and background tasks that keep Temporal itself alive and healthy.
CLI: Workflow Operations
# List all workflows
temporal workflow list
# Show specific workflow
temporal workflow show --workflow-id my-workflow-id
# Terminate workflow
temporal workflow terminate --workflow-id my-workflow-id
Pro tip: Use these commands for debugging and monitoring!
π Web UI Highlights
Key Features:
- π Workflows: Browse executions, filter, retry failures
- β‘ Task Queues: Monitor worker health, queue backlog, partitions
- π· Workers: See registered workers and their capabilities
- π Schedules: Manage recurring workflows and cron schedules
Access at: http://localhost:8233
π οΈ Best Practices for Local Development
Development Tips:
- β Use startup scripts or aliases for easy server launch
- β
Persist your dev data with
--db-filename
option - β Use separate namespaces per project
- β
Maintain environment configs via
.temporal/config.yaml
Startup Script Example
#!/bin/bash
# start-temporal.sh
echo "π Starting Temporal development server..."
temporal server start-dev \
--port 7233 \
--http-port 8233 \
--db-filename ./temporal-dev.db \
--namespace default
echo "β
Temporal started!"
echo "π Web UI: http://localhost:8233"
echo "π gRPC API: localhost:7233"
π οΈ Monitoring & Debugging Tips
Health Checks:
# Check server health
π₯ Temporal server by command runs on gRPC, not HTTP
β curl http://localhost:7233/health
β curl: (1) Received HTTP/0.9 when not allowed
tctl cluster health
install ctl: https://docs.temporal.io/tctl-v1#install
# Check Web UI health
curl http://localhost:8233/health
Additional Tips:
- β Enable debug logging for verbose output
- β Inspect SQLite DB directly if needed
- β Use Web UI for visual debugging
β Development Tips & Common Pitfalls
Best Practices:
- β Always start Temporal server before your app
- β Keep server and Web UI ports straight: 7233 and 8233
- β Shutdown gracefully to avoid DB corruption
- β Backup dev DB regularly
Common Issues:
- β Starting app before server
- β Port conflicts
- β Corrupted database files
π Troubleshooting Guide
Port Conflicts:
# Check if ports are in use
lsof -i :7233
lsof -i :8233
Database Issues:
- Remove corrupted DB file and restart if needed
- Backup important dev data regularly
Quick Troubleshooting Commands
# Kill processes on Temporal ports
lsof -ti:7233 | xargs kill -9
lsof -ti:8233 | xargs kill -9
# Clean start
temporal server start-dev
When in doubt, clean slate!
π‘ Key Takeaways
What You've Learned:
- β Temporal server architecture and components
- β Development vs production setup differences
- β Essential CLI commands
- β Web UI capabilities
- β Local development best practices
- β Troubleshooting techniques
π Next Steps
Your Temporal server is ready!