Playing
03. Deploying to Forge

Transcript

00:00
So if you're new to working with Forge or you just need a refresher, let's go ahead and get this application deployed now.
00:05
So if you have pulled this project down locally, go ahead and push this to your own repository, which is connected up in Forge. And that means that you can go ahead and deploy this straight from GitHub.
00:16
Let's go over to our servers overview over in Forge and go ahead and create our server with any of the providers that we want. For this to work, we just need a standard app server here. Let's go ahead and just call this reverb.
00:28
And we can choose any of these server sizes we want. Let's just choose the most basic here. I'm going to go ahead and switch the region over, although this doesn't really matter.
00:37
And let's go ahead and create this server out now. OK, you can go ahead and copy the pseudo password and database password if you need them. I don't need them for the purpose of this
00:46
because we're not going to need to SSH into anything. So let's go ahead and just close this off. OK, so all that we need to do now is just wait for this server to provision. And then we can go ahead and get this app deployed on a domain.
00:59
Once your server has been provisioned, let's go ahead and add a new site and get rid of the default site. We need this running on a domain. That's really, really important.
01:09
So the domain that I'm using is my personal domain, alex.gs. But of course, replace this out with any of the other domains that you're working on. And we can just click add site here. Let's go over to our site section and let's get rid of this default site.
01:25
We're not going to need that. So we can just choose delete. And let's go ahead and type that in and hit confirm. OK, so now that we've got this site, we're going to go over to here
01:34
and we're going to deploy this application using the GitHub repository. Of course, if you haven't already pushed this to your own GitHub account, go ahead and do that now if you're following along. So we want to go ahead and deploy a co-course slash
01:45
and we want to grab the name of this and just pop that in there. And we want to deploy the main branch. OK, for the database, we are going to choose forge or just leave this. It doesn't really matter.
01:56
And let's go ahead and hit install repository. Once your repository has been installed, let's head over to the deployments tab and update our deploy script to run npm install and npm run build. This is really important.
02:09
So we can, of course, install our dependencies and build our assets. So we're going to hit update on that. We'll be coming back to this later because when we do set up reverb, it's going to add a restart command to this.
02:22
OK, let's go ahead and deploy our application. It's not going to work just yet, but let's at least get the files copied over to our server. OK, once that's been deployed,
02:31
we're actually going to need to hook this up to our domain name. So I'm using Alex.js, which at the moment doesn't point anywhere. So wherever you're managing your DNS, you're going to need to head over here and add an A record.
02:43
So let's go and add a record in here. We're going to add this A and at, and we're going to point this to the IP address of our server and we're going to hit save.
02:53
I'm not going to proxy this through Cloudflare just yet, but you can do that if you want to. OK, so once our A record has been added, unfortunately, we're just going to need to wait for this to properly propagate.
03:03
And then once this does happen, we should be able to reach our site at this domain. OK, it looks like the DNS is propagated and we can now access the site. We can go ahead and register,
03:13
get onto our dashboard and make sure that we can see everything. Now, at the moment, this probably isn't going to work. The reason being is that we are using SQLite and we don't have that file that exists on the server.
03:25
So we can actually come over to the command section here and we can run a command. So let's go ahead and run touch database slash database SQLite and that will go ahead and create that for us. Let's hit run and just wait for this to finish.
03:38
Once that's done, we should be able to head over now and register an account. So let's make sure we can get on the dashboard. Of course, our real time functionality will not be working at the moment, but that's what we're covering through the rest of the course.
03:51
OK, great. So we are now into our application. When we hit this, of course, nothing happens. Let's cover how to get reverb working on Laravel Forge throughout the rest of the course.
7 episodes 16 mins

Overview

So you’ve built a realtime application. Now it’s time to deploy it.

Laravel Forge makes it incredibly easy to toggle Reverb, which configures your server for you and sets up (nearly) everything you need to broadcast and listen for events.

In this course, we’ll cover every step needed to get an local example application deployed to a production server, with a separate subdomain reserved for your Reverb connections.

Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!

Episode discussion

No comments, yet. Be the first!