Start Juggernaut and Redis with rails app - ruby-on-rails

I'm developing a app with Ruby on Rails. It uses juggernaut. Is there anyway I can get redis and juggernaut to start when I run rails server. thanks

Yes, but a better way is to use software designed for the purpose, such as Foreman. It's a Ruby program for running and monitoring processes alongside your web app and is very easy to configure, plus it exports to upstart and init, either of which you're likely to be using in production. Take a look, I think you'll like it.

Related

Rails 3 and Thin. Is there a way to execute a file after thin starts?

I currently have a rails 3.2 app that I am going to use thin as a web server for. I haven't found a way or know if what I am even attempting is possible which is why I came here to ask. What i'm trying to do is after I start my rails app with the usual bundle exec thin start to afterward execute a ruby file/script to load up another web event based mini application(pure ruby non web framework) that will uses the same server/ data store as the main rails app. Is there such a hook either with thin configs or rails start up configs to accomplish such a thing?
-edit-
to clarify, the mini application is within the rails app in its own directory, it is not an external app which is why it will share resources.
Have you tried Foreman? It is a tool used for describing and launching all the individual processes your application requires (potentially covering both your main web server, thin, and the secondary Ruby process you mentioned). You would just install Foreman, then write a Procfile describing both processes to run at startup.

deploy rails choices

After I finished reading Agile Web Development with Rails, I Have developed my own website.
Now I am trying to deploy my project on linux system I rent, but I know nothing about how to deploy rails.Which server should I user? How to connect to mysql database?
As a java developer, I know I can use tomcat as my server which can convert http request to my own object and use jdbc to connect to my mysql database.
Now I want to know what is the main stream environment rails deployed?
I have heard of Lighttpd and FCGI. Can I use them in the product environment?
thanks
Is your linux system a full VPS (you have complete control?) If not, check your hosting company to see what options are available to you. If so, check to see if they have guides for setting up Rails. A lot (Slicehost, Linode, etc.) do.
Failing that... I would recommend either Apache (or Nginx) with Passenger.
https://www.phusionpassenger.com/
It's pretty straight forward.
As for actually deploying, look into Capistrano (or Vlad). These are a little bit more complicated, but they make life so much easier in the long run.

How do I setup multiple rails applications for development?

For the site I am currently working on we have 2 Rails 3.2 projects. One project is basically an API, and the other is a web front end. In order to develop on the web front end I need to have the API project running. I've tried using the foreman and subcontractor gems to manage this but it doesn't seem to work. Both projects run the Thin application server and have their own RVM gemsets. We also run Nginx in production.
How would you go about managing this setup for development? I want there to be 1 command to fire up everything, similar to how Foreman works.
Requirements:
RVM Support
Thin for development
One command I can run from the API application to start both applications
Cannot using Pow (it always seems to get hung up and is incredibly slow)
Setup should work for other developers with minimal setup (easily scriptable)
Works on OSX
Thanks!
tmuxinator allows you to easily configure a tmux session that can be launched with a single command containing any number of windows (tabs) and executes commands in each window (like starting a server). Just configure it to load the appropriate gemset for the appropriate rails server.
https://github.com/aziz/tmuxinator
another, very cool alternative to the tools you've mentioned is Invoker.
it's worth checking out, as it allows to run multiple processes at once (as well as terminate them), like foreman does and it offers .dev domain which mimics pow behavior.

How to install Ruby script on server?

I apologize in advance for the fairly simple question.
I am familiar with PHP, but am trying to install this Ruby script on my server for the first time. It's an open source script that I've forked from github, but unfortunately does not have any instructions. I have Ruby on Rails, and MongoDB installed already.
Does anyone know what the beginner steps are to get started? Should I upload everything via FTP to the public directory, or is there something else to this?
Most Rails projects are much better served by having a proper deployment strategy. Typically this involves making your own repository, easily done by forking that existing application, and cloning that on to your server using git. To make changes in the future, do your work on a development copy, push that into the repository, and pull down the changes on the server.
Unlike PHP where many parts of the application can function independently, Rails applications tend to be far more integrated and uploading it piece by piece is not going to work in the long run.
Rails applications can run stand-alone using the provided rails server tool but this is really only intended for light-duty testing or development work. A more permanent solution is to use something like Passenger to do the hosting for you.
Passenger will take care of launching your application when calls are made to the site you've configured in Apache or nginx, depending on which you end up using. Passenger is popular because it's quite easy to get running.
There are other approaches like unicorn if you're feeling more adventurous.
When you make changes to your Rails application in production mode you will have to create a tmp/restart.txt file in the main application directory to tell your web server to restart the process. This is not a requirement in development mode.
Due to the relative complexity of this process once you include all the various steps, you will probably want to use a deployment automation tool like capistrano.

What requirments are necessary for a webhoster to host Diaspora*

What do I need to get from a webhoster if I want to host my own Diaspora* seed? Do I just need some webspace with ruby on rails capabilities? I suppose it uses Ruby On Rails SOAP for communication between seeds? If so what is needed for this?
According to the README on GitHub, you need Ruby, MongoDB, OpenSSL, ImageMagick, Git, RubyGems, and Bundler... so any decent shared hosting that allows you to build things in your homedir and run custom long-running processes should do the trick.
(Decent because the non-decent ones may omit Git or ImageMagick and not give you the resources to install them yourself. Long-running processes for MongoDB and the Diaspora app server.)
WebFaction, for example, should meet those needs but Dreamhost may not unless the Diaspora app server can somehow be managed by FastCGI to work around their long-running process killer. (Dreamhost apparently supports MongoDB, so that would be exempt from the killer)
Seriously though, I'd recommend waiting. Diaspora was just released. It's still in development and, if anything, probably best to be experimented with on your home PC for at least a few more months.
In general you need a server which allows you to run background processes, as diaspora* uses Sidekiq to process background jobs.
Any VPS Linux server for example with a recommended minimum 1GB should do fine for a small user base.
See: https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers#What_are_the_general_system_requirements.3F

Resources