-
Notifications
You must be signed in to change notification settings - Fork 13
Setting up module
Place files from Github under directory WHMCS_ROOT/modules/servers/scaleway
At the end, that directory should look like the following:
The following 2 steps are applicable for just one product/service! You'll have to repeat steps 2 and 3 for every configuration you want to provide to your clients. This mean thet a new product should be created for each server configuration you want provide.
Now you have to configure the module inside your WHMCS Admin Panel.
2.1. Go to Setup >> Product/Services >> Product/Services >> Create a New Product and make sure the following option are selected:
Product Type: Dedicated/VPS Server Product Group: Anything you wants Product Name : Name // this is visible to clients.
then "Continue".
Under newly created product, go the tab Module Settings and complete the fields in order to finish module configuration. The fields Token, Commercial type, Admin username and Scaleway SSH Key are mandatory! The
-
This field should be filled with the secret token provided by Scaleway. This is used to grant access to APIs in order to manage cloud servers. You'll find it at: https://cloud.scaleway.com/#/credentials?zoneId=par1 . If the table is empty, then create a new one by clicking on the "Create new token" button. It should have the following format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
-
This is a dropdown menu with the following options:
'C1' => 'C1 - ARM_4DC_2GB', 'C2S' => 'C2S - x86_4DC_8GB', //Dedicated Servers 'C2M' => 'C2M - x86_8DC_16GB', 'C2L' => 'C2L - x86_8DC_32GB', 'VC1S' => 'VC1S - x86_2SC_2GB', //VPS Servers 'VC1M' => 'VC1M - x86_4SC_4GB', 'VC1L' => 'VC1L - x86_6SC_8GB',
These options are provided by Scaleway on their control panel, just look at the names:
!!! You'll have to create a new product for every Server type you want to provide to your clients.
-
In order to update data inside WHMCS Panel, the module require the username of an active with full privileges administrator (Check WHMCS API docs if you want to understand more). So, fill this field with an active WHMCS administrator nickname. If you are the administrator, use the one used to log in.
-
Check this if you want to enable IPv6 on the selected product. PS: Check Scaleway to see if it is supported for selected Commercial Type choosen.
-
This field should be filled in the following format:
PuTTY-User-Key-File-2: ssh-rsa Encryption: none Comment: ScaleWay Public-Lines: 6 AAAAB3NzaC1yc2EAAAABJQAAAQEAzacjaGdQVnmuNDNtGI8xT+xGAHb ......................................................... 1fIKv9JwqKZwyBc3oDDvnjq4IBDFuszNOlricjNWMpL4JAeEZQ== Private-Lines: 14 AAABACFZX7AQwPkODdzhgu2f4DmlUco5caNyHFNpuwHvfFaB/eVRToEE9 .......................................................... L/s2xmUkxcxyop+MmKAn/nTm1k4NO3cZa9S3O9QYuYglCA== Private-MAC: affe529e88b4b974cc6ee321737fd47c7208c720`
What is this field for? As you may know, the new servers created by Scaleway does not have a root password set; so you can only login with a SSH Key, actually this is the SAME ssh key. Assuming that you want to resell this server, you may not want to create all servers with same SSH key then send same SSH Key to different clients. So, this script login to server, remove old SSH Key and setup a new random password. This option should work on all Debian based distributions. I have not tested for the others...
PS: The key should be set on Scaleway control panel too. Otherwise it will not work.
PS2: ** The module works even with this field empty and the server would then be accessible via SSH key you set on Scaleway credentials section.
At this point save settings and go to the tab Custom fields
Create 4 custom fields with exactly the same configuration as the following:
PS: This is important, please make sure you filled custom fields with EXACTLY SAME NAME.
The fields are:
- Server ID - used to identify scaleway server.
```
Field name : Server ID
Field type : Text Box
Description :
Validation :
Select Op. :
Marks : Admin Only, Show on Invoice
```
- Root password updated - used to check wheter root password was set or not
```
Field name : Root password updated
Field type : Text Box
Description :
Validation :
Select Op. :
Marks : Admin Only
```
- Operating system - This field allows clients to select desired server OS distribution. For now, that field have to be updated manually and periodically as Scaleway may add/remove old/new distributions.
```
Field name : Operating system
Field type : Drop Down
Description : Pick up an available operating system from the list
Validation :
Select Op. : << check bellow >>
Marks : Required field, Show on order form, Show on invoice
```
- Location - Let user select the server location (currently Paris or Amsterdam)
```
Field name : Location
Field type : Drop Down
Description : Choose one of the available locations
Validation :
Select Op. : Paris,Amsterdam
Marks : Required field, Show on order form, Show on invoice
```
** The third custom field (Operating system) is a little bit tricky! This should be filled with a list of available Images that can be choosen by user! The list should look something like the following (updated 2017-01-20)
ARM:
Ubuntu Xenial (16.04 latest),Ubuntu Precise (12.04),Ubuntu Yakkety (16.10 latest),Ubuntu Wily (15.10),Ubuntu Trusty (14.04),Cozy Cloud (beta),Webmin 1.820,Docker 1.12.2,Image Builder 1.4.3,Docker 1.12.1,Archlinux,Cozy Cloud,LEMP - Nginx+PHP+MySQL,CentOS 7 (beta),GOGS 0.9.13,Docker 1.11.1,Docker 1.10.0,Prestashop 1.6.1.5,OpenVPN
X86_64:
Ubuntu Precise (12.04),Ubuntu Trusty (14.04),Ubuntu Yakkety (16.10 latest),Ubuntu Wily (15.10),Ubuntu Xenial (16.04 latest),Cozy Cloud (beta),Webmin 1.820,Image Builder 1.4.3,Docker 1.12.2,Docker 1.12.1,Cozy Cloud,LEMP - Nginx+PHP+MySQL,Mattermost 3,CentOS 7 (beta),Dokku,GOGS 0.9.13,Docker 1.11.1,Docker 1.10.0,Prestashop 1.6.1.5,OpenVPN
Shortly, you need a list with all images names available on Scaleway.
To get that damn list, you have to choose one of the following two options:
-
Save the current progresby clicking on Save Changes button. Now, place a new order on a test user and make sure you assign this product you just created! Then go to on Test User >> Products/Services tab and you'll have something like this:
And then use the buttons shown by red border. Use GetARMimgsList if you filled Commercial type as ARM or the other one if you choosed x86_64 on Commercial type.
The result will be provided as an error module but this is fine!
Now copy that list (without last comma) and paste it on the "Operating system" custom field you've just created.
-
If you are familliar with PHP, you can use classes ScalewayApi and ScalewayImages from scaleway.php and manually fetch images. It should be something like this:
$imgHandler = new ScalewayImages("scaleway_api_access_token", "location:par1/ams1"); if( $imgHandler->getImagesByArch("x86_64 or arm") ) { $imgHandler->images = $imgHandler->remove_duplicates($imgHandler->images); $images_concat = ""; foreach ($imgHandler->images as $img) $images_concat .= $img["name"] . ","; echo $images_concat; } else { echo "Error: " . $imgHandler->queryInfo; }
Now copy that list (without last comma) and paste it on the "Operating system" custom field you've just created.
Now you can displicate this product newly created and change only required fields for the other products you may want to add!