Define Plans on a Virtualizor Panel | Comprehensive Guide

Posted on

Define Plans on a Virtualizor Panel | Comprehensive Guide

Define Plans on a Virtualizor Panel | Comprehensive Guide

Creating Virtual Private Servers (VPS) often involves repetitive configuration tasks. Manually defining CPU, memory, storage, and network settings for each VPS can be time-consuming and prone to errors, especially when deploying multiple servers. Virtualizor offers a streamlined solution to this challenge through its "Plans" feature. This guide provides a comprehensive walkthrough on how to Define Plans on a Virtualizor Panel to simplify VPS creation.

Instead of configuring each VPS from scratch, you can create pre-defined plans with specific resource allocations and settings. When creating a new VPS, you simply select the appropriate plan, and the VPS will be automatically configured according to the plan’s specifications. This saves time, reduces errors, and ensures consistency across your VPS deployments. The process of Define Plans on a Virtualizor Panel is detailed in the sections below.

Let’s delve into the step-by-step process of how to Define Plans on a Virtualizor Panel.

Step 1 – Adding a New plan on the Virtualizor panel

Access your Virtualizor panel by entering your server’s IP address and port (typically 4085) in your web browser. Log in using your credentials.

On the main Virtualizor page, navigate to the "Plans" menu and then select the "Add Plan" submenu from the left-hand panel. The opened page will display four sections: "General Settings", "Advanced Options", "UBC Settings", and "Network Settings".

Add Plan page
Define Plans on a Virtualizor Panel

Let’s examine each of these sections and their corresponding settings to effectively Define Plans on a Virtualizor Panel.

Step 1-1 – General Settings

The General Settings section allows you to configure core resources for your VPS plans, including CPU, memory, IP addresses, and other fundamental parameters.

General Settings
Define Plans on a Virtualizor Panel
Step 1-1-1 – Fields In General Settings
  • Plan Name: Assign a descriptive name to your plan (e.g., "Basic VPS", "Developer Plan").
  • Template: Designate this plan as a template for future plan creation.
  • Type: Select the virtualization technology (e.g., KVM, Xen, LXC).
  • Operating System: Choose the available operating systems for this plan, ensuring they are downloaded as per the Post-installation requirements in Virtualizor.
  • Disk Space: Specify the amount of disk space allocated to VPS instances created from this plan.
  • Guaranteed RAM: Define the minimum amount of RAM guaranteed to each VPS.
  • Burstable RAM: Set the maximum RAM that a VPS can utilize during periods of high demand.
  • Bandwidth: Allocate the monthly bandwidth allowance for each VPS.
  • Network Speed: Limit the network bandwidth available to the VPS. A value of 0 indicates unlimited bandwidth.
  • CPU Units: Specify the number of CPU units allocated to the VPS.
  • Cores: Define the number of virtual CPU cores for the VPS.
  • Percentage: Limit the CPU time percentage that the VPS can consume. A value of 0 disables this restriction.
  • I/O priority: Assign an I/O priority level from 0 (highest) to 7 (lowest).
  • Number of IPs: Specify the number of IPv4 addresses automatically assigned to the VPS. If left undefined, IPs must be manually assigned during VPS creation.
  • Number of IPv6 Subnets: Define the number of IPv6 subnets allocated to the VPS.
  • IPv6 Addresses: Specify the number of IPv6 addresses allocated from each subnet.
  • Internal IPs: Assign internal IP addresses.
  • Select Disk driver: Choose between virtio for virtio drivers or SCSI for disk drivers. Fstrim functions optimally with SCSI when storage is thin. If neither is selected, IDE will be used.
  • Media Groups: Assign the plan to a specific media group.
Step 1-1-2 – Checkboxes In General Settings
  • VNC: Enable VNC access for the VPS console.
  • ACPI: Enable ACPI to allow the VPS to respond to shutdown signals.
  • APIC: Enable APIC to improve performance in virtualized AMD64 and Intel 64 guests.
  • PAE: Enable Physical Address Extension mode to allow 32-bit guests to address more than 4 GB of memory.
  • Ploop: Create the VPS with the Ploop format.

After configuring the General Settings, proceed to the "Advanced Options" section.

Step 1-2 – Advanced Options

The Advanced Options section allows you to configure more granular settings for your VPS plans, including IP pools, web control panels, and security settings.

Advanced Options
Define Plans on a Virtualizor Panel
  • IP Pool: Select the IP pools to assign to this plan. (Optional)
  • Web Control Panel: Automatically install a selected web control panel (e.g., cPanel, Plesk, DirectAdmin) on the VPS.
  • Recipe: Select a recipe to execute inside the VPS after creation.
  • OS Reinstall Limit: Limit the number of times a VPS can be reinstalled per month.
  • Managed by Admin: Restrict VPS management to administrators only.
  • Disable password authentication: Enhance security by disabling password-based authentication.
  • CPU Threshold: Configure CPU usage threshold alerts for administrators.

Step 1-3 – Network Settings

The Network Settings section allows you to configure network-related parameters for your VPS plans, such as upload speed, bandwidth suspension, and DNS nameservers.

Network Settings
Define Plans on a Virtualizor Panel
  • Upload Speed: Set the maximum upload speed for the VPS. Enter -1 or leave blank for no limit.
  • Bandwidth Suspend: Suspend the VPS if it exceeds its allocated bandwidth.
  • DNS Nameservers: Define custom DNS nameservers, overriding those from the IP pool.

Step 1-4 – UBC Settings

The UBC Settings section is relevant for OpenVZ-based VPS deployments. It allows you to define resource limits for OpenVZ containers. For KVM or other virtualization technologies, these settings are typically not applicable.

