Introduction
It is very convenient to add new production servers in Wappler for deploying your web apps directly to major hosting providers like Digital Ocean, AWS, Hetzner, Linode and Vultr - all with the built-in Wappler support for Docker Machines.
However sometimes you have an existing server running docker that you want to add to the docker machines list in Wappler for usage.
This can be done now easily by using the new “Generic” type of docker machine that will server as connection to existing servers.
Prerequisitions
To be able to connect to an existing running you need:
- its IP address
- an authorized SSH key
To create your own SSH key if you don’t have one see:
To assign it to Digital Ocean droplet, or similar server see:
For Hetzner see similar instructions:
Test your SSH key access first
To make sure your key is all working fine, test it first by:
- Copy the IP address of the remote server.
- On your local computer start the login. Replace the xxx.xxx.xxx.xxx with the IP address of the created remote server.
ssh root@xxx.xxx.xxx.xxx
- Type
yes
in order to add the fingerprint to the known_host. - And that’s it. The process was successful if you see the welcome message of the server.
Add it to Wappler’s Docker Machines List
In your project options, go to the target that you want to connect to that remote server. Choose “Manage” to get the list of existing Docker Machines on your computer.
There you see your all existing servers:
Click on the plus in the toolbar to add a new one or in our case to link to existing server not in our list:
Fill in a server name, it’s IP Address, user is usually “root” but it can be also “ubuntu” if you are connecting to other server not yet initialized by docker machine.
Your personal SSH key is selected per default, if you have authorized the same key and tested it, you can leave it like this - otherwise pick the right SSH key.
Note: Only the public key is used. an extension .pub is automatically added to the filename.
When you click create a new local docker machine connection is created for this server, so you can use it in Wappler.
Check the right Wappler Deploy Project.
If you have deployed a Wappler project to the same server before and you want to reuse it, do make sure the that Wappler Deploy Name is that same as the one running on your server.
You can click on “Change” to see the other running projects and choose the one that you want to reuse:
Of course if this is a new server, you don’t have to do this.
Connecting to new remote servers
If you haven’t used the remote server yet, but just created it in your hosting provider console, you can still add it for usage.
Do make sure it is accessible first with your SSH as explained above. Usually during the creation you are asked which SSH key to use. So just select your own.
Also it is advisible to run Ubuntu on the server is it is most convenient for Docker.
Also make sure the server has the following ports open 80, 443 and 2376, next to 22 used for SSH.
Those are needed for web sites access and docker.
Refer to your provider documentation on how to do this.
Conclusion
Now you see how easy it is to connect to any existing remote servers with Docker and Wappler.
This way you can even connect to providers that aren’t directly supported out of the box by Wappler