Today we are going to show you how to deploy to Scaleway using Registered Servers feature.
We take you by the hand to deploy a Docker, Rails or Node project under 5 minutes including load balancing, Let's Encrypt SSL and all the cool feature we support.
As you might know, we integrate with all the major cloud providers and we love it. A lot of our customers, due to legislation or other legal issues, need to deploy their applications on servers which are running physically in their own country and also owned and operated by local companies.
Unfortunately, not all supported public cloud providers can comply with those rules. We provide a feature called Registered Servers to make this happen.
What? Registered Servers?
Registered Servers are essentially a pool of your own servers on a private or public cloud that can be used for any stack and configuration. Stacks can be deployed across a hybrid of cloud and registered servers, in this way you could have a dedicated server for your database and burst cloud servers for your front end.
Scaleway is a simple, scalable cloud platform.
It's the first platform worldwide where you can start x86 64bit and ARM BareMetal servers from a unique and simple interface. With Scaleway, you can start developing on a small virtual server and scale-up to a dedicated server in three clicks. Scaleway allows a seamless transition between virtual and BareMetal servers. When you need it, you can scale-out and automate everything using our API and with a flexible IP feature, you'll never have a downtime.
Great. Let's see how to get this thing going using Scaleway.
Let do this!
- Cloud 66 account - signup here for a two-week free trial account.
- Scaleway account - signup here and get a server for €2.99/month billed by the hour.
We are going to deploy a Docker Project with one load balancer, a two server docker cluster and a separated DB server. We need to provision 4 servers for this example.
Provision the servers
It's time to provision some servers with Scaleway. A good thing is that you can provision servers on both datacenters (Paris or Amsterdam) and Cloud 66 will make sure the intra-container communication, using a feature called ContainerNet, between servers/across datacenter is handled securely.
ContainerNet is a private and secure network (based on Weave) between all containers across all the servers and components in your stack, including databases. This network provides an internal IP address to each container, automatically updating with DHCP and DNS and is fully integrated with the life-cycle management of your services.
Provision the loadbalancer
Before you provision any instance, make sure you added you SSH key. This is needed to give initial access to you server using SSH. After the initial setup, Cloud 66 will generate a new one as soon as you bring the server over.
Create a new Server for the load balancer. Loadbalancers don't require much power, memory and storage. Choose a name (cloud66loadbalancer for example) and make sure your choose Ubuntu Xenial 16.04(LTS) image. (we only suppor Ubuntu 16.04). Choice the VC1S option (2 CPU / 2 GB memory / 50GB disk).
When you hit Create server make sure you change the bootscript. Scaleway will start the kernel without AUFS support causing Docker to crash on Scaleway. We need to change the bootscript to start a Kernel with AUFS support.
When you at the server detail page, scroll down to the advanced setting button. Click show to find the bootscript settings, hit edit and change the bootscript to
x86_64 4.8.14 docker #2
When Cloud 66 is deploying to your servers, a firewall will be installed and also SSH access only works with public/private key access and is closed by default to the outside world.
When the provisioning is done. We need to setup some things. First step is to check if we have the right kernel. SSH
$ ssh email@example.com to your server and run
# uname -a
The kernel should be
Setting up UFW
Before we can provision more servers, we need to make sure we setup the firewall Ufw correctly. Ufw is developed to ease iptables firewall configuration, Ufw provides a user-friendly way to create an IPv4 or IPv6 host-based firewall.
Normally Cloud 66 will take care of this but due to the internal working of Scaleway we want to make sure current connections are not dropped when Cloud 66 installs the firewall.
Scaleway is using NBD connecting (boot)volumes to compute. If we install Ufw and enable it, does connections are getting dropped. We need to make sure we edit the configuration first.
Step by step instructions:
- Install Ufw.
root@cloud66loadbalancer:~# apt-get install ufw
- Set the default INPUT policy to ACCEPT: Edit /etc/default/ufw and set:
root@cloud66loadbalancer:~# vim /etc/default/ufw
- Append a drop-all rule to the INPUT chain: Edit /etc/ufw/after.rules, add this line just before the final COMMIT line:
-A ufw-reject-input -j DROP
root@cloud66loadbalancer:~# vim /etc/ufw/after.rules
- Enable Ufw
Run the following commands. Your SSH connection will not be closed.
root@cloud66loadbalancer:~# ufw allow ssh
root@cloud66loadbalancer:~# ufw enable
Provision the Docker nodes
Create the other three servers too. Choose a server which much more muscle to run your Docker services. A bare-metal CS2 (4 cores and 8GB memory) is just fine to start. Of course, it all depends on your workload.
If your services need persistency, choice a larger disk size.
Provision the Database node
After creating the Docker nodes. Create a server for our database. A bare-metal C2L (8 cores and 32GB memory) is great box to run a DB (we provisiong DB nativaly and using all the resources it provides). We want blazing fast disk performance, we choice a 250GB direct SSD.
Bring them to Cloud 66
Great! In a couple of minutes, we are ready to build, deploy and manage your application on those servers. Let's bring them over. Make sure you checked the right kernel (
uname -a ==
4.8.14-docker-2) and updated the Ufw settings.
Now it's time to log into your Cloud 66 account. Before we create any project, make sure we put our Scaleway servers into our inventory. Go to the Register Server panel and you find a command to run on each server to bring them on board.
SSH to each server and make sure you add your private key to the ssh chain.
~$ ssh firstname.lastname@example.org
Register the server
Run the Cloud 66 register server command (of course change the xxx to the value you found in your register server panel)
root@cloud66dockernode2:~# curl -s https://app.cloud66.com/server/xxx/register_script.sh | bash -s
When the command is executed, you see the following message.
Approve the servers
Your servers will show up automagically in the Cloud 66 UI. Approve them to add them to the server inventory.
You can also tag the server to make them easy findable if you deploy a stack.
Create a Docker project
Let's create a Docker stack. We are using a private docker image but also we let Cloud 66 build a docker image using the Build Grid feature. The onboarding UI will let you know if everything is good to go.
We create a new deployment for a production environment.
We start with a deployment of 1 Docker host and 1 Database host. And select the right servers we want our application to be deployed to.
And we add another server for our MongoDB, MySQl database and RabbitMQ message queue.
Of course one of our Docker services need access to the internet. Cloud 66 gives you an UI to set the port mapping and take care of all the load balancing and firewall management.
Hit deploy stack and Cloud 66 will provision (= install all the packages, networking, db and security) the servers and start building and deploying your application. You get an e-mail when Cloud 66 is done setting up your application.
Cloud 66 makes it really easy to scale up. Let's add an extra host to our Docker cluster and install a load balancer.
Go to the Docker cluster and hit the button Add Docker Server. Choose the right registered server and hit Add. Cloud 66 will provision this server and add this one to the Docker cluster and make sure all the intra-service networking is setup and secure.
Last but not least, we need a load balancer. Hit the link Scale up your site - add a load balancer and choice the last remaining server. Hit Add Loadbalancer and let Cloud 66 do all the heavy lifting. When this is done! Point your traffic to the load balancer. Happy scaling!
Don't forget to add an SSL certificate to your stack. With one click you can add your own SSL certificate or generate a free one using Let's Encrypt. No need to access your servers or doing difficult configuration.
The combination Cloud 66 and Scaleway give you the power of DevOps right in your hand still comply with all the European (France) legislation or legal issues.