Step 2 – Finalize Adding Plan

Once you have configured all the desired settings for your plan, click on the "Save Plan" button. The newly created plan will be displayed in the "List Plans" menu.

Added Plans
Define Plans on a Virtualizor Panel

Conclusion

This guide outlined the process of Define Plans on a Virtualizor Panel, offering a method to streamline VPS creation and management. By defining pre-configured plans, you can save time, reduce errors, and ensure consistent configurations across your VPS deployments.

If you have any questions or need assistance, please feel free to leave a comment.

Alternative Solutions

While Virtualizor’s built-in Plans feature offers a convenient solution for managing VPS configurations, alternative approaches can be employed, especially when integrating with other automation tools or requiring more complex customization. Here are two alternative solutions:

1. Infrastructure as Code (IaC) with Terraform

Terraform is an Infrastructure as Code (IaC) tool that allows you to define and manage your infrastructure using declarative configuration files. Instead of manually creating plans within Virtualizor, you can define your VPS configurations in Terraform and automate the provisioning process.

Explanation:

  • Declarative Configuration: Terraform uses a declarative approach, where you define the desired state of your infrastructure, and Terraform automatically figures out how to achieve that state.
  • Automation: Terraform automates the creation, modification, and deletion of infrastructure resources.
  • Version Control: Terraform configurations can be stored in version control systems like Git, allowing you to track changes and collaborate with your team.
  • Modularity: Terraform allows you to create reusable modules for common infrastructure components, making it easier to manage complex deployments.

Code Example:

resource "virtualizor_vps" "example" {
  hostname = "example-vps"
  plan     = "Basic VPS" # Assuming "Basic VPS" is a plan already defined in Virtualizor
  os       = "centos-7-x86_64" # Replace with your OS template
  password = "your_secure_password"
  # Additional settings can be configured here
}

Explanation of Code:

  • resource "virtualizor_vps" "example": Defines a Virtualizor VPS resource named "example".
  • hostname = "example-vps": Sets the hostname of the VPS.
  • plan = "Basic VPS": Specifies the Virtualizor plan to use for the VPS. It’s crucial that this plan exists and is configured within the Virtualizor panel.
  • os = "centos-7-x86_64": Sets the operating system template for the VPS.
  • password = "your_secure_password": Sets the root password for the VPS.

Benefits:

  • Centralized Configuration: All infrastructure configurations are stored in a single place.
  • Automation: Simplifies the provisioning and management of VPS instances.
  • Version Control: Enables tracking changes and collaboration.
  • Idempotency: Ensures that applying the same configuration multiple times results in the same desired state.

2. API-Driven Automation with Python

Virtualizor provides an API that allows you to interact with the platform programmatically. You can use Python or other scripting languages to automate VPS creation and management based on your specific requirements.

Explanation:

  • API Interaction: Python scripts can interact with the Virtualizor API to create, modify, and delete VPS instances.
  • Custom Logic: Python allows you to implement custom logic for complex deployment scenarios.
  • Integration: Python can be easily integrated with other automation tools and systems.

Code Example:

import requests
import json

def create_vps(api_url, api_key, api_pass, hostname, plan, os, password):
  """
  Creates a VPS using the Virtualizor API.
  """
  params = {
      'api': 'json',
      'apikey': api_key,
      'apipass': api_pass,
      'act': 'create',
      'hostname': hostname,
      'plan': plan,
      'osid': os, # Operating system ID, needs to be found through the API
      'rootpass': password
  }

  try:
      response = requests.post(api_url, data=params, verify=False) # Disable SSL verification for simplicity, not recommended for production
      response.raise_for_status()  # Raise HTTPError for bad responses (4xx or 5xx)
      data = json.loads(response.text)

      if data['done'] == 1:
          print(f"VPS '{hostname}' created successfully!")
      else:
          print(f"Error creating VPS: {data['error']}")

  except requests.exceptions.RequestException as e:
      print(f"Request failed: {e}")
  except json.JSONDecodeError:
      print("Failed to decode JSON response.")

# Configuration (replace with your actual values)
API_URL = 'https://your_virtualizor_server:4085/index.php'
API_KEY = 'YOUR_API_KEY'
API_PASS = 'YOUR_API_PASS'

# VPS details
HOSTNAME = 'test-vps-01'
PLAN = 'Basic VPS'
OS_ID = 'centos-7-x86_64'
PASSWORD = 'YourSecurePassword'

# Create the VPS
create_vps(API_URL, API_KEY, API_PASS, HOSTNAME, PLAN, OS_ID, PASSWORD)

Explanation of Code:

  • The code uses the requests library to make HTTP POST requests to the Virtualizor API. You may need to install it using pip install requests.
  • create_vps function takes the API URL, API credentials, and VPS parameters as input.
  • The params dictionary contains the API parameters required for creating a VPS.
  • The code sends a POST request to the API with the specified parameters.
  • The response is parsed as JSON, and the code checks the done field to determine if the VPS creation was successful.
  • Error handling is included to catch potential exceptions.
  • Important: This code disables SSL verification (verify=False) for simplicity. Do not use this in production. You should properly configure SSL verification for secure communication. Also, find the proper osid through Virtualizor’s API, not just the string.

Benefits:

  • Flexibility: Allows you to implement custom logic for complex deployments.
  • Integration: Easily integrates with other automation tools and systems.
  • Programmability: Provides full control over the VPS creation process.

These alternative solutions offer greater flexibility and control over VPS deployments compared to Virtualizor’s built-in Plans feature. Choosing the right approach depends on your specific requirements and technical expertise.

Leave a Reply

Your email address will not be published. Required fields are marked *