24/7 Automation Framework: Define Use Cases Before Deployment
Many automation frameworks sit idle after deployment because teams install tools before identifying business needs. This article presents a business-driven sequence: understand framework capabilities, map repetitive workflows, assess automation suitability, permissions, and risk, then select and deploy. It also covers practical scenarios for daily log processing, hourly health checks with safe recovery, and nightly regression testing, including retries, idempotency, approval, rollback, rate limiting, and environment isolation.
Introduction: After Deployment, What Should the Framework Do?
In daily development and operations, there are always repetitive, periodic tasks: reviewing the previous day’s error logs, checking server status every hour, or running a full regression test every night. These tasks do not require much creativity, but they consume a lot of time. Many developers therefore want to use an automation task execution framework so that tasks can complete automatically after hours and results are ready the next morning.
Such frameworks usually run on cloud servers or always-on local machines. They can execute tasks based on schedules or event triggers and support 24/7 uninterrupted operation.
However, after deployment, many people face an empty environment and do not know what to let the framework do. Online examples are often either demo-oriented with little business value, or too far from their own scenarios to be copied directly. The problem is often the order: install the tool first, then look for a purpose.
Core Approach: Define Use Cases First, Then Deploy
A more reasonable order is business-driven.
Step 1: Understand what the framework can do, such as scheduled execution, failure retries, and integration with cloud services.
Step 2: Review your business workflows and identify repetitive, time-consuming, and error-prone steps.
Step 3: Determine whether these steps are suitable for automation, and assess the required permissions and risks.
Step 4: Select and deploy the framework.
Once the scenarios are clear, you know which services to integrate, which permissions to grant, and who should handle the results. The framework will not sit idle, nor will it become an unmaintained risk.
Typical Scenarios and Implementation Methods
How Should Large Volumes of Daily Logs Be Processed?
Problem: Microservices generate large amounts of logs every day. Manual review is inefficient, and critical errors are easy to miss.
Solution: The framework runs a scheduled task during idle early-morning hours. The task pulls the previous day’s ERROR-level logs from the log service, uses regular expressions to extract exception types, API names, and occurrence counts, and generates a summary. The summary is first written to a temporary path in object storage. After validation, it is renamed to the final archive path. Finally, the task sends a message with the date to a message queue, triggering a downstream reporting service to generate a visualization.
Input and output example: The input is log data for 2026-11-23. The output is archive/error-summary/2026-11-23.json in object storage, with content similar to:
{"date": "2026-11-23", "errors": [{"type": "TimeoutError", "api": "/order/create", "count": 128}]}
Dependencies and boundaries:
- Permissions: The log account only needs read permission; the object storage account is only allowed to write to the
archive/prefix; the message queue account is only allowed to send messages to the specified topic. - Pull failures: The task records checkpoints by time window. After a failure, it retries with exponential backoff. After multiple failures, it retains the checkpoint and sends an alert. The next run continues from the last successful timestamp, so no data is missed.
- Duplicate consumption: Reports are generated in partitions by date. Repeated execution on the same day overwrites the report at the same path. The downstream service deduplicates by the date and task ID in the message, so duplicate messages do not produce duplicate reports.
Result: The next morning, the team can open the report directly and locate the previous day’s production anomalies.
How Can Scheduled Health Checks Avoid Turning Automated Recovery into an Incident?
Problem: The framework can check each node’s ports, disk, and processes every hour and automatically recover after detecting anomalies. However, if automatic restarts or cache cleanup are triggered by incorrect judgment or repeated execution, they may cause service interruptions or data loss.
Solution: Health checks are only responsible for detecting problems. Recovery actions can only be selected from a pre-approved whitelist. Specific measures are as follows.
- Least privilege: The health-check account can only access read-only interfaces on specified hosts. Restart operations use a separate account and can only operate on services in the whitelist.
- Change approval: For restarts and cleanup involving the production environment, automatic execution is only enabled for approved services and scenarios. Other cases are alert-only and require manual confirmation.
- Backup and rollback: Back up key files before cleaning the cache. The recovery script must record the state before the operation so it can roll back on failure.
- Idempotent execution: Check the current service status before restarting. If it has already recovered, skip the action to avoid repeated restarts.
- Rate limiting: If the same service is automatically restarted more than twice within one hour, automatic recovery stops, manual intervention is required, and a high-priority alert is sent.
What Should Be Considered for Nightly Regression Testing?
Problem: End-to-end tests take a long time and depend on complex environments, so they are not suitable for every code commit. They are better suited to full regression runs at night.
Solution: At night, the framework pulls the latest code, builds an isolated test environment, runs the test suite, and pushes results and coverage reports to the code repository or project management platform.
Considerations:
- Environment isolation: The test environment is network-isolated from the production environment. The test database uses an independent instance and must not connect to the production database.
