This package can help you start and stop servers when you need them. The prime use case is to spin up extra working servers, based on a server image, that can help you process the workload on queues.
You can think of this as a sort of PHP based version of Kubernetes that has 5% of its features, but covers that 80% use case. For most PHP and Laravel developers, this package will also be easier to learn and use.
Typically, on your hosting provider, you would prepare a server snapshot, that will be used as a template when starting new servers.
After the package is configured, spinning up an extra servers is as easy as:
use Laravel\Horizon\WaitTimeCalculator;
use Spatie\DynamicServers\Facades\DynamicServers;
use Spatie\DynamicServers\Support\DynamicServersManager;
DynamicServers::determineServerCount(function(DynamicServersManager $servers) {
$waitTimeInMinutes = app(WaitTimeCalculator::class)->calculate('default');
$numberOfServersNeeded = round($waitTimeInMinutes / 10);
$servers->ensure($numberOfServersNeeded);
});
Out of the box, the package supports UpCloud. You can create your own server provider to add support for your favourite hosting service.