در حال بارگذاری ...

Creating a Project0:00

Hi, this is Taylor Otwell, and today I'd like to introduce you to Envoyer, a brand new way to deploy your PHP and Laravel applications with zero downtime. Now, I've logged into Envoyer, and we're ready to add our first project. I have a test Laravel 5 project that we can use to get started, so let's add it. All right, we'll call this test project. It is a Laravel 5 project that is hosted on GitHub, and the repository is laravel-envoyer-test. So I'm going to save that project. All right, if we manage that project, you'll see there's quite a bit of information available to you on this screen, but the thing we're interested in is adding a server. That's our first step to get started deploying our code. Now, I've created a server using Laravel Forge. Of course, you don't have to use

Adding a Server0:38

That's our first step to get started deploying our code. Now, I've created a server using Laravel Forge. Of course, you don't have to use Laravel Forge to benefit from Envoyer. Forge is just a really convenient way to create PHP servers with all the latest goodies. So let's grab that IP address. All right, and we're going to add this server within Envoyer. Let's call it our Forge server, and we'll paste in that IP address, and we want to tell Envoyer to connect as the Forge user. This is the SSH user that Envoyer will use to connect to the server. And we're going to specify our project path as home-forge-default. Now, within this default directory, Envoyer will create a few additional directories,

Installing SSH Key1:11

And we're going to specify our project path as home-forge-default. Now, within this default directory, Envoyer will create a few additional directories, one being the current directory, which contains the current release of our code that is deployed to the server. Envoyer will also create a releases directory, which contains the last six or seven releases you've made to the server. All right, so let's specify this as our first server. Envoyer is going to give us an SSH key, and we want to add this SSH key to the server so that Envoyer can connect to our server and pull down our code and deploy it to our users. So let's copy this key, and I'm going to use Laravel Forge to add it to the server. From the SSH keys tab, we'll add an Envoyer key and paste in the key that Envoyer gave us. Now, once we've added this key, within Envoyer, we can test our connection status.

Configuring Web Root1:49

From the SSH keys tab, we'll add an Envoyer key and paste in the key that Envoyer gave us. Now, once we've added this key, within Envoyer, we can test our connection status by clicking this little refresh icon next to connection status. Let's give that a shot. All right, Envoyer was able to connect to our server. Now let's revisit that project path I mentioned when we added the server. Remember, within that project path, Envoyer is going to create a current directory and a releases directory. So when you're setting up your Nginx server, you want to specify your web root as current/public instead of just your project/public. All right, so let's go to Laravel Forge, and I'll show you what I mean. When I add a site in Laravel Forge, let's just use default for the domain, since we're going to access this server via the IP address. Now, instead of public, let's

and I'll show you what I mean. When I add a site in Laravel Forge, let's just use default for the domain, since we're going to access this server via the IP address. Now, instead of public, let's say current/public. This is going to point the site always to the most current release of our code. All right, so let's add that site. Okay, and once that site is done installing, we'll go ahead and hit the site and test out the code, and then we'll deploy our code to the server. All right, so now that this site is ready to go, let's hit it right now just to see what's there, and we get our default php information screen, which we're soon going to be deploying our code on top of this. All right, so we're not going to use any of the git functions in Forge. We're going to go back to Envoyer now, and we're actually ready to deploy our code. So if I show you my test project, I just have a simple test project, and I'm going to deploy my code.

Running First Deployment3:19

going to go back to Envoyer now, and we're actually ready to deploy our code. So if I show you my test project, I just have a simple test project, and I'm going to deploy my code and we're actually ready to deploy our code. So if I show you my test project, I just have a simple hello world route that we're going to deploy out to this server. Let's try it right now. So we can just hit the deploy button, and within my deployments tab, I should see a new deployment starting, which I do. Now, I can drill down into this deployment and get lots of information about what's happening. First, Envoyer clones or downloads a new tarball of the release from GitHub, and now it's installing my composer dependencies. Now, it's going to activate a new release and purge any old releases from the server, and within any of these steps, I can view the output that Envoyer received from the server.

Enabling Auto-Deploys3:56

Now, it's going to activate a new release and purge any old releases from the server, and within any of these steps, I can view the output that Envoyer received from the server regarding the package download or my composer installation or whatever I need information on. All right, since our deployment is finished, let's go ahead and check out our code on the server. Okay, our deployment looks good to go. Let's hit this site again, and we do get our hello world route. All right, but let's make a change and deploy some fresh code, and first, I'll give you a little tip. Within your project settings, under the source control pane, I can actually check this box that says deploy when code is pushed, and this will automatically push new code out to the server anytime I push fresh code up to my source control host such as GitHub or Bitbucket. Let's save that setting. All right, and we'll head

pushed, and this will automatically push new code out to the server anytime I push fresh code up to my source control host such as GitHub or Bitbucket. Let's save that setting. All right, and we'll head back to our project. Now, let's make a change in the code. Let's say hello world 2.0 and save that change, and we'll commit it to Git. Update heading, and let's push that up. Now, we should see a fresh commit start automatically here in just a second, and there it is. Let's drill down into this deployment. All right, again, we see the Composer installation and the cloning, and of course, it will soon activate the release and purge any old releases. Now, if I hit my site during this time, I don't have any downtime whatsoever. It's cloning it into a fresh release folder first, and then it will symlink it to the current directory. All right, it looks like my project has been deployed, and we can see the fresh code is out on the server with zero downtime,

and then it will symlink it to the current directory. All right, it looks like my project has been deployed, and we can see the fresh code is out on the server with zero downtime, and it happened automatically when I pushed to GitHub. So that's a basic introduction to Envoyer. In the next few courses, we'll dive into some more impressive features.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