Breaking a Deployment Hook0:00
Hi, this is Taylor Otwell, and in this video I want to talk about what happens when things go wrong during one of your deployments. And as you can see, our server is actually up and running right now with a default Laravel welcome screen. Let's customize this deployment and add a deployment hook that breaks the deployment. All right, so let's modify this compile routes deployment hook. And let's actually not change into the release directory. And we're going to try to run this php artisan command from the main project path, which actually doesn't contain the artisan file and will have no way to run.
Running the Deployment0:27
And we're going to try to run this artisan command from the main project path, which actually doesn't contain the artisan file and will have no way to run. So we're going to see what happens when we do this, when we break the build. All right, we're going to save that hook. And let's go ahead and go back to our project, and let's try to deploy this. All right, and a new deployment should be starting. And let's go into that deployment. Now, it's going to pull in our Composer dependencies. Everything is still up and running. We're all good. We're still with zero downtime.
Investigating the Failure0:55
Everything is still up and running. We're all good. We're still with zero downtime. And it's installing our Composer dependencies, and then we'll optimize the project and then compile the routes. But remember, this compile step is actually going to go wrong. Something is going to make the deployment fail. All right, so we're optimizing the project. And you can see this step finished with errors, so that failed. And if we look in here, you can see that it could not open the input file artisan because artisan doesn't exist in that directory.
Rollback and Zero Downtime1:19
And if we look in here, you can see that it could not open the input file Artisan because Artisan doesn't exist in that directory. Now, look what happened to the remaining steps. They were actually canceled. But what's going on in our server? We're still up on our server as well. So what happened is Envoy will actually totally cancel that deployment, and nothing will happen. Your app is still just as it was before. Nothing has been interrupted for your customers, and everything still looks great.
Fixing Hook and Redeploying1:40
Your app is still just as it was before. Nothing has been interrupted for your customers, and everything still looks great. So if we come back to our project dashboard, we can see right here that this deployment finished with errors. And we'll also have a warning icon on our dashboard that tells us something is wrong with this project. All right, so let's go ahead and fix that, and then we'll deploy again. So let's go to our deployment hooks. We will modify this hook to change into the proper release directory. Save it, and now we are ready to deploy again,
