I am having problem to generate a log to see the error of page break in log/test.log
Everything is generating except page break issue.
I have a project running on aws
when I start puma server using
bundle exec puma -e production -d -b unix:///tmp/run/pokerstop.sock
and generate log with tail -f log/production.log commands
I can see my production log
but when I start my puma sever in test environment and check log using
tail -f log/test.log command nothing comes out
sometime page goes break on server and I want check cause of page break in test server but nothing comes out
Please help me
Thanks.
Do you expect your rails app to be run in a test environment like development and production..?
If so, run your rails server in test environment as follows:
rails s -e test
You should see the logs of your application in /log/test.log file.
Also, make sure you have added database configuration for test environment in database.yml file.
Hope this helps you.!!
Related
i host my rails application on cloud server,
my server is using centos 6,
and what i am trying to achieve is,
i want everytime server is restarted, i need my rails app to do an auto start.
i tried crontab, but somehow i can't get it working,
here is my crontab content :
#reboot cd ~/UAAdmin/urbanacecode && /usr/local/rvm/gems/ruby-2.2.4/bin/bundle exec rails server -d >> deploy_log.log 2>&1 &
as you can see, i dump my crontab result to log file,
somehow it's not working?
here is my dump result :
/usr/bin/env: ruby_executable_hooks: No such file or directory
this is very strange, because when i tried to run my crontab commands manually, i can see the server running.
i ran this manually
cd ~/UAAdmin/urbanacecode
then
/usr/local/rvm/gems/ruby-2.2.4/bin/bundle exec rails server -d
what should i do to get it working? please advice,
oh btw i am pretty new with linux OS, so kindly give an example
how to do it properly.
many thanks..
I have deployed on a VPS a Rails 4 application that executes shell command depending on the tasks. The app runs on Nginx with Passenger.
The situation I am having is that none of the shell commands work. After a bit of debugging, I've noticed that every command returns a "not found" error message.
For example:
out = %x[date 2>&1] # outputs 'sh: 1: date: not found\n'
why is this happening? is there some configuration setting I should set to allow shell commands in production mode? I am quite new to rails so I'm not really sure what could be causing this.
UPDATE:
Here's a bit more information, when querying from rails whoami, i get www-data, if I print the $PATH I get /usr/local/lib/ruby/gems/2.1.0/bin but then if in the command line execute sudo -u www-data printenv PATH the result is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin... Does this makes any sense?
Typically if you use your localhost, you can just run
rails s
from terminal and then when you hit your webserver, you can see the output.
However, when I run
heroku run rails s
and then I hit my webserver up on heroku, I don't get any output like I do when I "rails s" with localhost.
Is there anyway to achieve this?
If you want to see the live server logs, use this command
heroku logs -t
There are many more options available, look at this answer heroku - how to see all the logs
You can use heroku logs command in terminal to see the log just like you see using rails s command.
I am struggling to trouble shoot my app. I am new to AWS EC2 and come from Heroku. Generally I would use my "heroku logs --tail" console command to see why my app is erroring but on AWS I do not have that luxury (or at least know how).
To enter my production environment in the command line I...
...go to the folder where my example.pem is
...type ssh -i example.pem ubuntu#55.555.55.555
...type cd /etc/
...type cd /etc/projects/myapp
and from there I can
..."git pull origin master" to do my github pulls
..."sudo service apache2 reload" to restart my server after a change
...run "rails s" to see the logs on the local server.
The error does not happen when on "rails s" 55.555.55.555:3000 it only errors on live production 55.555.55.555.
How can I troubleshoot or at least see the production logs?
Use(inside Rails app directory):
tail -f log/production.log
I have deployed my rails application on EC2. It runs on two servers. One for rails application and second for DB.
When I start application using "rails s -e production&" and if I stay connected using SSH,
I can see the webpages.
As soon as I disconnect SSH I can not see the pages.
There are no errors thrown. One weird thing is "Production.log" file does not have anything.
everything is spit out on console.
You are running rails in the current ssh session. Any programs you have running during that session will stop if you disconnect. You need to set up your rails app to run as a daemon using something like Phusion Passenger.
You are basically running the built in WEBrick server that is not really meant for production so it's likely that the process is getting killed after the parent process (your ssh process) gets terminated.
You can probably tweak the configuration to make WEBrick not quit, or you can simply run your session using screen or tmux
Screen:
$ screen
$ rails s -e production &
$ screen -d
When you want to reattach:
$ screen -r
Tmux:
$ tmux
$ rails s -e production &
$ # Hit <ctrl-b><ctrl-d> to detach
When you want to reattach:
$ screen attach -t 0
Or like #datasage mentioned you can run your Rails with an actual production web server like Passenger Phusion or Unicorn.