I'm running Teambox (a Ruby on Rails app) and have the server running with:
script/server -e production
Knowing absolutely nothing about Ruby on Rails I just wandered how I could restart the server to get it to update changes I've made to the config?
If you ran it with that command line it's probably running actively in the console, just CTRL+C.
If you ran it daemonize you will need to find the process and kill it.
Related
I setup Nginx for listening to lockalhost:3000 than I launch rails command bundle exec rails server webrick -e production. I found that I can launch rails server as daemon simply adds the -d flag to the command, so the command becomes a bundle exec rails server -d webrick -e production. My problem is that after server reloads or app is crushed - that a dead-end, I can't found info about how should I create "rails as a daemon with auto relaunch".
webrick in production?
Please please please refrain from doing anything like that. Use puma or unicorn or any similar app server for your purpose.
And for the process monitoring part, you can use systemd, or monit for better control.
Personally, I prefer monit as it gives me crash logs and downtime alerts.
I have been working on a rails app for months and then, all of a sudden the pumas server does not work on my laptop. I've tried different older branches (in case I changed something) I've uninstalled and reinstalled ruby. Nope. It DOES work if I do a fresh pull and load it on my desktop, so it seems to be something on my laptop? I am really lost.
Here's what I've done already:
Restarted the computer
reinstalled ruby
Tried puma
Tried rails s
Tried different branches to see if something I did yesterday somehow broke it
reinstalled gems
The error is:
The localhost page isn’t working
localhost didn’t send any data.
However, right before it was running this error, it ran a Request time out error, if that matters.
What I really don't understand is why it's only happening on one computer.
I am running Ruby 2.3.0 and rails 4.2.6
UPDATE
It DOES running rails server and not puma.
The problem is, I'm using foreman to start sidekiq with my server, and that's how I debug sidekiq queues. Strangely, sidekiq still works, but I can't access the localhost page.
This is my procfile:
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -c 2 -q default -q mailers
Again, I haven't changed anything with puma and rails s works fine.
When running rails server on cloud9, I get: No application seems to be running here! I tried removing the workspace, cloning it from a repository on github, and nothing works.
The solution that works for me is:
to start the server, do not simply type
rails s
but instead
rails s -b $IP -p $PORT
I built a rails app and successfully deployed it to heroku
Now I would like to access the development version to make changes on my local machine
When I rails s I get the error:
A server is already running. Check /home/username/myApp/tmp/pids/server.pid
That file has one line that reads 2673
What can I do to start the rails server while the app is hosted on heroku?
rm /home/username/myApp/tmp/pids/server.pid
Then
rails s
If it is not working
If you want to kill rails server process on port 3000 (which is what webrick normally uses), type this in your terminal to find out the PID of the process:
$ lsof -wni tcp:3000
Then, use the number in the PID column to kill the process:
$ kill -9 PID
Then
rails s
Hope you will be able to run rails server again in your local m/c
I am having Apache + phusion passenger, I have put
RailsEnv production
in /etc/apache2/sites-available/default file and have restarted apache but when I am running
rails c
> Rails.env.production?
it gives fales where as for
> Rails.env.development?
it gives true. Is there any other way to restart passenger as I do think putting "RailsEnv production" in default is the right way ? btw I am using
sudo service apache2 restart
How to start my ruby on rails app in Production mode with passenger + apache ?
just create a restart.txt in tmp dir of your app
e.g.
touch %RAILS_ROOT%/tmp/restart.txt
look here
http://www.modrails.com/documentation/Users%20guide%20Apache.html section 3.3
Your app is probably in production mode already.
By default, rails c loads the app in dvelopment mode.
If you want your console to be launched in production mode, do the following :
RAILS_ENV=production rails c
The console and the web app are two different rails proccess and run independently.
You should check your production.log file to be sure that your app runs in production.
Just for starting app with particular port use below command:
passenger start -a 0.0.0.0 -p 3000 -d -e production
I followed the commands listed in PhusionPassenger docs here and they worked straight-away.
deployer#staging:~$ passenger-config restart-app
Please select the application to restart.
Tip: re-run this command with --help to learn how to automate it.
If the menu doesn't display correctly, press '!'
‣ /home/deployer/myapp/current (staging)
/home/deployer/myapp_2/current (staging)
Cancel
Restarting /home/deployer/myapp/current (staging)
deployer#staging:~$ passenger-config restart-app
Please select the application to restart.
Tip: re-run this command with --help to learn how to automate it.
If the menu doesn't display correctly, press '!'
/home/deployer/myapp/current (staging)
‣ /home/deployer/myapp_2/current (staging)
Cancel
Restarting /home/deployer/myapp_2/current (staging)