How to deploy Laravel with a database to DigitalOcean's App Platform

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
tutorial i'm gonna show you how to set up a laravel app in the digital digital ocean new servers new service that is an alternative to cloud servers is like a sort of like a managed server so you don't have to take care of configuration or keeping it up to date or anything like that and there also offer managed database databases and i'm uh i'm going to show you how to set up lara application they use a database from the same service and the application we're gonna be uploading currently this is in uh is running locally so it's just a very simple application it's actually for this tutorial so you type a message here and it just lists adds it to the database and then in the view it displays it so let's get started started the first thing you you want to do is create an account if you don't have one i'm gonna leave a link in the description uh to digital options so you can create an account you will get a hundred dollars for uh two months i think so with that link so make sure to use it and once you log in you're gonna you're gonna be in in this section the only thing you have to do is go to apps and you'll be back to the apps apps service and then we're gonna click launch your app and then it's gonna ask you to link or github account or gitlab account this is where it's gonna get the code so make sure to make sure to have your code in github icon and youtube repo and i'm gonna link my youtube okay once we we've had authorize uh digital option to access our repositories we're gonna select it from the list of repositories we get here so this is the repository i want to upload to the server so i'm gonna click that one then i'm gonna click next okay here we we can select the region uh currently i get three options new york astrodon and i think this is i don't know what country is this is that germany right yeah so uh select i'm gonna select new york just because it's the closest to me then here we get a list of of the branches we have in that repository i created this staging branch so you just so you can see that uh we can select a different branch if you want i'm going to keep master for now and then we can select if we want to auto deploy code changes so that means when we push a change to that branch or merge a pull request is going to be automatically updated and then we click finish and wait a second okay we need we'll need to set some configuration here uh the first thing thing i'm gonna do is gonna set up the database so i'm gonna select the dev database when you're here you can only select the dev database i don't know why you can select an existing database that you already hand digital ocean but you cannot create a bigger database so but you can upgrade your database once you create when you finish the setup process so i'm going to create the dev database and this name you have to keep in mind you have to remember what name just you gave it because we're going to use it to reference the configuration so our app can connect to it so i'm gonna leave it db and i'm gonna click add database and then we'll select we'll create the connection so set up the enviro environment variables so the the level application can connect to the database and also we need to select two other environment variables the first is app url this is going to be the same for everyone it's going to be url unless you want your app url to be on something else like for example app or something like that but normally you will just leave it like that and then i'm gonna add some more and then here we're gonna add the app key okay and this we're gonna copy the one we have uh in our environment file or this is used for encryption that reduces this this keyboard encryption i'm gonna paste this one and then we start with the database connection so db connection okay so in digital ocean all databases at this in this server are postgres sql i don't know if you can change that but for the moment we're gonna use postgres sql then connect connection and then we're gonna use dota base url and we're gonna we're gonna reference our or tv uh our other service db and then database url then we're gonna create a couple more i'm gonna create it and then you you can pause the video and copy them okay so these are all the configuration we have to set up for the database and our app will be able to connect and insert uh we now have to set up a build command that's gonna be uh composer install to install or uh or libraries and just the journal setup and then and on run command we wanna set up the immigrations the migrations database migration so b should be this then and since since we're gonna be in in production environment we're gonna have to set force okay so that's all we have to do in this this section of the setup so i'm gonna click next next and then here we can select or the uh plan or and also the size of our server so i'm gonna select basic for now but you can see here the what each plan offers and also you can so if you click this one it offers you bigger options for your app so this is for prototypes he says here so i'm gonna select this and i'm gonna select this smaller one and it's going to cost us 12 dollars a month so database included there is going to be seven dollars in the container and the container is going to be five dollars so i'm gonna click launch then here it's gonna start deploying our app here and we can view the logs here so here you can see it's uh building the ra or app sharing the ember environment firewalls and then it's gonna start using okay it's running the oh it's installing the javascript libraries and then it's gonna install the composer libraries so this might take a while so you just have to be patient it takes like ten minutes or five five to ten minutes or something like that so i'm gonna pause all right let's go composer i'm gonna pause the video for now and i'll come back when it's uh when it finishes the plane as you can see it took seven minutes and we now can visit this url and it's gonna show our app okay so i'm i'm gonna test to see if the uh if the database was created correctly oh let me see oh yeah the migrations were run correctly so we should have no problem inserting data here and it works yeah so uh about how to update your database so it's a is a bigger database not a development database you can select selector here and then upgrade to manage database so and then here are the connections so you you can connect from workbench or another client sql client you have and then here you can also set more environment variables variables and you can change other stuff like the course policy also you can access the console so here if you if you forgot to set up the uh the build command you can also run your migrations from here it's not going to run anything like this and also to set up a new domain you can set up here so you just type the your domain and then and then it's gonna show you some fields so this this you're gonna copy to your domain provider or you can add this to your to your cname record so so you don't have that digital ocean domain you can have your own domain and that's about it thanks for watching
Info
Channel: Cosme Escobedo
Views: 1,687
Rating: undefined out of 5
Keywords:
Id: juo0slp4E3c
Channel Id: undefined
Length: 11min 21sec (681 seconds)
Published: Sun Jan 24 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.