Deploying Rails Application On Linux Instance:
sudo yum update -y
2. Install the development tools for rails environment
sudo yum -y groupinstall "Development Tools"
3. You might get a kernal error while group install. If you did, then edit the /etc/yum.conf file and comment the last line #exclude = kernal* and try group install again.
4. Install few dependencies by executing the followinf command
sudo yum -y install ntp zlib zlib-devel sqlite-devel httpd mysql-server mysql-devel curl-devel httpd-devel apr-devel apr-util-devel mlocate manlibxml2-devel libxslt-devel libffi-devel readline-devel
5. Install Ruby version manager (rvm) by executing the following commands.
sudo curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
sudo source /etc/profile.d/rvm.sh
sudo rvm install 1.9.3
sudo rvm use 1.9.3 default
6. Install Rails frame work using gem
gem install rails
7. Once rails got installed , you can create a new rails application in /var/www folder. You can create the application anywhere but i prefer it inside www. Execute the followinf command to create a new application.
rails new demo_app
demo_app is the name of the rails application.
8. Now we have an application and in order to access it through the DNS provided by azure you have to specify the inbound firewall rules called endpoints in the azure portal. Click on the virtual machine and select the endpoints option. Click add and add http enpoint, so that you can publicly access the rails application using the DNS provided by Azure.
9. Rails comes with a default webrick web server, so you dont have to install and configure other web server for testing purposes. Execute the following command to start the webrick server with posr 80. By default webrick uses 3000, we will change it to 80 using the -b bind option.
rails server -b 80
In case if you get any javascript runtime error just install nodejs and start the rails server.
sudo yum install nodejs
10. Once the server has started you can access your created application using the DNS provided by Azure. Eg: demoapp.cloudapp.net. The default rails application page will show up when you access the Public DNS.
Deploying Rails Application On Windows Instance:
rails new demo app
6. Once the application is created, start the webrick server with port binding to 80.
rails server -b 80
7. once the server in started , you can access the default application page using the Azure DNS for your windows machine.