Today we are going to show you how to deploy to your Ruby on Rails application using Registered Servers feature.
We take you by the hand to deploy a Ruby on Rails 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 or just want to cut costs.
Also, Hybrid infrastructure is supported using registered servers. Meaning you deploy to a public cloud and running some heavy Sidekiq jobs on bare metal using registered servers.
With Registered Servers we make this happen and you get more freedom which cloud provider to choose.
What? Registered Servers?
Registered Servers are essentially a pool of your own servers in your own rack or provisioned by a public cloud provider 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.
Bring them to Cloud 66
Great, let get rolling!
To get started you need a Cloud 66 account and some running VM or bare-metal instances of your provider of choice. We already wrote a couple tutorials using some well-known cloud provider:
- Using registered servers using Vultr
- Using registered servers using ScaleWay
- Using registered servers using Gridscale
- Using registered servers using Exoscale
As long as your server obey this simples rules, you are good to go!
- We currently only support Ubuntu 16.04 and it needs to be freshly installed on your server.
- For security reasons, Cloud 66 only connects to your server using your secure keys on port 22.
- As Cloud 66 connects to your server and provisions applications from scratch, administrator permissions are sometimes necessary. Therefore our script creates a new user to use for deployment that is a member of the sudoers group and that does not require a password to invoke sudo.
- We currently only support Bourne-again shell (Bash). The error sh: n: source: not found during deployment may arise if you are not using the Bash shell.
- We currently only support deploying to 64bit CPU architectures.
Now it's time to log into your Cloud 66 account. Before we create a Ruby on Rails project, make sure we put our new 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 run the register server command
~$ 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@cloud66railsnode2:~# 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 automatically 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.
Deploy your Ruby on Rails application
Deploying a Ruby on Rails application using Registered servers works the same way using a supported public cloud.
- Pop in your Git repository.
- We analyse it.
- You select the target infrastructure.
- In this example, we use a hybrid deployment, our application server is using a registered server and our database is deployed to DigitalOcean.
- Hit deploy.
Sit back and let us do the heavy lifting deploying your Ruby on Rails application.
After you stack is deployed you can scale your application servers, process servers or add a load balancer to handle more load. Of course you can select one of your registered server(s) or add a public cloud VM to the mix.
It's good to know when using a load balancer, using a registered server, we provision the server using HAProxy and it supports SSL termination and Let's Encrypt!
Happy Rails on Rails deployment to any server. Focus on adding value to your Rails application and let Cloud 66 handly your Ops pain.