Checking site status after deploying with Laravel's Envoy

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!
About the author
I am a self-taught developer currently in Salt Lake City. Currently, work in Laravel but have experience in plain PHP, PERL, and CakePHP.
Entrepreneurial VP of tech and CTO with a strong grasp of both the business and engineering. PHP developer for 10 years with experience in CakePHP and Laravel
Comments
Join the discussionNo comments yet. Be the first to comment.