Skip to content

Repository files navigation

LXC AutoScale - Automated Proxmox LXC Container Installer

πŸš€ One-command installer for LXC AutoScale with automatic container detection, locale selection, and professional UI setup.

Built using the Community-Scripts framework for seamless Proxmox VE integration.


🎯 Features

  • βœ… One-Command Installation - Single bash command to deploy everything
  • βœ… Automatic LXC Detection - Automatically finds and configures existing containers
  • βœ… Multi-Language Support - English and Turkish locale options
  • βœ… Professional UI - Modern dark-themed web interface on port 8080
  • βœ… SSH Key Management - Automatic SSH key generation and setup
  • βœ… Community-Scripts Framework - Whiptail menus, advanced/default modes
  • βœ… No Telemetry - Privacy-focused, no data collection

πŸ“‹ Requirements

  • Proxmox VE 8.4.x or 9.0.x
  • Root Access to Proxmox host
  • Internet Connection for downloading packages

πŸš€ Quick Start

Run this single command on your Proxmox host:

bash <(curl -s https://raw.githubusercontent.com/droltr/lxc-auto-scaler/main/lxc-autoscale.sh)

The installer will:

  1. Show interactive menu (Default/Advanced mode)
  2. Detect existing LXC containers
  3. Ask for locale preference (EN/TR)
  4. Create and configure the container
  5. Install LXC AutoScale
  6. Setup web interface
  7. Display access information

πŸ“Š What Gets Installed

LXC Container Specifications

  • OS: Debian 13 (Trixie)
  • Type: Unprivileged
  • CPU: 2 cores (configurable)
  • RAM: 2048 MB (configurable)
  • Disk: 8 GB (configurable)
  • Network: DHCP (configurable)

Software Components

  • LXC AutoScale - Resource auto-scaling daemon
  • Python 3 - Runtime environment
  • Nginx - Web server (port 8080)
  • SSH Server - Remote access
  • Original UI - Web dashboard from upstream project

🎨 Web Interface

After installation, access the dashboard at:

http://<CONTAINER_IP>:8080

Features:

  • πŸ“ Live log viewer (last 100 lines)
  • πŸ“ˆ Container metrics

πŸ”§ Post-Installation

1. Add SSH Key to Proxmox Host

The installer displays an SSH key at the end. Run the provided command on your Proxmox host:

echo 'ssh-rsa AAAA...' >> /root/.ssh/authorized_keys

2. Configure Container List

Edit the configuration file:

nano /etc/lxc_autoscale/lxc_autoscale.yaml

Add container IDs to monitor:

TIER_DEFAULT:
  lxc_containers: [101, 102, 103]  # Your container IDs

3. Restart Service

systemctl restart lxc_autoscale

πŸ”§ Post-Installation (REQUIRED)

⚠️ IMPORTANT: These steps are MANDATORY for the system to work

The installation completes successfully, but AutoScale cannot function until you complete these steps:

1. Add SSH Key to Proxmox Host (CRITICAL)

The installer displays an SSH public key. This key MUST be added to your Proxmox host:

# On Proxmox host (NOT in the container):
echo 'ssh-rsa AAAA...' >> /root/.ssh/authorized_keys

Why: The AutoScale service runs inside the LXC container but needs to execute pct commands on the Proxmox host via SSH.

Test the connection:

# Inside the container:
ssh root@PROXMOX_IP "pct list"

If this works, SSH is configured correctly.

2. Add Container IDs to Monitor (CRITICAL)

Edit the configuration file inside the container:

# Inside the container (pct enter CONTAINER_ID):
nano /etc/lxc_autoscale/lxc_autoscale.yaml

Find the TIER_DEFAULT section and add your container IDs:

TIER_DEFAULT:
  cpu_upper_threshold: 80
  cpu_lower_threshold: 20
  memory_upper_threshold: 70
  memory_lower_threshold: 20
  min_cores: 1
  max_cores: 4
  min_memory: 512
  max_memory: 4096
  lxc_containers: [101, 102, 103]  # ← ADD YOUR CONTAINER IDs HERE

Get container IDs from Proxmox:

# On Proxmox host:
pct list

Important: Do NOT add the AutoScale container itself to the list!

3. Restart Services

After adding container IDs:

# Inside the container:
systemctl restart lxc_autoscale
systemctl restart lxc_autoscale_ui

4. Verify Everything Works

# Check service status
systemctl status lxc_autoscale
systemctl status lxc_autoscale_ui

# Watch the logs (you should see container metrics)
tail -f /var/log/lxc_autoscale.log

Expected log output:

Container 101 - CPU usage: 25.3%, Memory usage: 45.2%
Container 102 - CPU usage: 10.1%, Memory usage: 30.5%

If you see pct: not found errors, SSH key was not added correctly.


πŸ› Troubleshooting

Web UI Not Accessible

Symptom: Cannot access http://CONTAINER_IP:8080

Check:

# Is Flask UI running?
systemctl status lxc_autoscale_ui

# Is port 5000 listening?
ss -tlnp | grep 5000

# Is Nginx running?
systemctl status nginx

# Check Nginx error log
tail -20 /var/log/nginx/error.log

Common Issues:

  • Flask UI service failed to start: Check /var/log/flask_ui.log if it exists
  • Port 5000 not listening: Service may be restarting, wait 10 seconds
  • 502 Bad Gateway: Flask UI starting up, refresh after a few seconds

AutoScale Service Not Working

Symptom: Containers not being scaled

Check:

# View service logs
journalctl -u lxc_autoscale -n 50

# Check configuration
cat /etc/lxc_autoscale/lxc_autoscale.yaml

# Test SSH connection to Proxmox host
ssh root@PROXMOX_IP "pct list"

Common Issues:

  • SSH key not added to Proxmox host
  • No containers configured in YAML
  • Proxmox host IP incorrect in config

Container Login Has No Prompt

Symptom: Can execute commands but no prompt visible

Temporary Fix:

export PS1='\u@\h:\w\$ '

Permanent Fix: Add to /root/.bashrc:

echo 'export PS1="\u@\h:\w\$ "' >> /root/.bashrc

πŸ“– Configuration

Main configuration file: /etc/lxc_autoscale/lxc_autoscale.yaml

Key settings:

  • CPU/Memory Thresholds - When to scale up/down
  • Min/Max Resources - Resource limits
  • Check Interval - Polling frequency (default: 5 minutes)
  • Container List - Which containers to manage
  • Off-Peak Hours - Resource optimization schedule

For detailed configuration options, see the LXC AutoScale Documentation.


πŸ› οΈ Service Management

# Check service status
systemctl status lxc_autoscale

# View live logs
journalctl -u lxc_autoscale -f

# Restart service
systemctl restart lxc_autoscale

# Stop service
systemctl stop lxc_autoscale

# View log file
tail -f /var/log/lxc_autoscale.log

πŸ”„ Updating

To update LXC AutoScale to the latest version:

# SSH into the container
pct enter <CONTAINER_ID>

# Update repository
cd /opt/lxc-autoscale
git pull

# Restart service
systemctl restart lxc_autoscale

πŸ—‘οΈ Uninstallation

To remove the container:

# Stop the container
pct stop <CONTAINER_ID>

# Delete the container
pct destroy <CONTAINER_ID>

πŸ™ Credits

This installer is built upon the excellent work of:

LXC AutoScale

Community Scripts


πŸ“ License

MIT License - See LICENSE file for details


🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Areas for Improvement

  • Additional locale support
  • Enhanced UI features
  • Configuration templates
  • Documentation improvements

πŸ› Issues & Support


πŸ“š Documentation


⚠️ Disclaimer

I’m new to this kind of work, so if I’ve violated any rules, I apologize in advance to those concerned. I think I may have made a mistake with the name; it should probably end with β€œinstaller.” If this will cause a serious issue, we can change it. I hope I have properly credited the original code owners in the correct place. I did not intend to make any changes to their code, but if I accidentally did (with AI – Claude), I would like to apologize for that as well. Please excuse my inexperience. This tool is provided as-is without any warranty. Always test in a non-production environment first. The author assumes no responsibility for any damage or issues that may arise from using this installer.


🌟 Star History

If this project helped you, please consider giving it a ⭐!


Made with ❀️ for the Proxmox community

About

One-command installer for LXC AutoScale (https://github.com/fabriziosalmi/proxmox-lxc-autoscale) on Proxmox VE. Configures SSH, sets up web dashboard for resource auto-scaling with CPU/memory monitoring. Built on Community-Scripts framework (https://github.com/community-scripts/ProxmoxVE).

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages