Discuss

Docker Part 4 - Deploy in Seconds to the Cloud with Docker Machines

On this page

If you have not read Part 3, please go here and read it first.

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

image|673x500

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:

image|673x500

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.

image|690x118

You will see a new Docker Machine form where you can enter the name and choose a cloud provider to use:

image|690x216

Currently the selection is for Digital Ocean but we will be adding more soon. So choose Digital Ocean.

image|631x500

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.

image|690x335

Enter the token name and hit generate token:

image|597x412

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)

image|627x500

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.

image|636x500

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)

image|625x500

There is our brand new server live and kicking!

image|628x500

So just select it by clicking it (1) and then hit the "select" button (2)

image|622x500

You will now see that the Docker Machine properties are populated now in your new target:

image|667x500

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:

image|690x168

and hit the Deploy button.

image|690x102

Another magic happens and all the needed docker images, like web server and database are installed and deployed to your new server:

image|690x281

When ready you will see the green light!

image|690x256

Open your index page if you haven't done it already in Wappler:

image|669x500

and then hit the Open In Browser icon

Voila! You have your site fully deployed!

image|690x456

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:

image|690x366

Click on the server to see how it is running:

image|541x500

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:

image|673x500

You are warned that is is a permanent deletion and you can't go back, so think twice before confirming it:

image|680x500

Server is completely destroyed and removed at Digital Ocean.

image|638x499

So we are left now with an empty list.

Conclusion

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.

So try it out and let us know what you think - and don't forget to use the special link for Digital Ocean account to get the $50 credit!