Laravel E-Commerce - Server Deployment w/ Forge - Part 7

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys welcome back and in this video I'd like to deploy our application onto a server we've made a lot of progress in our app and at this point I think I want to put it up on a live server so come and join me for this process so I'm gonna be using a layer Belle Forge for this process Forge helps so much when managing servers I for one am not the greatest with DevOps and server-side stuff and I rely on forge heavily for all of my servers so as you can see I'm logged into my account here if you've never used it before you have to attach your digitalocean credentials as well as your version control credentials but I've already done that so let's go ahead and put our application on a new server so I'm gonna use digitalocean for this and let's name it laravel ecommerce and the server size I'll just put it at the smallest one digitalocean just updated their pricing the other day so the smallest one is actually pretty good region Toronto PHP version so I'm going to is fine and yeah butts go ahead and create a server and let me just copy and paste this it's also gonna email it to us when it's done this will take about 10 to 15 minutes so I'll be back when it's done you can actually see it provisioning right here all right it looks like it's done let's hit this button to see if it works and it looks like it does let's grab this IP and hit it in their browser and that's the default page that shows up cool if you're also going through my email you'll see that a public-key was added into my github in bitbucket from within forge so Forge and github can communicate so let's go ahead and add our application as one of the sites for this server let's use the default one for now and then later on I'm gonna add a domain so we're gonna connect my git repo and the github repos this one so I stray himself slash their Bell ecommerce the example let's grab that and let's install the repo alright that's done let's go ahead and deploy it ok let's see if that worked refresh and there we go there's our application so there's no data in here yet because we have to seed it remember we have a cedar in our application so let's go ahead and ssh into our server and run that seed so let's do ssh actually let me open it up SSH it's gonna be forge at we need the IP it's this IP well connected to domain later so yeah that should work and I did that on purpose we have to add our public key into forge every time you make a new server so let's go ahead and do that so our public key is in where is it home slash SSH ID under for RSA the pub so let me just grab that let's go into our forge let's click on our server so this one let's go to SSH keys and I'll just name it MacBook and it's based out in okay that's done now we can SSH and hopefully and we're good so if we look at the directory structure one thing I always do is install a package for terminal called on my Z so let's go ahead and do that so we can just use this curl command here so that let's do it and our password is in our text editor okay cool it just looks much nicer in my opinion so if we look at our directory structure the default is the site we want to go into and we want to seed our database sorry sed default and now we can do a PHP artisan DB seed to seed our database and I should say yes it's just warning us but we know what we're doing and so that seated our data if we go back to our app they should have data now awesome it does the next thing I want to do is connect a domain instead of using this IP here so let's go ahead and do that the domain register I use is called $10 CA and I've been using them for years they're pretty good my only complaint is that when you want to modify advanced DNS records the UI is a bit clunky and it's kind of hard to find but not to worry because we can actually just point the main dns to digital ocean and digital ocean can handle the advanced DNS from there which is what I do for most of my sites so we're gonna get real practical here I actually bought a domain this one laravel ecommerce example dot CA and we're gonna use that one so as you can see here's the deal that's the default DNS for it let's go ahead and change that and I have to login okay so where is it here DNS information let's go ahead and and we'll change it to NS one digital ocean calm and I set up two and three what I thought I copied it two and three and it's update that okay now DNS can take anywhere from 24 to 48 hours to fully propagate but in the meantime we can set up our DNS records within digital ocean and we can also set up our site in forge so when it does propagate so if you go to our site laravel e-commerce sorry it's no - ecommerce example that's EA right now it's just pointing to the $10 CA DNS but once it's done propagating it should point to our server so let's go ahead and go into digital ocean and set up our records there so if we go into networking I'll just enter a new domain here let's call it laravel ecommerce example that's EA case at the domain let's add a few things here let's add a few records so the first one is just that should point to this okay the next one let's just do a catch-all so star is find Arabelle ecommerce and let's set a cname record let's set a 2ww and for the alias at create now let's go into our forge site I'll go back to sites default let's go ahead and delete this one because we're gonna make a new one delete it and the new one's gonna be called laravel ecommerce example dot CA that's good that's good and it's at that site okay let's go into it and it's put our github repo in here again it's gonna be dry himself slash nerville ecommerce example master install companies okay okay that's done it's deployed and now all we have to do is wait for the dns to propagate unless it already did let me just refresh this no i didn't yet okay so i will be back when the dns propagates a few moments later so that was actually pretty quick the dns has propagated and our site is up as you can see our products are seated because we already did that before and the database server is obviously the same so a few more things I want to do the first thing is I want to set up HTTPS and forge makes that really really easy so let's just go into our site here go to SSL we're gonna use let's encrypt because that's the easiest way to do it and it's going to obtain a certificate okay that seems to be done so we can go ahead and activate it and that's active go back here refresh boom SSL how simple was that now the next thing I want to do is show you how to connect to your database using sequel Perl if you're using sequel Pro so let's go ahead and make a new connection here let's call it laravel ecommerce example that's yay okay so organize SSH and the host is the same as this username is forge password it is in our text file actually no that's not the password the database password is in my email somewhere here here okay and we'll leave that and I believe the host is that users forge SSH password is we have to go into our directory so SSH that is and make sure you give it the secret key okay and let's test the connection yes and it seems to succeeded let's go ahead and connect and there's a database there should be a database in here named Forge and there it is and this is our schema from our application those are coupons those are products awesome so the last thing I want to do is just to show you the workflow of how to deploy code so let's go ahead and update these two in our codes I want to make this point to the youtube series and I want to make this to link this to the actual link so let's go and do that in our code okay so is this right one yep so should be in landing page yep so we'll get hub okay let's change this to screen test and let me just grab the URL for my youtube pitch down here and for the github it's here sorry github is right here so go back to our code and let's open a terminal just do a good status okay I'm gonna add this I'm gonna name it part seven deploy to forge and I'm gonna push it okay back to forge back to our site and I didn't set up quick deploy but you can turn that on if you want and that's gonna deploy every time you push I like to press the button manually so let's deploy it okay back to our site its refresh and see if this updates and it does so this link to our YouTube and this should link to a github just make sure it does cool cool so I was testing if stripe payments went through on our new server here and I was presented with this error after I submitted the form so let's go ahead and see what the problem is so that's SSH into our server forge at laravel ecommerce example dossier and we can look at the logs because since this is in production it's not going to show us the error so the log let's just go into our thing there so if you go to storage logs there's a file called laravel dot log and if you scroll down so there you can see right here the stripe API key is not defined so let's go ahead and add that so I always have to go here and then we just have to put it in our environment file which I'll do behind the scenes because I don't want you to see my stripe API key okay so I've added it behind the scenes let me just fill this out and we can try again let's complete the order okay this time looks like it worked let me just double check stripe and there it is right there cool so there you have it guys we've managed to deploy our application on a server using laravel forge I think I'm gonna stop it there we'll explore a few more server related things in the next few videos please like comment and subscribe if you haven't already done so thanks for watching I'll see you guys in the next one okay thanks bye [Music]
Info
Channel: Andre Madarang
Views: 11,728
Rating: undefined out of 5
Keywords: laravel ecommerce, laravel e-commerce, ecommerce laravel, e-commerce laravel, laravel shopping cart, shopping cart laravel, laravel cart, cart laravel, drehimself, andre madarang, laravel, commerce, laravel forge, forge laravel, laravel server, server laravel, laravel deploy, deploy laravel, laravel dns, dns laravel, laravel https, https laravel, laravel ssl, ssl laravel, forge ssl, ssl forge, forge https, https forge, laravel forge https, laravel forge ssl
Id: BfCgwYgopUg
Channel Id: undefined
Length: 18min 48sec (1128 seconds)
Published: Mon Jan 22 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.