Rails application access is very slow - ruby-on-rails

We are trying to access a Rails application running on a Ubuntu machine from a Windows machine and the time it takes to load the application is extremely slow. The ping operation from the Windows machine to the Ubuntu machine comes back in < 1ms. How do I debug this issue?

If you are running your rails applications with command 'rails server' which by default a webrick, it will take time for other machines to load, try installing the application in apache server within your ubuntu machine and access it with your system ip and the symlink.(http://0.0.0.0/symlink) For the first time when you restart your apache server, it will take time and then it should load in shorter time than in webrick.

Related

Start Rails server automatically on Ubuntu startup

I need to run my Rails server upon system startup. I am running my ROR code in my Ubuntu server. Here i need to see my rails server always in start condition. Suppose the Ubuntu server has shut down for some problem when it will start again my Rails server should start automatically. For this i made a script which is given below:
cd /home/subhrajyoti/spa
rails server -p 8888 -b 10.25.25.100 -d
In windows I am putting this file in the Windows Startup folder and it's running automatically each time Windows starts. Now I need the same behaviour in Ubuntu.
Check this out might help with your issue
Link

Reboot of Linode Xen VPS and Rails app

I have a Rails 4 application with PostgreSQL running on a Linode Ubuntu 14.04 server with Xen hypervisor. Linode support sent me a notice saying that they will be conducting maintenance on Xen tomorrow morning. There is a 2 hour window where my VPS will be down.
What should I do to prepare for the reboot? I plan to back up the database but I'm not sure what else to expect. The application is running with passenger on NGINX. Will NGINX restart automatically? Will I have to repopulate my database with the dump I make? Please help because I can't afford a lot of down time.
Many thanks
This should be fine. This is pretty standard for most VPS's and it happens with some regularity. Xen is the 'under the covers' stuff Linode uses to manage virtual servers, but should not effect anything on your server. Should not be any different than if you were reboot your server manually with sudo reboot.

Automatically run Rails Server on machine power up

What is the best way to run an Unicorn Rails Server automatically on machine power up?
Thank you

Proper way to start nginx/passenger (non-standalone) on Ubuntu with Rails 3?

I configured my Rails 3 production app about 6 months ago on Ubuntu running nginx/passenger, using git and Capistrano for deployment.
Fast forward to last week - The data center I was using (DigitalOcean NYC) actually had a complete power failure (and the battery backup didn't work) - resulting in my server shutting completely down.
I did not set passenger or mysql to start on reboot, so when the hardware server restarted, my app was still down.
I really did not know much about what I was doing at the time when I launched it (since it was my first production server that I have worked with), and I followed a guide to get it up and running.
When I attempted to get the app running again, I managed to start mysqld no problem - but for the life of me couldn't remember how to get nginx/passenger running again.
Since time was of the essence (my client needed the app up and running ASAP), I ended up getting the app back up and running by navigating to my app directory (/current) and using the command:
passenger start -p 80 -e production
This did the trick but actually started Passenger Standalone. It seems to work fine (it is not a big or complicated app at all, maybe a few users at a time). I can navigate back to my directory and start and stop it using the above command (and passenger stop -p 80).
However, now my capistrano deploy (cap deploy) no longer restarts the server on a deploy (it is trying to run touch tmp/restart.txt) - which even if I try to run manually, does nothing since the server is running Passenger Standalone.
I can't remember how I got the server up and running in the first place because it was so long ago. I'm not using RVM - just the version of Ruby running directly on the server.
Does anyone know the correct command to start nginx/passenger (not standalone) on Ubuntu?
And even a step further - how I can get mysqld and nginx/passenger to automatically load on a hard server restart?
Capistrano does not restart the server because it actually creates a new app directory (/u/apps/.../releases/xxx), while Passenger Standalone is still running in the old app directory (/u/apps/.../releases/yyy). Therefore touching restart.txt doesn't work. Instead, you have to restart Passenger Standalone like this:
cd /path-to-previous-release && passenger stop -p 80
cd /path-to-current-release && passenger start -p 80 -e production
You mentioned you want to start nginx/passsenger. I assume that you mean the Nginx mode. Here's what you need to do:
Install Phusion Passenger using the official Passenger APT repository.
There is no step 2. If you did step 1, then the Ubuntu package will automatically configure Nginx to start at system boot, which will automatically start Passenger as well.
I don't understand why you ask how you can get mysqld to automatically start on a hard server restart. Mysqld is always started during system boot. You don't have to do anything.

How to start rails application running on certain ports on a machine re-boot

How to start rails application using unicorn on a machine re-boot in a EC2 instance. We use capistrano to deploy and start, but would like to know how to address this on a machine re-boot.

Resources