Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziosalmi authored Aug 18, 2024
1 parent 2265b14 commit 3e49201
Showing 1 changed file with 1 addition and 63 deletions.
64 changes: 1 addition & 63 deletions docs/lxc_autoscale_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,71 +8,9 @@
- **[Installation](#installation)**: Instructions for installing the LXC AutoScale API on your Proxmox host.
- **[Routes](#routes)**: Detailed descriptions of available API endpoints, including examples of how to use them.
- **[Logs](#logs)**: Information on where to find and how to interpret the logs generated by the API service.
- **[Examples](examples/README.md)**: Ensure your containers are running optimally based on real-time conditions.
- **[Best Practices and Tips](#best-practices-and-tips)**: Recommendations for effectively using the API in various scenarios.

---

## Examples

The LXC AutoScale API enables you to automate the scaling and management of LXC containers in response to different conditions. Below are a few examples of how you might use the API to optimize resource usage throughout the day.

### Example 1: Dynamic CPU Scaling

You may want to increase the number of CPU cores allocated to a container in the morning when it experiences higher demand, and reduce the cores at night to save resources and reduce fan noise.

**Increase cores at 6:00 AM:**
```bash
0 6 * * * curl -sSL -X POST http://proxmox:5000/scale/cores \
-H "Content-Type: application/json" \
-d '{"vm_id": 104, "cores": 4}'
```

**Decrease cores at 10:00 PM:**
```bash
0 22 * * * curl -sSL -X POST http://proxmox:5000/scale/cores \
-H "Content-Type: application/json" \
-d '{"vm_id": 104, "cores": 2}'
```

### Example 2: Automated Snapshot Management

You might want to create a daily snapshot of your container every morning and have the option to automatically roll back to that snapshot at night if something goes wrong during the day.

**Create a snapshot at 6:00 AM:**
```bash
0 6 * * * curl -sSL -X POST http://proxmox:5000/snapshot/create \
-H "Content-Type: application/json" \
-d '{"vm_id": 104, "snapshot_name": "daily_snapshot_$(date +\%F)"}'
```

**Rollback to the snapshot at 11:00 PM if needed:**
```bash
0 23 * * * curl -sSL -X POST http://proxmox:5000/snapshot/rollback \
-H "Content-Type: application/json" \
-d '{"vm_id": 104, "snapshot_name": "daily_snapshot_$(date +\%F)"}'
```

### Example 3: On-Demand Container Cloning

Suppose you need to quickly create a clone of a container to test updates or changes without affecting the original container.

**Create a clone of a container:**
```bash
curl -sSL -X POST http://proxmox:5000/clone/create \
-H "Content-Type: application/json" \
-d '{"vm_id": 104, "new_vm_id": 105, "new_vm_name": "cloned_container"}'
```

**Delete the cloned container after testing:**
```bash
curl -sSL -X DELETE http://proxmox:5000/clone/delete \
-H "Content-Type: application/json" \
-d '{"vm_id": 105}'
```

These examples demonstrate how the LXC AutoScale API can be integrated into your daily routine, automating tasks that would otherwise require manual intervention.

---

## Installation

Expand Down

0 comments on commit 3e49201

Please sign in to comment.