In this Wappler update, we are introducing a new way to handle custom domains and automatically
generate free SSL certificates to secure them. All that thanks to two new services: Traefik for easy managing your site and services redirection, working together with Let’s Encrypt for issuing free secure certificates.
Register a Domain Name
You can register your own domain name at any provider as you wish. So you have full control of it.
Where the domain name and it sub domains point to is determined by the assigned DNS records to your domain.
You can edit the DNS records usually at the provider where you register your domain with, or have it under control of the provider that you are running your server on like Digital Ocean or Amazon AWS.
Once your register it, you can assign an IP address to it pointing to your server.
If you want free domain registration with .tk and other simple extensions, you can try the Freenom service
Use Cloud Hosting with Wappler Docker Machine
To deploy your website live on a server, you need to create an online server first. You can choose for hosting cloud providers like Digital Ocean or Amazon AWS. Check the appropriate guide for quick setup:
Edit your DNS settings
Once you create your server, you will know its IP address that you need to assign to your domain name. You can see it on the Docker Machine choice screen at your project target docker settings:
If you have Digital Ocean then you can simply add the domain there for management. Do make sure you assigned the right DNS servers as outlined in the guide above at your domain registrar to point to the ones at Digital Ocean. After that it is easy to assign the new domain:
Once you have assign the domain for management, you need to add hostnames to manage (sub domain names).
As I want to use multiple hostnames for vrious services under the same domain, for easy management I will use a wildcard hostname noted with *
This means that any subdomain under my domain will point to the same server.
So as you can see my domain is setup now with any hostname( sub domains) we can think of later on:
Install Traefik to assign domain names
So now that we have pointed our domain to our brand new server, we need to let the server know about it and let it automatically generate SSL certificates for the domain names.
To do this we need to install Traefik.
Open your project settings, choose the remote target and go to the Docker Machines manager:
In the Docker Machine Manager, choose the server you have created and then Manage Services:
There you will see the services you can install. You can choose from Portainer and Traefik.
You can enable both if you wish. Potainer to be able to manage your docker containers online and Traefik to manage your routing and assigned domain names with their certificates.
Important is to enter your e-mail address so it will be registered with Let’s Encrypt and be used to issue your free SSL certificates. Those are valid for just 3 months but will be automatically renewed for you by Traefik.
You can choose now domain names for the Portainer and Traefik dashboards if you enabled them.
You can supply also username and password for secure access to the Traefik dashboard.
Once you are done, just click on the “Apply” button to install the services.
You can see if everything is installed in the log pane below:
If something went wrong you can check the logs of the services:
So now we can assigned already two subdomains in our example for the portainer and traefik services in our case. So an automatic process of Traefik will kicks in to issue certificates for them. A minute later you will be able to access their dashboards as we specified in our case at https://portainer.my-awesome-wappler-site.tk and https://traefik.my-awesome-wappler-site.tk
Assign your new Domain Names
So now that we completed the installation of Traefik, we can now also assign custom domain names to our web server as well.
You can do that in the target settings. Enter there you full domain name prefixed with the subdomain and https, in the Web Server URL field. Also clear the Port field as we don’t use it:
Save the target settings, make sure they are active and deploy your target:
You can see that everything is deployed successfully and by the green light, and if you want more info you can expand the panel below:
So now after the deploy of your new domain the installed Traefik will pick it up and starts its automatic process to issue a new SSL certificate for it from Let’s Encrypt, if it doesn’t have it yet. So that your web site is securely accessible under https with a nice free certificate.
It might take a minute to generate as the the external service of Let’s Encrypt need to be called and your domain verified. But after that you can go directly in the browser and access you new site. IN our case this was: https://node.my-awesome-wappler-site.tk/
You see how easy it is now to use custom domains and issue fully automatically certificates to them thanks to Traefik and Docker Hosting. Setting up hosting is never being easier!