# Rundeck Job Scheduler

> Self-service operations platform for runbook automation and job scheduling.

- Category: DevOps & CI/CD
- Difficulty: intermediate
- Components: rundeck, postgresql
- Tags: automation, job-scheduler, rundeck, runbooks, operations
- Source: https://docker.recipes/devops/rundeck-automation

## Overview

Rundeck is an open-source job scheduler and runbook automation platform designed for operational teams who need to execute scripts, deploy applications, and manage infrastructure tasks across distributed environments. Originally developed by SimplifyOps and now maintained by PagerDuty, Rundeck provides a centralized web interface where teams can define, schedule, and execute jobs while maintaining detailed audit logs and role-based access controls. The platform excels at bridging the gap between development and operations by allowing complex workflows to be packaged as self-service operations that can be safely executed by team members with varying levels of technical expertise.

This deployment creates a production-ready Rundeck environment using two specialized containers: the main Rundeck application server running version 5.0.0 and a PostgreSQL 15 database for persistent storage. The Rundeck container handles job execution, workflow management, user authentication, and the web interface, while connecting to the dedicated PostgreSQL database for storing job definitions, execution history, user accounts, and system configuration. This architecture separates compute and storage concerns, allowing for better resource allocation and data persistence across container restarts.

This stack is ideal for DevOps teams, system administrators, and organizations implementing ChatOps or Infrastructure as Code practices who need a robust job scheduling platform with enterprise-grade features. The PostgreSQL backend ensures data integrity and supports complex queries for reporting and analytics, while the containerized approach simplifies deployment and scaling. Teams managing multiple environments, automated deployments, or routine operational tasks will benefit from Rundeck's workflow orchestration capabilities and its ability to integrate with existing tools through plugins and APIs.

## Features

- Web-based job designer with drag-and-drop workflow creation and visual job execution monitoring
- Multi-node SSH execution with built-in key management and secure credential storage
- Flexible scheduling system supporting cron expressions, job dependencies, and manual triggers
- Role-based access control with project-level permissions and user group management
- RESTful API and webhook integration for programmatic job management and external system integration
- Plugin architecture supporting cloud providers, configuration management tools, and notification systems
- Comprehensive audit logging with detailed execution history and compliance reporting
- Resource model management for dynamic node discovery and inventory synchronization

## Use cases

- Automated deployment pipelines with approval workflows and rollback capabilities
- Scheduled maintenance tasks like database backups, log rotation, and system health checks
- Self-service operations portal allowing developers to deploy applications without direct server access
- Incident response runbooks with step-by-step guided procedures and automated remediation
- Multi-environment configuration management and infrastructure provisioning workflows
- Compliance automation for security scans, patch management, and audit report generation
- CI/CD integration for executing build, test, and deployment jobs across distributed infrastructure

## Prerequisites

- Docker Engine 20.x or higher with Docker Compose v2 support
- Minimum 2GB RAM for combined Rundeck and PostgreSQL containers under normal workload
- Port 4440 available for Rundeck web interface access
- Environment variables configured: DB_PASSWORD, ADMIN_PASSWORD, and RUNDECK_URL
- Basic understanding of SSH key management and Unix/Linux command execution
- Network connectivity to target nodes and systems that jobs will manage

## docker-compose.yml

```yaml
services:
  rundeck:
    image: rundeck/rundeck:5.0.0
    container_name: rundeck
    environment:
      - RUNDECK_DATABASE_DRIVER=org.postgresql.Driver
      - RUNDECK_DATABASE_USERNAME=rundeck
      - RUNDECK_DATABASE_PASSWORD=${DB_PASSWORD}
      - RUNDECK_DATABASE_URL=jdbc:postgresql://db/rundeck
      - RUNDECK_GRAILS_URL=${RUNDECK_URL}
      - RUNDECK_SERVER_ADDRESS=0.0.0.0
      - RUNDECK_ADMIN_PASSWORD=${ADMIN_PASSWORD}
    volumes:
      - rundeck-data:/home/rundeck/server/data
      - rundeck-logs:/home/rundeck/var/logs
      - rundeck-plugins:/home/rundeck/libext
    ports:
      - "4440:4440"
    depends_on:
      - db
    networks:
      - rundeck-network
    restart: unless-stopped

  db:
    image: postgres:15-alpine
    container_name: rundeck-db
    environment:
      - POSTGRES_USER=rundeck
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - POSTGRES_DB=rundeck
    volumes:
      - postgres-data:/var/lib/postgresql/data
    networks:
      - rundeck-network
    restart: unless-stopped

volumes:
  rundeck-data:
  rundeck-logs:
  rundeck-plugins:
  postgres-data:

networks:
  rundeck-network:
    driver: bridge
```

## .env

```bash
# Rundeck
RUNDECK_URL=http://localhost:4440
ADMIN_PASSWORD=secure_admin_password
DB_PASSWORD=secure_rundeck_password
```

## Usage notes

- Web UI at http://localhost:4440
- Login: admin / (ADMIN_PASSWORD)
- Define jobs and workflows
- Schedule with cron expressions
- Node management and SSH execution

## Troubleshooting

- Database connection failed errors: Verify DB_PASSWORD environment variable matches between rundeck and db services, check that PostgreSQL container is fully started
- Rundeck web interface shows 'Grails application error': Ensure RUNDECK_GRAILS_URL matches the actual URL users will access, restart rundeck container after environment changes
- Job execution fails with SSH connection timeout: Verify target nodes are accessible from rundeck container, check SSH key configuration and node definitions in resource model
- Plugin installation issues with libext directory: Ensure rundeck-plugins volume is properly mounted and rundeck container has write permissions to /home/rundeck/libext
- PostgreSQL data loss after container restart: Verify postgres-data volume is correctly configured and mounted to /var/lib/postgresql/data in db container
- High memory usage during job execution: Monitor rundeck container resources and adjust memory limits, consider tuning Java heap settings via RUNDECK_JVM_SETTINGS environment variable

