Jump to content

Which Is The Best Way To Make A Provisioning Module With Queue On Backend


Rodrigo

Recommended Posts

Hi,

 

I'm thinking about making a custom provisioning module for my game servers since I don't use any known game server panel.

 

Since there may be some deployments that are not so fast, it's not possible to return the server data in the same call to the backend API (like multicraft does). Along with this, I want to implement a deployment queue at backend, so if 10 clients rent a server at the same time, Blesta will add a job to the backend's queue (via POST to an API) and then a job processor at backend will poll every 10 seconds for a new game-server install job.

 

The part that i'm not sure how to do is how the backend notify Blesta that the service has been activated, considering that in a worst case scenario deployment can be done 999 days later after blesta POSTed the job into backend's queue.

 

So I've been thinking about some ways to do this:

1) Magic blesta API call that I don't discover yet which allows to set service field data and mark service as active so the welcome e-mail is sent

2) Make the backend send the e-mail with service field data generated at deployment (i.e the IP address of a virtual machine, or a gameserver port ). In this case, I don't know how to send this data back to blesta, so custom data is shown at service tab.

 

 

 

 

Does anybody have a suggestion or maybe had experience developing a similar module?

 

Thanks!

 

 

 

 

Link to comment
Share on other sites

i was have almost the same case (with different needs ) in my actual module  ,  what i have do .

 

the server return a status of the task of creation (running/stopped) , what i do in the addservice function , is to look up this taskid status . if finiched go to the next task .

$finished = false;
   
    while( !$finished  ) {
     $task = $this->Tasks($module_row ,  $params  , $response) ;
    
     if ($task['status'] == "running")
      $finished = false;
     else
      $finished = true;
     
     sleep(2);
    }

with this i'm sure the task has been stopped and i can go to the next step/job .

 

for the same case , i have already request that modules should have the ability to add job task , but until now notyet implemented . but you can create a helper plugin that will create plugin with cronjob . then in the addservice function , poll the info in the database , then the cronjob sendthe jobto the server , when the task is marked as finiched , send the welcome (that shouldbe done via the plugin not the module ) , and then send the next task in the cronjob ....

 

i hope i have give you some idea to help you .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...