So I am using rails with puma and nginx as my reverse proxy and server for a rails API server.
Every time I make an update on my files , such as updating the model , or controller. I've discovered that my files weren't updating on to production. Discovering this, I found out that I had to restart my puma and nginx each time i made a change.
After i restart both puma and nginx , i see that my APi server looks updated. So i decided to check the console through "rails c production" and I discovered that it couldn't load any of the models and would just keep returning me
NameError: uninitialized constant Post
from (irb):1
Fiddling restarting my servers back and forth , or maybe a period of time , it would magically work on it's own and my files would be updated. Could someone explain to me how do I update my rails production server ? and why is this happening.
Related
I'm new to Ruby on Rails, and am trying to set up a basic, local web server in order to dive into all the framework has to offer. I've installed rails using
gem install rails
and have everything seeming to work. However, I also downloaded rails 5.0.0.rc1. When I call to boot up the server with
rails s
or
bin/rails server
it just ends up with a blank screen on http://localhost:3000. Does this have anything to do with the installation of rails 5.0.0.rc1? Why am I just getting a blank screen and not the default information page which signals that it is working?
I am using foreman in my Rails application and all works fine when I run foreman start but sometime I forget it and run only Rails application as rails s. Then I spend some time trying to investigate problems related to not working services (like sidekiq).
So, can somebody recommend a way how to force starting my application through foreman only? In other cases I want to see error message.
You could add an environment variable to .env, which is read when Foreman starts, and then check for its presence in a Rails initializer.
I've just recently checked out a code, and everything seems fine, but after I decided to test the production environment via rails server -e production I notice there is no logs/production.log created, I thought it was some permission error so I deleted the development.log but it is able to recreate it but not with production.log
I'm on rails 3.2.13 by the way and I've tried updating all the way to rails 3.2.2 and my app is still unable to create a produciton.log
It does write a log if i touch log/production.log but it doesn't seem to be able to create a log from scratch.
I've tried those 3 hosting approaches for my Rails app, and no matter what I do, I can't get consistant logging when I run in the production environment.
For my tests, I created a blank app and tried to access the root directory. I would then add a users scaffold and rake the database.
If I turn RAILS_ENV to development, the log/devlopment.log works just fine, logging everything that I would expect.
When I turn RAILS_ENV to production, the log/production.log logs in a strange manner. In Passenger, I get the first routing error. Then nothing. When I restarted apache or nginx, I would get all the routing errors that I had caused since the first (logged) one, then the log would fail to write anything new until I restarted the underlying server. apache2/error.log would get logged to if I had a configuration issue. Then it only logged cache misses
With Thin and Unicorn, I only get errors about the static assets (I did not precompile the assets). Once I precompiled the assets, no more log messages appeared.
On all 3 setups, I would get precompilation messages (when I ran assets:precompile) in production.log (indicating that Rails could at least write to the log).
Does anyone have a Rails 3.2.1 app that is running on one of the deployment gems (Passenger, Thin, or Unicorn), that is logging correctly in production mode? I've spent 5 days working on this. I'm out of ideas.
Turns out its a reported issue in Rails 3.2.x. A fix has been submitted and will hopefully be released with Rails 3.2.2.
https://github.com/rails/rails/issues/4277
I am running Apache2 with Passenger and Rails. I am able to run my web app with 'rails s -e production' but Passenger will not run the app. It just gives the 500 error. The log is giving me the whole precompile error, but changing the config to precompile or 'rake assets:precompile:all' do nothing. I am working with an existing SQL database and it sometimes also gives a table not found error when running behind Apache, but works just fine in WEBRick. I have a "RailsEnv production" directive which did nothing either. I do not understand why it would not work with Passenger but with WEBRick, especially when I got it working with Apache before, then simply redeployed the app in a different directory and got these issues. There is also a cache: get miss error but I resolved it I believe, but my app still does not work. I have been working on it all day yesterday and today and still can not get the app to run with Apache. Already tried permissions, already tried reinstall, already tried db:migrate, already tried everything. Does anyone know why it is failing?