I'm starting the Rails 3 application with the following command:
passenger start -a 0.0.0.0 -p 3000 -d
but how do I tell passenger to start the application in production environment?
passenger start -a 0.0.0.0 -p 3000 -d -e production
Side note: always check the help, passenger start --help would have told you the same.
Related
On my computer, I can start redmine by:
cd /usr/share/redmine
bundle exec rails server webrick -e production -p 3001
and this will start redmine just fine at port 3001.
If I create a bash script, it always starts at port 3000, like the parameters were ignored.
What am I doing wrong ?
This is what I have
#!/bin/bash
#exec /usr/lib/x86_64-linux-gnu/opera/opera --no-sandbox $#
cd /usr/share/redmine
# Port from settings file will be ignored either way ...
#bundle exec rails -p 3003 server webrick -e production
bundle exec rails server webrick -e production -p 3001
Quickly checked that and found that your script works perfectly fine for me, changing the port in the script also changes the port WEBrick is listening at.
So nothing wrong with the script.
I developed a Ruby On Rails application and want to deploy in production (intranet).
As of now i created an sh file to run the passenger like so:
cd /pathofmyapp
passenger start -a 0.0.0.0 -p 3000 -d -e production
cd /pathofmyapp2
passenger start -a 0.0.0.0 -p 3000 -d -e production
When the ubuntu server starts i have to execute the sh or manually start the passenger.
Is their a way to automate this so that whenever the ubuntu server starts, the command will automatically run or the ruby on rails application will start?
Thanks in advance.
You can add that to your cronjob to run the code on reboot.
#reboot cd /pathofmyapp && passenger start -a 0.0.0.0 -d -e production
I am trying to configure my own "Thingspeak" server on Ubuntu 12.04 LTS virtual machine. I introduced this commands on terminal (installation on clean install of ubuntu): https://github.com/iobridge/ThingSpeak but at the final I use:
rvmsudo rails server -d -b <myip> -p 80
This command let me run Thingspeak app on port 80 as a daemon. It works well, but when the server reboot (sudo reboot for example) the thingspeak server shut down and I don't want this, I want to automatically (on booting or startup) start the thingspeak server so I don't need to manually use in terminal the rvmsudo command again.
How can I achieve this?
You can add to:
/etc/rc.local
rvmsudo rails server -d -b -p 80
or add it to /etc/init.d as well
Updating this:
sudo nano /etc/rc.local
Add the following before the exit 0 line:
cd <folder path>
rvmsudo rails server -d -b -p 80
I have installed new ec2-instance for production server
when i tried the following command in the current folder
[ec2-user#ip-xx-xxx-xxx-xxx current]$ rvmsudo unicorn_rails -c config/unicorn/production.rb
-D --env production
sudo: unicorn_rails: command not found
Please let me know how to start the production server which is running at port 80.
Thanks in advance
For port 80: First run
export rvmsudo_secure_path=1
then
rvmsudo unicorn_rails -c config/unicorn/production.rb -D --env production
it will work for sure
You dont have to use rvmsudo and all to start your unicorn app server. You can do it
bundle exec unicorn -D -c /path/to/app/unicorn.rb -E production
I currently have the below command running as a batch script
/usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby /var/rails/sandbox/script/server -p 8080 -e sandbox -d
However the log ends at trying to initialize 0.0.0.0 8080
if I remove the -d so the script is
/usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby /var/rails/sandbox/script/server -p 8080 -e sandbox
then everything runs perfect. The only issue is I am trying to detach the output so I can reuse the terminal session.
Please let me know if there is something I need to run?
Also just an fyi if I were to run the script/server alone I would have to use rvmsudo script/server -p 8080 -e sandbox -d, I get the same issue of it trying to end at 0.0.0.0 8080 but my site will not run and I will not get the message WEBrick::HTTPServer#start