Creating Forge Account 0:00Let's get our feet wet with Laravel Forge. To get started, you first need to visit forge.laravel.com and create an account at Forge. You can choose between multiple different pricing models, and each model right now has a 5-day free trial period so that you can test Laravel Forge. Let me quickly fill out this form. Okay, so I just created my fresh Laravel Forge account, and the next thing I want to do is I want to connect GitHub to Laravel Forge so that I can use all the private and public repositories of mine and access them through Laravel Forge. So we click on Connect to GitHub, and we're done. Laravel Forge does not care where your server lives. Connecting DigitalOcean Provider 0:41So we click on Connect to GitHub, and we're done. Laravel Forge does not care where your server lives. In order to connect Laravel Forge with your custom server provider, you need to either choose between DigitalOcean, Linode, AWS, or Vultr, or connect your own custom VPS server. In this example, we're going to use DigitalOcean. So to get started with it, we need our DigitalOcean access token. So head over to DigitalOcean, go to the API section, and generate a new token. So now we can use this token, copy it, paste it in here, and Laravel Forge is now available to create servers on DigitalOcean for us. That's great. Configuring Server Settings 1:35to create servers on DigitalOcean for us. That's great. So let's start with this by using DigitalOcean with the credentials that I just pasted. Laravel Forge will generate a random server name for you, so we'll just stick with it. And now you can choose between the server size. So I will just use the $5 monthly server that is available with DigitalOcean. And because I am from Germany, I'm going to use the Frankfurt region for this. You can also choose between multiple different PHP versions, but we're going to stick with the latest, which is PHP 7.2 right now. And we want to use MySQL.the latest, which is PHP 7.2 right now. And we want to use MySQL. So create our server. Laravel Forge will now instruct DigitalOcean to create the server with the settings that we provided. And here we see the sudo password and the database password, but you also receive those passwords via email. So now we just give Laravel Forge a couple minutes to create the server and provision it with the initial setup. Alright, so Laravel Forge now created the server on DigitalOcean and installed all the Reviewing Default Site 2:46it with the initial setup. Alright, so Laravel Forge now created the server on DigitalOcean and installed all the required tools on the server so that you can directly start working with it. This includes not only Nginx and PHP, but also services like Redis, Beanstalk, and other useful tools that you might use in your Laravel or PHP application in general. So if we now go into our server configuration, we see that we already have an active site. And you can think of sites as applications that run on your server. So this could either be one or multiple. So if we want to take a look at our default site right now, we can click here and we see that there is just a PHP InfoSight running with the latest PHP version currently available Deploying GitHub Repository 3:38So if we want to take a look at our default site right now, we can click here and we see that there is just a PHP InfoSight running with the latest PHP version currently available and a lot of useful PHP extensions already installed for us. Since we connected our source control system, in this case GitHub, with Laravel Forge, we are able to clone our GitHub repositories directly to these sites that live on our servers. So for the demonstration purpose, I created a very simple Laravel CRUD application that is available at beyondcode.forgedemo. Now if we want to use this application on our site, we just go to the site settings, go to apps, and use the Git repository. So the repository that we want to use is beyondcode.forgedemo.go to apps, and use the Git repository. So the repository that we want to use is beyondcode.forgedemo. The branch is master. And we want to install the composer dependencies and then install the repository. Now Forge has cloned the repository for us and installed the composer dependencies. If we want to take a look at our account and application status, we can just click on this icon right here. And whoops, we see an error. It's because my example application uses database migrations and tries to access the database, but the migrations have not been executed yet. Running Deployment Script 5:11It's because my example application uses database migrations and tries to access the database, but the migrations have not been executed yet. So if we go back to Forge, we can see the deployment script. And this is the script that gets run every time you click on deploy now, or if quick deploy is enabled, every time you push a new commit to source control. So what this deployment script does right out of the box is it goes into the folder of your site, it pulls in the latest source code, it does a composer install, reloads the PHP service, and then runs the database migrations. Okay, so running database migrations is what we want right now. So to just simulate a deployment, we can click on this button.Okay, so running database migrations is what we want right now. So to just simulate a deployment, we can click on this button. We haven't changed anything from source control, but the script will run anyway. So now the deployment is finished, and if we go back to our site and refresh the browser, we now have a database, and our migrations ran. So in this basic example application, it's just a CRUD application for posts, so we can create a new post, save it, and it gets stored in the database. Now there's one more thing I want to show you in this video, which is enabling quick deploy and showing you how easy and fast it is with Laravel Forge to do changes on your system. Enabling Quick Deploy 6:47deploy and showing you how easy and fast it is with Laravel Forge to do changes on your system. So all we need to do in order to enable quick deploy is click this button. And what happens now is every time we push some commits to source control, the deployment script below will be executed, and Laravel Forge will automatically update our site. So to try this out, we will clone the Git repository that I just created for this demo. And maybe we edit the title of the posts. So instead of just saying posts, what we want to do is, let's say it's my posts. Save the file, git status, it's changed, and then we commit all the changes, update it to title, and push them to GitHub.Save the file, git status, it's changed, and then we commit all the changes, update it to title, and push them to GitHub. Now if we switch back to Laravel Forge, you can already see that it's deploying. So without us doing anything, it's picked up the changes and deployed our website. So let's see if we can see the changes in our system, refresh, and now it says my posts. So in just a couple minutes, we created a new server on DigitalOcean with a site running PHP 7.2, connected it to our GitHub account, and deployed the application just by changing the source code. It's that easy with Laravel Forge.It's that easy with Laravel Forge.