Member-only story
Dynamic Management of OVH Instances in Laravel PHP
3 min readDec 20, 2024
In our sale events platform, Auctibles, we use the OVH public cloud to run a dynamic set of compute instances running the LiveKit WebRTC video server. We vary the number of instances based on the number of video-streaming sale events.
As our platform is built using the Laravel PHP framework, we use the php-ovh SDK to manage instances.
We define an OVH
service where all interaction with the OVH public cloud will occur.
The Service
use \Ovh\Api;
class OVH
{
private $ovh;
private $flavor; // aka VM type based on size
private $image_name;
private $datacenter_region_name;
public function __construct()
{
$this->flavor = config('ovh.flavor');
$this->image_name = config('ovh.image_name');
$this->datacenter_region_name = config('ovh.region');
$this->ovh = new Api(
config('ovh.OVH_APPLICATION_KEY'),
config('ovh.OVH_APPLICATION_SECRET'),
config('ovh.OVH_ENDPOINT'),
config('ovh.OVH_CONSUMER_KEY')
);
}
}
After creating an instance, we launch a job to monitor progress:
WaitInstance::dispatch($instance_id, 'started');