DigitalOcean Droplets For WHMCS
From ModulesGarden Wiki
(Difference between revisions)
|
|
Line 303: |
Line 303: |
| * '''Image''' - Select the image of the system that will be installed on Droplet. | | * '''Image''' - Select the image of the system that will be installed on Droplet. |
| * '''Additional Volumne Size''' - Allows you to create and attach additional SSD storage volume to Droplet in the provided size (in GB).<br/>If left empty or entered 0 then volume will not be created and attached. [https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-block-storage Here] you can find more information about DigitalOcean's Block Storage. | | * '''Additional Volumne Size''' - Allows you to create and attach additional SSD storage volume to Droplet in the provided size (in GB).<br/>If left empty or entered 0 then volume will not be created and attached. [https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-block-storage Here] you can find more information about DigitalOcean's Block Storage. |
− | * '''User Data''' - Choose the '' 'cloud-config' '' file or '' 'Bash' '' script which will be be used to configure the Droplet on first boot.<br/>The script you want to provide has to be located in the '' '/modules/servers/DigitalOceanDroplets/storage/userDataFiles/' '' directory and should be ''.sh'' file type.<br/> You can learn more [https://www.digitalocean.com/community/tutorials/how-to-use-cloud-config-for-your-initial-server-setup here] how to use ''cloud-config'' for initial server setup. | + | * '''User Data''' - Choose the '' 'cloud-config' '' file or '' 'Bash' '' script which will be be used to configure the Droplet on first boot.<br/>The script you want to provide has to be located in the '' '/modules/servers/DigitalOceanDroplets/storage/userDataFiles/' '' directory and should have ''.sh'' file extension.<br/> You can learn more [https://www.digitalocean.com/community/tutorials/how-to-use-cloud-config-for-your-initial-server-setup here] how to use ''cloud-config'' for initial server setup. |
| * '''Snapshots Limit''' - Snapshots provide a full copy of a Droplet, saving everything from a Droplet’s disk to a disk image. Here you can provide | | * '''Snapshots Limit''' - Snapshots provide a full copy of a Droplet, saving everything from a Droplet’s disk to a disk image. Here you can provide |
| * '''Tags''' - Here you can apply custom labels for the Droplet. Read more about tags [https://www.digitalocean.com/community/tutorials/how-to-tag-digitalocean-droplets here]. | | * '''Tags''' - Here you can apply custom labels for the Droplet. Read more about tags [https://www.digitalocean.com/community/tutorials/how-to-tag-digitalocean-droplets here]. |
Revision as of 11:27, 25 June 2018
DigitalOcean Droplets For WHMCS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
|
✔ Create/Suspend/Unsuspend/Terminate Server
|
✔ Change Package - Supports Configurable Options
|
✔ Change Password - Xen Virtualization Only
|
✔ View Server Status And Details
|
✔ View List Of Scheduled Tasks
|
✔ Configure Client Area Features Per Product
|
✔ Define Backup Quantity Limit
|
✔ Execute Custom Scripts On Boot
|
✔ Choose Welcome Email For VM Creation
|
✔ Run Extended Connection Test
|
✔ View Server Status And Details
|
✔ Start/Stop/Pause/Unpause/Resume/Rebuild Server
|
✔ Reboot Server - Soft/Hard
|
✔ Toggle VM Protection From WHMCS Termination And Rebuilding
|
✔ Change Password For Xen Virtualization
|
✔ Access noVNC VNC, RDP, SPICE Or Serial Console
|
✔ Create/Restore/Delete Backups
|
✔ View/Add/Delete Firewall Rules
|
✔ Download Public & Private SSH Keys
|
✔ View List Of Scheduled Tasks
|
✔ View Volumes Information
|
✔ Receive Email Notification After VM Creation
|
✔ Ceilometer (Required For Advanced Billing For WHMCS)
|
✔ Automated Generation Of SSH Keys - Public SSH Key Is Injected To VM Automatically
|
✔ Integrated With Advanced Billing For WHMCS v3.2.2 And Later - Actual Server Resource Usage Billing (read more)
|
✔ Integrated With Server Allocator For WHMCS - Automatic Assignment Of Specified Servers To Products (read more)
|
✔ Supports Cloud-Init Scripts
|
✔ Supports DigitalOcean Queens and Previous
|
✔ Supports DigitalOcean Gnocchi
|
✔ Supports PHP 5.6 Up To PHP 7.2
|
✔ Supports WHMCS Template Six
|
Installation and Configuration
This tutorial will show you how to successfully install and configure DigitalOcean Droplets For WHMCS.
We will guide you step by step through the whole installation and configuration process.
|
Installation
1. Log in to our client area and download the module.
|
2. In the downloaded file you will find two packages that support different PHP versions. As presented on the screen below, the first one is dedicated to PHP 5.6 up to PHP 7.0, while the second one is aimed at PHP 7.1 up to PHP 7.2. It does not apply to open source versions.
Note: You can check the current PHP version in your WHMCS. To do so, proceed to 'Utilities' › 'System' › 'PHP Info'.
|
3. Extract the downloaded file and choose the one with the right PHP version. Upload and extract the PHP file into the main WHMCS directory.
The content of PHP version files should look like this.
|
4. When you install DigitalOcean Droplets For WHMCS for the first time you have to rename 'license_RENAME.php' file.
File is located in 'modules/servers/DigitalOceanDroplets/license_RENAME.php' . Rename it from 'license_RENAME.php' to 'license.php' .
|
5. In order to configure your license key, you have to edit the previously renamed 'license.php' file.
Enter your license key between quotation marks as presented on the following screen.
You can find your license key in our client area → 'My Products' .
|
6. Now, set up the 'storage' folder as recursively writable.
This folder is available at '/your_whmcs/modules/servers/DigitalOceanDroplets/' .
|
7. The last step is setting up a two cron jobs.
|
Configuration of Server
8. Now, we will show you how to configure a new product.
Go to the 'Setup' → 'Products/Services' → 'Servers' and press 'Add New Server' .
|
9. Next, enter your server name and select 'DigitalOcean Droplets' from type.
Now in the 'Password' field provide your DigitalOcean API token and check the connection. If successful save changes.
Note: To find your API token log in to your DigitalOcean panel and go to the API section where you can generate a new one. You will need a token with read and write permissions. Remember to copy and store it in the safe place because it will not be shown anymore in the panel. Click here to see an example where to find it.
|
10. It is time to create a server group. To do so, click on 'Create Server Group' .
|
11. Enter a name, click on your previously created server, press 'Add' and afterward 'Save Changes' .
|
Configuration of Product
12. In order to create and configure a product, go to the 'Setup' → 'Products/Services' → 'Products/Services' .
Click on 'Create a New Group' .
|
13. Enter product group name and press 'Save Changes' .
|
14. When you have a product group, you can create your product.
To create a product click on 'Create a New Product' .
|
15. Afterward, choose your product group and type from the dropdown menus, enter your product name and press 'Continue'.
|
16. Now, go to the 'Module Settings' section, choose both 'DigitalOceanDroplets' and your previously created server group from the dropdown menus.
Module should automatically save and reload settings. If not, click on 'Save Changes' manually.
|
|
17. Now you can start configuring the settings of the Droplet you sell.
In a similar way as when creating virtual machine in your DigitalOcean panel, you can configure such options as:
- Region - Select the data center region. More distant server locations may increase the server's latency without providing any practical benefits to clients.
- Size - Choose the size slug based on which resources will be allocated to the Droplet. You can read more about size slugs indications here.
Note: If you want to change their names to more user-friendly, you can do it in a language file.
- Image - Select the image of the system that will be installed on Droplet.
- Additional Volumne Size - Allows you to create and attach additional SSD storage volume to Droplet in the provided size (in GB).
If left empty or entered 0 then volume will not be created and attached. Here you can find more information about DigitalOcean's Block Storage.
- User Data - Choose the 'cloud-config' file or 'Bash' script which will be be used to configure the Droplet on first boot.
The script you want to provide has to be located in the '/modules/servers/DigitalOceanDroplets/storage/userDataFiles/' directory and should have .sh file extension. You can learn more here how to use cloud-config for initial server setup.
- Snapshots Limit - Snapshots provide a full copy of a Droplet, saving everything from a Droplet’s disk to a disk image. Here you can provide
- Tags - Here you can apply custom labels for the Droplet. Read more about tags here.
- Backups - Enables automatic system-level backups. It can be used to the backup images to revert the server or create new Droplets. Click here for more information.
- Monitoring - Enables additional Droplet metrics collection, monitoring, and alerting. Here you can find out more.
- IPv6 - Enables public IPv6 networking for Droplet.
- Private Networking - Adds Droplet-to-Droplet networking, within the same region.
- Debug - Enables logging of API requests and responses to WHMCS module log which may be useful if you experience any problems with the module.
|
|
18. Afterward, set up incoming mail configuration.
Due to API limitations all email massages with Droplets credentials can only be send to your DigitalOcean profile email address set in the panel here. This applies to messages with credentials sent after Droplet creation as well as messages after password reset. The solution to this problem is email piping that will be used to receive messages sent to your DigitalOcean mailbox and then forwarded them through your templates further to your WHMCS clients.
Note: Even the module will accordingly filter the received messages from your mailbox, we recommend that you should use a separate mailbox for your main DigitalOcean profile account to avoid any issues with non DigitalOcean content.
After setting up the dedicated mailbox, provide its valid creadentials below and test whether the connection is established correctly.
|
|
After successfull connection remember to save your module settings. From now the cron set at the last point of the module's installation should periodically check that mailbox for DigitalOcean messages. If any new received it will be then convert to your email template and send to corresponding client. These default email templates for product creation and password reset can be selected below. To edit their content, go to your WHMCS email templates section and edit them according to your needs.
|
19. At the end of the configuration you can decide if you want to generate configurable options for the product.
The configurable options can be used by your clients to select each Droplet parameters individually during order placement. Otherwise if not created, then the fixed parameters specified in the eariel configuration will be used. More information about the WHMCS configuration options can be found here.
|
|
20. Mark a security group from 'Use Security Groups' and select 'Console Type' .
If you wish to use SSH keys, leave 'Inject SSH Key' marked (virtualization has to support the 'Inject File' feature).
In order to use passwords for your VM, leave 'Password Management' marked (virtualization has to support the 'Set Admin Pass' feature).
Please make sure, that virtualization used by you supports mentioned actions.
Full list of supported features can be found here.
Important: It is recommended to leave 'Delete SSH Private Key' marked.
The following types of console can be chosen: 'VNC', 'RDP', 'SPICE' and 'Serial' .
|
|
21. You can also take advantage of the dedicated Volume and set it as the location of your Virtual Machine Disk,
To do so, make sure to tick the Use Volumes checkbox and enter the desired number into the Default Volume Size field.
Note that once this option is enabled, your clients will no longer have access to the Backup and Rescue functions, so you may as well leave the respective fields empty.
|
22. Next, select features available at the client area.
Mark the checkbox next to a feature in order to enable it.
|
23. In addition, you can also choose whether you want to send a welcome email after the VM has been succesfully created by cron.
This feature can prove useful if you want clients to receive the notification once their VM is ready rather than immediately after product activation. If you decide on this option, we suggest that you also set the standard WHMCS configuration of the 'Welcome Email' to 'None' in the 'Details' tab of a product. Otherwise, the customer will receive both emails - after the product has been activated and after the VM has been succesfully created on DigitalOcean.
Press 'Save Changes' when you are done.
|
VPS With Predefined Resources
Our module allows you to offer DigitalOcean Droplets to your clients in two ways, with either predefined or configurable resources.
In this section we will show you configuration of VPS with predefined resources.
Detailed information about configuration of VPS with resources chosen by a client can be found here.
|
23. Select a 'Default Flavor' and 'Default VM Image' .
'Default Flavour' defined resources assigned to a VM while 'Default VM Image' allows you to choose the VM image used to create a new VM.
|
Congratulations! You have just finished the installation and configuration of the module with predefined resources.
|
VPS With Configurable Resources
24. Preparing VPS with configurable options consists of pressing 'Generate default' as shown on the following screen.
It will prepare default configurable options which can be afterward easily edited as described in this article.
Important Configurable option 'flavor|Flavor' will be overwritten by 'disc|Disc' , 'ram|RAM' and 'vcpus|VCPUs' .
Therefore, you can solve this in three ways:
- Remove 'disc|Disc' , 'ram|RAM' and 'vcpus|VCPUs' configurable option and rely completely on 'flavor|Flavor' .
- Remove 'disc|Disc' and 'vcpus|VCPUs' , and allow 'flavor|Flavor' being overwritten by 'ram|RAM' (multiple combinations allowed here).
- Remove 'flavor|Flavor' and rely completely on 'disc|Disc' , 'ram|RAM' and 'vcpus|VCPUs' .
Note: The second and the third options results in creation of a new flavor on your server each time a new order is made.
|
Custom Config Scripts
25. In this area, you can write a custom script using Cloud-Init and arrange it to be executed on newly created VMs.
This way you can automate your work instead of making all kinds of specific images for specific tasks manually.
Important notes:
- Scripts can be written in standards like Bash or YAML.
- Initial scripts have to be supported by VPS operating system to be executed properly.
- Scripts should be used only by advanced users. The incorrect usage of the scripts may damage your system!
|
On the example below, we will show an examplary script responsible for setting the password to 'newpass01' for the Ubuntu root user.
You can achieve it by writing:
chpasswd:
list: |
ubuntu:newpass01
expire:False
|
You can configure scripts in the same format, but for clients' individual choice when ordering the product.
All you need to do is add a new configurable option and assign it to the DigitalOcean Droplets product.
Note: these scripts are executed regardless of the script specified in the module settings.
The easiest way is through the edition of existing 'Configurable options for the DigitalOcean Droplets' group, and adding the new configurable option there.
For example, if you want to offer the pre-installed PHP version depending on a client's choice, you can add a new option named script_PHP|PHP version and then define multiple options, like on the screenshot below:
|
Afterward, your clients can choose during the ordering process:
|
Using this method, you can perform assorted actions on newly created machines, e.g.: modifying files, preinstalling & preconfiguring software, executing any statements that would normally be executed via the terminal.
The general rule is that configurable option names should begin with script_prefix to be recognized as containing a custom script.
Then, choices under the option have their own names which are matched with a name of existing file with the corresponding script under the
yourWHMCS/modules/servers/DigitalOceanDroplets/scripts path.
Note that files with scripts have to have exactly extension corresponding to the given entries in the configurable options.
In the example above, there are two options: php5.yml and php7.yml, therefore it makes the module read corresponding files:
- modules/servers/DigitalOceanDroplets/scripts/php5.yml
or
- modules/servers/DigitalOceanDroplets/scripts/php7.yml
You can add many scripts in the exact way.
|
Management
DigitalOcean Droplets For WHMCS allows your customers to manage their DigitalOcean Droplets via the client area in your WHMCS system.
You can monitor and manage each product from your WHMCS admin area.
1. Configurable options which enables you to view current VPS resources and change VPS specifications through changing configurable options and pressing 'Change Package' .
2. Module commands enables you to manage VPS status.
3. Here you can find VPS details and refresh them through pressing the 'Refresh Details' icon.
4. Scheduled tasks status can be found in this table.
5. In marked custom fields you can find IDs of VM and private flavor.
|
If you decided to select the Use Volumes feature, you will see an additional section named Volumes.
|
Ordering
Owing to configurable options, you are able to offer a product which your clients can tailor according to their needs.
Additionally, you are able to set up pricing for each configurable option, which make your offer even more competitive.
Important: VPS is not created immediately after ordering 'Create' . Therefore, it is wise to inform your clients about the delay.
|
Client Area
Client area interface of DigitalOcean Droplets should look like the one on the screen below. As you can see, the control panel contains useful options needed for managing a VPS.
Module allows your customers to easily start/stop, pause/unpause, resume, soft reboot, hard reboot and reset network of their servers through pressing the specific button.
Clients can also rebuild the server, access noVNC console, create a backup and view scheduled tasks.
At 'Tasks' your customers can view all requested tasks that was not yet completed.
Each task has additional information bounded to them, like a type of task, attempts to perform tasks or a last returned response.
|
Volumes
In case your DigitalOcean Droplets is running with the Use Volumes option, the client area may look a bit different. It will now include an additional section named Volumes
|
Rebuild
The rebuild feature allows your clients to change a server image.
Press the 'Rebuild' button as shown on the following screen in order to move to the rebuild page.
|
To reinstall your server, choose an image and confirm through clicking on 'Rebuild' .
|
Rescue Mode
The rescue mode provides a mechanism for a VM access even in case the VM's image renders the instance inaccessible - e.g. if instance's filesystem becomes corrupted.
The rescue VM will be launched to permit the user to fix their VM.
|
Before you continue please note that the rescue VM will be set up with the same network configuration as the real VM.
Moreover, a new root password will be generated and the VM status will change to 'RESCUE'.
The new VM will also have a rescue image as the primary filesystem and the secondary filesystem would be the original VM's primary filesystem.
|
When you want to disable the rescue mode, click the 'Unrescue' buton. TheVM status will then also return to 'ACTIVE'.
|
Backups
Your customers can also create a backup of VPS. To do so, press the 'Backups' button.
|
Now, choose a backup name and click 'Backup Now' .
|
To restore a VPS from backup, simply press the 'Restore' button next to it.
As you may notice on the following screen, presented earlier the 'First Backup' backup was replaced with the 'New Backup' .
It was caused by a backup routing feature which was triggered by reaching the backups file limit.
|
noVNC Console
One of the most interesting functionality is a noVNC console where your clients can remotely manage their server.
To access it, simply click on the 'Console' button.
|
noVNC is a browser based VNC client. It was implemented using HTML5 Canvas and WebSockets.
|
VM Protection
In the product configuration page you can enable the 'Protect VM After Creation' option which prevents the termination or rebuilt of VM.
The selected status of this protection will be applied to both admin area and client area.
|
Moreover, if the 'Protect VM' option is enabled in the client area, the client will be empowered to toggle the current protection status.
|
Firewall
The firewall management page allows your customers to view, add or delete existing rules on a security group assigned to the product.
To add a new firewall rule, use the button marked on the following screen.
|
Next, choose the rule type (TCP or UDP), direction (inbound or outbound) and ether type (IPv4 or IPv6). Depending on the port you choose, you will be able to add a rule for a single port only, a range of ports or all ports at once. You can also select one of the predefined ports or use a custom one. Finally, provide a single IP address or specify the range of addresses using the CIDR format (e.g. 10.10.10.1/24) and add rule description if you wish.
Press 'Add' when ready.
|
Network Configuration Cases
DigitalOcean Droplets For WHMCS allows you to set up two types of network.
The first one is a network without a floating IP address.
To set up this type of network, choose 'Public' as 'Fixed Network' and 'Disabled' as 'Floating Network' .
On the following screen you can view an exemplary topology of such network.
|
The second type of network is the network with a floating IP address.
Select 'Shared Network' as 'Fixed Network' and 'Public' as 'Floating Network' .
|
Configurable Options
In case that standard configuration is not fitting your needs, you can adjust it through configurable options.
To do so, go to 'Setup' → 'Products/Services' → 'Configurable Option' and press the edit button next to a configurable option used by your product.
Its name is 'Configurable options for your_product_name' .
|
Here you can view the products that this configurable option group is assigned to.
Now we will show you how to edit options. Let's say that you want to add an option to order VPS with 8GB (8192 MB) RAM.
To do so, edit 'ram|RAM' by pressing the edit button as shown on the screen below.
|
You will see a popup window, so make sure that your browser will not block it.
To add a new option, enter it in a textbox under all other options. If you want to replace it with an option you currently have, simply edit its text box.
Next, press 'Save Changes' .
|
Management of Billing
When you combine DigitalOcean Droplets For WHMCS with Advanced Billing For WHMCS, you will be able to set up additional billing options.
Module allows you to charge your customers based on the server resources used by them.
Note: Advanced Billing currently supports only API prior V3 (DigitalOcean Ocata). A new compatibility will be added soon.
|
With Advanced Billing module, you can also display your customers the current server resource usage, their cost, usage history and charts.
|
Tips
1. Due to some requests may take time to be completed, we implemented 'Scheduled Tasks' .
Tasks visible at 'Scheduled Tasks' are subsequently performed by a cron job.
Full list of tasks supported by 'Scheduled Tasks' are: create, terminate, change package, remove IP address and remove backup.
|
2. Important: module has to use admin endpoints instead of public endpoints.
In properly configured DigitalOcean server, wget from WHMCS server should be able to get any data from any admin endpoint.
Sample successfull requests:
wget DigitalOcean:9292
--2014-03-31 09:35:24-- http://DigitalOcean:9292/
Resolving DigitalOcean(DigitalOcean)... 192.168.1.222
Connecting to DigitalOcean(DigitalOcean)|192.168.1.222|:9292... connected.
HTTP request sent, awaiting response... 300 Multiple Choices
Length: 520 [application/json]
Saving to: `index.html'
100%[==========================================================>] 520 --.-K/s in 0s
2014-03-31 09:35:24 (118 MB/s) - `index.html' saved [520/520]
wget DigitalOcean:8777
--2014-03-31 09:41:05-- http://DigitalOcean:8777/
Resolving DigitalOcean(DigitalOcean)... 192.168.1.222
Connecting to DigitalOcean(DigitalOcean)|192.168.1.222|:8777... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authorization failed.
|
3. A primary IP address is always assigned by DigitalOcean server when a VM is created Therefore, if you decide to order 2 IP addresses, then 3 addresses will be assigned. The primary one and the two additionally ordered. If you wish only one IP address to be assigned to a single product, please set the filed 'Default Number Of IP Addresses' to '0' or leave it empty in the product's 'Module Settings'.
|
Update Instructions
Essential guidance through the process of updating the module is offered here.
Keep in mind there is a quick and easy option in our client area that will let you upgrade the license of your module to an open source version at any time - and at a lower price!
To take advantage of it, simply use the License Upgrade button located on the product's page and a discounted invoice will be generated automatically.
|
Common Problems
1. When you have problems with connection, check whether your SELinux or firewall does not block ports.
|
2. In case of persisting connection problems, please make sure you have the following ports open:
8774, 35357, 9292, 5000, 8777, 9696, 8776
|