My app has no dynos running - No web processes running - ruby-on-rails

Some of my apps at heroku has no dynos anymore, although previously it worked fine:
heroku logs says No web processes running. My other applications are working well.
How do I fix it?

i was having the same problem it really sucks i'm stuck in it from like 3 hours or more, eventually it's fixed just by deleting the whole heroku app and then specifying the buildpack that you gonna use in your interactive terminal with this command line heroku buildpacks:set heroku/php and you can add it on creating the app directly and that's what i did and it was fixed like that:
heroku create myapp --buildpack heroku/php
and the main reason was because of one python library has been installed i wasn't even using it so heroku finds two builpacks python and php and used the python one so when i did specifying that i'm actually using PHP everything has been pretty fine.

Related

Error R14 (Memory quota exceeded)

I have a Clojure web application I am running on a free plan on Heroku. The app has been working well for more or less one month, but in the last 3 days the logs have been showing up this error and the app is not working.
I am not able to reproduce this error locally, where everything starts up fine.
I tried restarting the app several times, deploying a new instance and fiddling around with JAVA_OPTS and JAVA_TOOL_OPTIONS, but nothing has helped and I am stuck with the same errors.
The whole code for the application is here. Has anyone experience with this error and possible ways to work around it?
As the error message says, the app consumes more memory than Heroku allocated for it. Heroku allows you to look at app metrics, graph from there might be useful for identifying the cause.
Heroku has a special guide for memory related problems in JVM application java-memory-issues. You might find it useful.
Try setting your max heap size lower by running
$ heroku config:set JAVA_TOOL_OPTIONS="-Xmx256m"
I found the culprit of the exceeded memory.
The command run by Heroku on startup was not using the jar file. What I had before was web: lein ring server-headless and I changed it to execute the jar web: java -jar target/<app-name>-standalone.jar in the Procfile.
Since I am using ring, I also have Heroku run lein ring uberjar instead of lein uberjar before startup: this is as easy as setting LEIN_BUILD_TASK='ring uberjar' as a global config var in Heroku.

How to start Puma/Rails/Nginx on Debian after boot

Ok, I'm deploying my Rails App using Capistrano. I'm also using Puma. I've followed this tutorial to get it to work, although I'm using Debian rather then Ubuntu.
Everything works fine and I can deploy my app without issues. However if my server crashes or the server restarts, the App doesn't restart itself and the only way I got it to restart was deploying it again with the following command cap production deploy from within my App in my local machine, which we all can agree that's not ideal.
There's loads of information on the web on how to deploy a Rails App with Passenger, which I'd rather avoid to use due to lack of resources on the server part. I've also found this tutorial which seems to be a bit outdated.
Can someone please point me to an updated tutorial or give some directions on how I could get my App to start/restart who the server?
Many thanks
EDIT
As per #mudasobwa's comments, I'm detailing the steps I've taken after reading this page:
I have copied the contents of https://github.com/puma/puma/blob/master/tools/jungle/init.d/puma into /etc/init.d/puma made it executable. I've also copied the contents of https://github.com/puma/puma/blob/master/tools/jungle/init.d/run-puma into /usr/local/bin/run-puma also made it executable.
Lastly I've created a puma.conf file in /etc.
After that I've created the following directory: /path/to/app/tmp/puma and added these two files: pid and state. Note that I've also added the aforementioned folders into Capistrano's shared links structure.
After the above I've restarted my server and the App did not start as I expected.
What am I missing here?

Dokku identifies rails application as node application

I'm new to Dokku, and got a mature Heroku project running for 3 years, I got this annoying issue that Dokku thinks my rails app is a node app probably because I got the package.json file that I use for client side tests. What should I do (currently I renamed this file to trick Dokku but this is kind of hacky) to tell Dokku I have a rails app? What is the proper buildpack I should specify and how.
You can specify a custom buildpack as noted here.
For your application, you'll probably want to use the ruby buildpack.

Elastic Beanstalk Ruby processes consuming CPU

I have had a Rails 3 app deployed on Elastic Beanstalk for close to 2 years now. For the most part, I haven't had any issues; however, I recently upgraded to one of their new Ruby configurations (64bit Amazon Linux 2014.09 v1.0.9 running Ruby 2.1 (Passenger Standalone)) and I've been fighting an issue for several days where one of more Ruby processes will consume the CPU - to the point where my site becomes unresponsive. I was using a single m3.medium instance, but I've since moved to a m3.large, which only buys me some time to manually log into the EC2 instance and kill the run away process(es). I would say this happens once or twice a day.
The only thing I had an issue with when moving to the new Ruby config was that I had to add the following to my .ebextensions folder so Nokogiri could install (w/bundle install)...
commands:
build_nokogiri:
command: "bundle config build.nokogiri --use-system-libraries"
I don't think this would cause these hanging processes, but I could be wrong. I also don't want to rule out something unrelated to the Elastic Beanstalk upgrade, but I can't thing of any other significant change that would cause this problem. I realize this isn't a whole lot of information, but has anyone experienced anything similar to this? Anyone have suggestions for tracing these processes to their root cause?
Thanks in advance!
Since you upgraded your beanstalk configuration, I guess you also upgraded Ruby/Rails version. This bumped up all gem versions. The performance issue probably originate from one of these changes (and not the Hardware change).
So this brings us into the domain of RoR performance troubleshooting:
1. Check the beanstalk logs for errors. If you're lucky you'll find a configuration issue this way. give it an hour.
2. Assuming all well there, try to setup the exact same version on your localhost (passenger + ruby 2.1 + gems version). If you're lucky, you will witness the same slowness and be able to debug.
3. If you'd like to shoot straight for production debugging, I suggest you'd install newrelic (or any other application monitoring tool) and then drill into the details of the slowness in their dashboard. I found it extremely useful.
I was able to resolve my run away Ruby process issue by SSHing into my EC2 instance and installing/running gdb. Here's a link - http://isotope11.com/blog/getting-a-ruby-backtrace-from-gnu-debugger with the steps I followed. I did have to sudo yum install gdb before.
gdb uncovered an infinite loop in a section of my code that was looping through days in a date range.

Restarting Rails Application

I am building an application that will only be run on a local network and am looking for the best way to restart my server from within the application itself. For the time being this is only running on Windows using WEBrick.
Look at Capistrano as others have suggested, it's fantastic :)
$ cap deploy
That's all you have to do. It'll grab the latest source from your git/SVN repo (lots more supported ofc), deploy, and restart your app server.

Resources