At MonitorBase we've started using Laravel's Envoy to deploy our new inhouse invoice system.
For us, our invoice system is hosted on a basic AWS set up on a single server. I'll be publishing more on our deployment process but it is a little complex due to our security protocols.
After the deployment, we wanted to know if the invoice system was live and returning a 200 as it should.
(Here's our dumbed-down code with the health check to return a 200)
@setup
$healthUrl = 'https://yoursiteurl.com';
@endsetup
@servers(['server' => '127.0.0.1'])
@story('deploy')
deployCode
healthCheck
@endstory
@task('deployCode', ['on' => 'server'])
deploy
@endtask
@task('healthCheck', ['on' => 'local'])
@php
sleep(10);
$headers = get_headers($healthUrl);
$response = $headers[0];
@endphp
echo {{ $healthUrl }} - {{ $response }}
@endtask
Let me know if you have a better way!