I have very little experience with Ruby, it’s not really a thing I use every day so I went around to find out how to run it on Azure. Unfortunately, Azure only runs it as IaaS. As a comparison, for PHP, Java and .Net there’s the PaaS option which is much simpler and allows you to get a website up and running in minutes. Honest. Read my story on how I built an entire website and had it running in 4 hours here. When you don’t need to waste time configuring virtual machines, installing operating systems and every little component you will need, things get done really, really fast.
But since this is about Ruby on Azure we need to go down to IaaS, which means installing virtual machines. So first decision is: Windows or Linux? Let’s evaluate our options:
I’ll make this clear: I don’t love Windows because I work at Microsoft. I work at Microsoft because I love the things we create and yes, I do love Windows. A lot. So that would be my first choice. The problem is that there aren’t Windows VMs already pre-configured with Bitnami, Ruby, MySQL and Tracks. So here we need to take a VM and install it manually. But here’s the good news: You just need a simple installer to get there.
First step is going to http://portal.azure.com, select new, compute and I’m picking Windows Server 2012 R2 Datacenter:
Then I configure the details for my VM, hit create and wait for a bit:
When the VM is ready, we then click at the connect icon:
This will launch the remote desktop client. We then logon and first thing that will come up is the server configuration. Now I’ll do a thing people shouldn’t do on a server, but it will make my life much easier when using the browser: Disable IE’s enhanced security. Reason being that otherwise it will keep bugging me with alerts for everything I do:
Now that we are done with that, we just need to go to the bitnami tracks installer page: https://bitnami.com/stack/tracks and launch the local windows installer.
If you want a more advanced setup, you can use Boxstarter and have your own deployment script as explained here: http://rails-windows.github.io/50-automated-install-ruby-rails-windows.html
Microsoft Azure has a VM Depot which contains a large number of VMs that leverage different open source technologies. The good news is that there are already Linux VMs with Ruby, MySQL, Bitnami and even tracks configured. Here’s how I went about deploying that for me:
So I go to portal.azure.com, click new, compute and choose marketplace:
So I search for tracks and there we have an Ubuntu VM with everything on it:
So I’ll just go ahead and hit create, then setup the name of the VM, my username, password, subscription and VM size details, then hit create again:
It will take a little while and the VM will be ready to use. Once everything is done, I can go to properties and find the SSH path for it:
So now I get PuTTY for Windows installed from here: http://www.putty.org/
Then I use it to connect to that address:
And then I logon with the username and password I previously configured:
That is it. We have access to the VM and it’s running everything I need. But I’m a Windows guy and I like graphical user interfaces, so let’s get one installed here, by running the following commands:
sudo apt-get update
sudo apt-get install xfce4
sudo apt-get install xrdp
sudo /etc/init.d/xrdp start
sudo service xrdp restart
Now we need to enable a remote desktop port access to it. So I click at settings, endpoints:
Then I add a new endpoint with the following settings:
Now I go to my client machine and run mstsc.exe (remote desktop client):
Click connect and logon with my predefined username and password:
And here we have our desktop. I’m opening firefox and launching our localhost with Bitnami:
Then I click to my application and use the preconfigured username and passwords:
Then I can go to phpmyadmin: http://127.0.0.1/phpmyadmin/
To find the username/password for MySQL you can open these:
And there you have it.