imagine this next Cloud MySQL WordPress or even a multi-service platform such as upright in just a few clicks and now imagine I'm actually doing that it really never has been easier to deploy anything in one single place and I want to show you a foolproof way how to run your own server with caprover and how easy it is to deploy anything there including zero configuration for adding your own domains and grabbing https so even if you're not too much into servers come on you should definitely check this one out all right let me first give you an overview of what we're going to do we're going to start with installing cap rubber locally for the simple reason that that is actually slightly harder than doing it on a live system and I want to show you how that works then we will spin up WordPress and MySQL within cap Rover after that I'm showing you how easy it is to use the caprovers CLI to deploy your next JS application inside of caprover last but not least we're going to have a look at custom domains and https the first thing you want to make sure is that you have Docker installed that's actually quite easy on all of the systems just go to docker.com and just download it once you have Docker installed confirm that you actually have it in my case that's version 20. the next thing you normally do is jumping over to the documentation and then we would be searching for running it locally and actually there's an entry it has quite some text so don't worry I've read it for you if you scroll down a bit there's the essential part copying this might work fine on Linux on Mac OS and potentially on Windows as well it can lead to file system problems in my case running all of this just failed without a proper error message so this is why I'm going to show you a universal solution that runs everywhere and the idea of the solution really is easy we're going to spin up a Docker inside of docker but before we do so check out this line from caprover that one says it is exposing the port 80 the port 443 and the port 3000 this is important because if my Docker in Docker won't expose the same ports I cannot access cap Rover okay let me show you how to run Docker inside of docker we will say Docker run and then we wanted to have the same rights as the docker on my system that's why we use privileged and then we need to expose the ports that cap Rover is stating here so we'll do the same go 80. and a 443 and 3000 and since I have already a service on my system that's running on Port 3000 I cannot use 3000 but that's not a problem really because I can change the first value and say like on my system it support 3200 but inside of the container it's three thousand now let's give this container a name we call it Capper over docker and lastly we have to define the image which is the official Docker and Docker image okay let's run that the thing that looks like a hash is actually the ID of the container but we don't really need that one because we have given the container a name which is much easier to access now that container is running on my system I can show you by running Docker PS and then just like grab and the name that one tells me that Docker and Docker image is running with the cap Rover Docker name and it's passing all of the ports and so on and so forth cool what you have to imagine now is that this cap over Docker here is essentially just a Linux system that runs Docker inside of it and we want to go into that Linux system right now and going into that container is quite easy we run Docker access minus it for interactive and then we give it the name and we want to say that we want to go into the terminal all right we're there let's just do a bit of enter all right inside of this container this should be Docker running as well it's obviously a newer version than mine because I just pulled it but that doesn't really matter and now we are in the state where we more or less want to copy over from the documentation since it is proposing to use that structure I'm going to create that directory so I'm going to say create that directory Captain data and now I can copy this line which will then inside of this directory create a Json file which just contains skip verifying domains true you can check out this Json file by running cat Captain beta and then config override Json and then it will give you the contents alright working fine the next line is really just saying run cap Rover give access to Docker give access to slash captain and then go for it so we're copying this one we're pasting it and we're running this one this will now pull the cap Rover image and when it's done it will start the cap Rover server shortly after it will give you the information that the installation of caprover is starting and that it is about to initialize depending on your system this can at least take 60 seconds so be a bit patient you can always check the status of the initialization by running Docker PS then grabbing that ID which is in front of cap rubber slash caprover and then running darker locks minus F and then the ID and then you can see what's happening there it says Captain is initialized and ready to serve you that really means that actually it should be accessible and you remember we mapped it to Port 3200 so let's try to access that one hey hey that one looks good the password for the initial setup is Captain 42 and we're here wasn't that hard right and now it gets really cool watch this I go to apps and I could create a new app which is cool as well but I can also just go to One Click apps and there we're searching for WordPress and we're choosing the middle one with the database and now we're saying my WordPress I'll just use active node as a password right here and we'll do active node as database user as well don't do this that's not safe and we just hit deploy and now imagine this it's actually doing everything for us so the only thing we have to do really is to wait and this probably takes like a minute or so okay when it's done it tells you that WordPress is deployed and available but it also tells you that it might take up to two minutes until it's ready and before that you might see a arrow page so let's do fast forward for three minutes now just to be safe okay so I think three minutes should be in more or less let's click finish now what you're seeing is that it successfully spin up two containers one of which is the database and one of which is WordPress itself when I click that I can see the information about that WordPress instance and it also tells me that it should be available under this localhost domain let's check it oh okay there we go let's just say my WordPress username active node I don't really care about the password but I'm going to copy it and email is just like infoactive note dot d e hit me up log in active node and a copied password yeah do remember me and we're in that's your WordPress instance that's really it and there's just so much more on caprover like if you go to one click apps you can literally like do anything probably just bit wording as well yeah there is so it's just sick even even upright with all of its multiple containers but that's not just it like you can also just deploy your next.js application and we're exactly going to do that now so first things first we want the next JS application so what I'm doing is spinning up a new terminal so I'm going to do MPX create next step and the name is just going to be Captain cool I go yes yes yes yes yes yes awesome the next.js app is created we don't really want to change it much but let's quickly make sure that it works go into it and run npm run Dev cool that's working fine but we actually want to deploy that one to cap Rover so let's stop it again clear the terminal and now the first thing you want to do is go npmi globally cap Rover because that one gives you the capabilities of deploying with the CLI okay the thing you need to do now is instead of localhost 3200 or in your case localhost 3000 you're going to captain.captain.localhost 3200 which normally should work out of the box okay I'm facing the login again I'm giving it Captain 42 and now I am setting this to Captain Dot localhost update perfect cool all right so now to deploy on your cap rubber instance which is set to wildcard dot captain.localhost you have to do cap Rover login but it might as well be that you're getting the error messages that I'm getting even if all of the information you're providing is correct so in my case I'm doing Capital over login and then I'm providing the URL and then I'm providing the password which is still captain 42. but the problem is it couldn't resolve this URL because this npm package is using node and node wasn't able to resolve it so to fix that you actually need to make sure that node can find this hostname on your local network and that is why you go to your host configuration wherever it is on Linux and Mac it's normally Etc hosts so I go I want to edit this Etc hosts file and what you find there is always a mapping from IP to host which is basically just saying like the Ping on the right side maps to the IP on the left side and localhost already Maps properly to my local IP but for node to also find captain.localhost we'll just add those two and we're saving this and we're good to go and then we can actually do cap rubber login with the URL and the password press enter and then you have to give it a name of your choice we'll just say local captain and then it says it worked nice so that's the first step of using Capra over CLI to do deployments all right so now we want to deploy this app so we call cab Rover deploy then we choose local captain and then it will ask us what the deploy Target should be right now there's only the two from WordPress so let's cancel this one and let's create a new empty app next.js there we go alright let's try again cap Rover deploy local captain xjs and then the branch name is Main we go yes and then it's saying it's starting the build but then it fails normally Capra over deploy is sufficient but since Capper over can deploy anything it needs to know how and this is why it complains about the captain definition file missing so let's create that one let's jump over to the documentation search for captain definition file and then it says it's basically just edit Json there's two variants one of which is very simple which is this one and the other one which is actually representing a Docker file let's use a simple one but with a newer note version okay let's switch to your editor create a new file called Captain definition copy the contents and adapt the note version we'll just use 18 for now there's one thing you should know caprover says this is the simplified version of this and this one does npm install and then it does npm start but next.js also needs mpm run built before npm stored so a quick fix is the following you go to script and say when you do npm search also Run next build before that's it let's commit that and now let's do cap Rover deploy again local captain next.js Main yes and now you can see there's actually starting to build this takes some moments because it's taking it to a darker file now let's head over to our capital for instance next shares and check the deployment it's saying creating optimized production build and collecting page data so it's still running now a few moments later it's done and it says server started on Port 80. let's go here and let's check if we can see it works now it's important to acknowledge one ping what sounded like additional effort is now just really only running cap Rover deploy all the time so let me show you for example go to the code go to the next JS code go like page and then let's say we want to click everything out of the page besides the main tag and then inside of it we only say hello world all right let's commit that changed page yep now let's say okay got a new version money deploy that yep yep Main and here we go and I didn't fast forward here like that was immediately fast simply because it's using the cache of the container which is default in Docker but it's still sick so let's jump over let's see the logs first alright it says it's done actually so let's check it refresh hello world and that was basically immediate deployment let's try again just to see how fast it is like let's do hello world again save it and then go like change page again hit cap Rover deploy so I did Fast Forward it was about 30 seconds in total that's actually pretty nice and it wouldn't take any longer if it wasn't your local system in fact your life system could even be faster OK quick recap we installed cap Rover locally we spin up WordPress in like zero configuration time and also we deployed an xjs application with the CLI if you're now thinking that's annoying to hit Capper over deploy cap Rover gets you covered here as well so you go to apps go next to us you go deployment and you can just enter your repository information here to trigger automatic deployments we're not going to do that now instead I want to show you one last thing and that is how easy it is to actually deploy cap Rover on a real server in fact caprovers got you covered so if you go to the docs there's a link to immediately create cap Rover on digitalocean but I want to show you how easy it is with really any cloud provider I'm using headsner now within my cloud provider I'm choosing Docker as the cloud container then I'm creating that container I wait until it shows ready then I'm copying the IP to log into it so I'll just SSH into it go like login here and then I'm actually inside of the container and now it's basically just exactly the same thing but much easier you jump to getting started if your container comes with a firewall such as ufw you just copy this line to configure the firewall properly now the next thing is really just copying this line same thing as before we'll simply wait for like three minutes and then you simply go to your browser enter the IP of your server and you go like three thousand and here we go there's your cap Rover instance which is enter captain 42. and it runs on your live server there was much easier than running it locally now we want two things custom domains and https adding your own domain is pretty easy you just have to update your DNS settings of the domain such that the a record points to this IP so in my hosting provider I'm adding an a record for copy which maps to this IP and also for everything before Cappy so basically a Sub sub domain which also maps to this IP you'll see why I added the subsup domain because now I can use this well card thing so I'm saying record the copy and then my domain okay let's say update domain it confirms that the root domain has been updated and that it's forwarding me to that root domain now okay that's cool there was immediate and that works you can see the domain instead of the IP now I log in but I still have the problem that everything is without https that's super easy you just click enable https provide your email and it just takes one moment and you'll have https enabled hey hey there you go last thing sure thing you want to force https no insecure connections yep all right done your connection is secure now all of the apps you are creating or installing for example my app will allow you to immediately switch to a secure connection and you can add your custom domains to each application hey hey those were literally just 20 minutes and you are off to go to rock any project with cap Rover now and the Best Yet to Come is the fact that caprover is an abstraction layer on top of Docker so you can simply remove it and all of your services will still be running just fine so what's stopping you now if you like this video and you want to learn more about web development in general then hit the Subscribe button and now all to say is have a great day have a great week be nice to each other and cheers