I am currently, over the course of the next few weeks, embarking upon a project that will allow automated domain creation with an e-commerce engine, much akin to dotblock, and with installation / configuration of the new X2CRM web application (a new project that is gaining momentum) in addition to Webmin on each domain. I would like to start by creating an installation script for X2CRM in much the same way as there is for SugarCRM (a past project, which is now included in the standard distribution of Virtualmin web app install scripts). I am currently reading up on the Virtualmin remote API but would still like to ask a few questions.
Firstly, I would like to know if it would be worthwhile to create the installation script for the web app first, for the reason that I’m not sure if it can be called just as easily/trivially through a scripted event as through a push-button command given in Virtualmin. It would need to be called with the scripted creation of each new domain, to prepare the web app for a customer.
Secondly, not wanting to reinvent any wheels, I am wondering if there are any books or online reading material (or preexisting freely-available code) for triggering Virtualmin events/commands from within a payment gateway (which I’d also like to avoid creating from scratch, if possible) or in some other automated manner. I’ve searched the forums and have thus far found a few useful threads:
Is there anything more I should know?
Thank you very much!
I would like to know if it would be worthwhile to create the installation script for the web app first
Hmm, I’m not entirely sure I follow your first question there.
Are you saying that since you want the app installed for each domain during the setup of that domain, that you aren’t sure if that warrants an Install Script?
I don’t recall if this feature is available in Virtualmin GPL or not – but take a peek in System Settings -> Server Templates -> Default – when you click the drop-down of options at the top, is there a template option named “Default Script Installers”?
That can be used to automate installing an Install Script with each Virtual Server, but that feature may only be available in Virtualmin Pro.
Secondly, not wanting to reinvent any wheels, I am wondering if there are any books or online reading material (or preexisting freely-available code) for triggering Virtualmin events/commands from within a payment gateway
I’m not aware of any existing documentation on the subject – and I hadn’t personally attempted that before.
However, you might find this here useful, it’s a list of API commands that you could use to script certain actions in Virtualmin. Using that, you may be able to write a script that does what you need, and then you could call that script during the payment process:
Also, here is the documentation for the command line API. I don’t think it’s what you want in this case, but you can at least take a peek:
That answers my question perfectly. I wasn’t aware of the feature that allows specifying default installation scripts to run when creating a new domain. One question remains (I just want to be certain): setting default scripts for domain creation will apply to domain creation through API calls as well, correct?
I’m currently looking into the documentation on the remote API. Again, thank you!
Regardless of whether the domain is being setup via the Virtualmin GUI, or the API calls – if a given Server Template is specified, the domain creation process will use that template.
That’s how tools such as the WHMCS billing application work, they create Virtualmin domains using the API, and specify a given Server Template:
Since the Default Script Installers is part of a Server Template, you just need to make sure that server template is specified when creating your domain.