Forum: Ruby on Rails startup script

D4f686347ef32cfa994086f281772d79?d=identicon&s=25 Jay Amorin (Guest)
on 2014-02-27 16:56
(Received via mailing list)
Hi,

I just started ruby on rails. Would it be possible to create a start
script
that I can use on boot?

/etc/init.d/my_rails_init_script.sh {start|stop}

I've search the web and I can't find any.

Thanks,


Jay
A47e0a6beeb9d048ff054fc1c3a97418?d=identicon&s=25 Walter Davis (walterdavis)
on 2014-02-27 17:01
(Received via mailing list)
Generally, you only start the Rails application directly if you're
hosting it locally, for development purposes. For all other forms of
deployment (public) you would have a Web server to front-end requests
and pass them along to your Rails app, which would be running in
Passenger or Thin or another application server. That would be the thing
you would start, not Rails itself. In the case of Passenger, it starts
when Apache does, and keeps Rails hot and ready to receive requests as
long as Apache is running.

Starting up Apache or Nginx at system boot is a really well-soved
problem, you would probably have a harder time getting it to _not_ start
at boot.

Walter
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2014-02-27 18:09
(Received via mailing list)
On Thu, Feb 27, 2014 at 7:59 AM, Walter Lee Davis <waltd@wdstudio.com>
wrote:
> For all other forms of deployment (public) you would have a Web server to
front-end requests and pass them along to your Rails app, which would be running
in Passenger or Thin or another application server.

Yes, and that "another application server" needs to be started, so --
not sure what your point is.

To the OP - one app server, Puma, comes with an init.d script; you
might get some ideas from that even if you choose another server.

( See <https://github.com/puma/puma> under 'tools' )

Good luck,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassa
A47e0a6beeb9d048ff054fc1c3a97418?d=identicon&s=25 Walter Davis (walterdavis)
on 2014-02-27 18:18
(Received via mailing list)
My point is that "starting rails" at system start smells of someone
trying to host production in Webrick.

Walter
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2014-02-27 18:27
(Received via mailing list)
On 27 February 2014 15:52, Jay Amorin <jeeyessos@gmail.com> wrote:
> Hi,
>
> I just started ruby on rails. Would it be possible to create a start script
> that I can use on boot?
>
> /etc/init.d/my_rails_init_script.sh {start|stop}

Can you explain why you want to do this?  It is a bit unusual for
someone just starting rails to want a server running from boot,
assuming that is what you mean to achieve.

What would be in the startup script to start the server?

Colin
D4f686347ef32cfa994086f281772d79?d=identicon&s=25 Jay Amorin (Guest)
on 2014-02-28 05:34
(Received via mailing list)
I just want that every time i restart my server, rails would also be up
and
running. No need for me to login and cd to your rails apps and then type
rails server.

I already did those cool stuff, nginx proxy on the frontend, rails on
the
backend.

The thing is my current rails don't comes with a startup/init script. I
hope that someone already did that and would like to share.

Jay
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2014-02-28 12:33
(Received via mailing list)
On Friday, February 28, 2014 4:33:05 AM UTC, Jay Amorin wrote:

>
Typically people don't use `rails server` in production, which is
probably
why you haven't found any examples of that. You're more likely to use
something like unicorn, puma, passenger (either the standalone version
or
the nginx/apache module version) and you shouldn't have trouble finding
startup scripts for those.

Fred
06e4c84000579d88c9298a6616a42e29?d=identicon&s=25 Carlos Figueiredo (Guest)
on 2014-02-28 15:29
(Received via mailing list)
I can not figure out why it can not be done... if you put a symbolic
link
for your ruby binary, you just need to do something like

/etc/init.d/start_fancy_ruby_script.sh

# /bin/ruby
#
puts "Your fancy script works"




On Fri, Feb 28, 2014 at 8:31 AM, Frederick Cheung <
06e4c84000579d88c9298a6616a42e29?d=identicon&s=25 Carlos Figueiredo (Guest)
on 2014-02-28 15:35
(Received via mailing list)
Oh sorry... only now I figured out that I was answering on a rails
group...
so it could be about a rails app that you need to start with init.d

In that case... you can also use a script.. but it is a more complicated
one...

As recommended above, it's better use passenger or unicorn...


On Fri, Feb 28, 2014 at 11:28 AM, Carlos Figueiredo <
D4f686347ef32cfa994086f281772d79?d=identicon&s=25 Jay Amorin (Guest)
on 2014-02-28 15:55
(Received via mailing list)
Now I get it. Thanks guys for pointing me to the right direction.

Jay


On Fri, Feb 28, 2014 at 7:31 PM, Frederick Cheung <
0ed528398892e60aa5c2833916ee7ce4?d=identicon&s=25 Phillip (Guest)
on 2014-02-28 21:53
(Received via mailing list)
www.phusion*passenger*.com
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.