Docker Part 4 - Deploy in Seconds to the Cloud with Docker Machines
So you have built your amazing dynamic site and you need to put it live on the internet?
With Docker Machines you create your live server in seconds and deploy to it.
Check the general introduction on Docker Machines
We have integrated Docker Machines now in Wappler, so it is really easy to create your own live server.
Introduction to Cloud Hosting
With cloud hosting you are creating you own virtual server with all the powers of full dedicated server.
With Docker Machines this virtual server is completely configured for you automatically and Docker is installed. So you can deploy all the docker servers you want to it instantly
For now we have added support for Digital Ocean as cloud provider but more providers are coming up.
Start with Digital Ocean and get $50
Digital Ocean is a very solid and affordable cloud server provider, with hosting facilities all over the world.
As a introduction to it - you can get $50 hosting credit by making an account with this link
This will give you a good start to experiment with cloud hosting for at least few months.
Docker Machines in Wappler
Creating a new Docker Machine in Wappler is very easy.
Just go to your project settings, targets, create new target, select Docker Engine (1), Remote connection (2) and then click on the Manage button (3) to get the Docker Machines Manager
The Docker Machines Manager
The Docker Machines Manager will popup and retrieve the list of your docker machines. Initially you probably won’t have any, so you will see:
Creating a New Docker Machine
Let’s create a new Docker Machine that will be our Live Server. To do so just click on the Add New button.
You will see a new Docker Machine form where you can enter the name and choose a cloud provider to use:
Currently the selection is for Digital Ocean but we will be adding more soon.
So choose Digital Ocean.
If you haven’t created an account yet click on “Create Account” button and you will get $50 credit to start!
If you have an account go to the Digital Ocean control panel and generate an Access Token so that Wappler can create the server for you.
Enter the token name and hit generate token:
Then go back to Wappler and paste the Access Token.
Choose the Region depending on where you are your customer are based (1) and Size of your server (2). Usually the smallest will be just fine for just $5 for month!
Then hit the Create (3)
Now and all the magic will happen! The server is being created for you in just a matter of seconds! All the needed OS software is installed and also docker is installed configured.
When done you will see that everything went well and that the Docker Machine - your live server is fully created and operational (1)
So just go back to the list of Docker Machines (2)
There is our brand new server live and kicking!
So just select it by clicking it (1) and then hit the “select” button (2)
You will now see that the Docker Machine properties are populated now in your new target:
So you can just save it and get ready to deploy your site to it!
Deploy to your brand new server
Now that we have created our brand new server, we can deploy our site to it.
Just switch the active target to our new Live Server target:
and hit the Deploy button.
Another magic happens and all the needed docker images, like web server and database are installed and deployed to your new server:
When ready you will see the green light!
Open your index page if you haven’t done it already in Wappler:
and then hit the Open In Browser icon
Voila! You have your site fully deployed!
Monitoring your servers on Digital Ocean
You can also see your live server in the Control panel of Digital ocean, just go to the droplets section:
Click on the server to see how it is running:
Removing the Docker Machine
Suppose you are done with testing and you want to remove your server, so you are not charged any longer by Digital Ocean.
Just go back to the Docker Machines Manager in Wappler Project options, select the server and click delete:
You are warned that is is a permanent deletion and you can’t go back, so think twice before confirming it:
Server is completely destroyed and removed at Digital Ocean.
So we are left now with an empty list.
So now you see how easy it is to deploy as full blown docker server live on internet thanks to Wappler and it’s integration with Docker Machines.