Ruby on Rails Tuesday, May 1, 2012

On May 2, 1:55 am, Claudio Poli <masterk...@gmail.com> wrote:

>
> So, how do you scale horizontally with Rails 3.2?
> Currently I have enough firepower to substain a large amount of users
> given the combination of fine tuning, nginx, load balancers, reverse
> proxy, rainbows! and whatnot, but firing up another instance and
> managing the assets seems to become a problem.
>
> Do you precompile locally to have a central assets creation point and
> avoid CPU burns and potentially long deploys on the servers?
>
> It might be out of topic but what tool (chef, puppet, etc.) do you use
> to clone, start/stop instances given the requirement of deeply
> customized config files (like for example NGINX) and managing adding/
> removing instances to an external load balancer like the AWS one?
>
The precompiling stuff twice is just dumb, but i haven't found asset
recompilation to be nearly as slow as you (~100s on a c1.medium), and
besides it happens while the app is still up).

As far as adding instances go, first off I create an ami for my app
server which has all the infrequently changing stuff on it (ruby,
apache, c libraries etc.)
The application is deployed to /var/www/dressipi, which is a separate
EBS volume. Immediately after a deploy, I create a new snapshot of
that volume.

Adding a app server instance is then a question of creating a new
instance from my ami, and asking amazon to create a new volume from
that snapshot and mount it at /var/www/dressipi. Since I use
autoscaling, i can in fact just increase the number of desired
instances and it will create the server in that manner and adds it to
the load balancer automatically ( if you use ELB then you get that
level of integration). Before we did that I used to use fog to get the
list of servers with the appropriate tags and then generated an
haproxy config file from that.

Fred


> I'm starting to have doubts in that EC2 might not be the friendlier
> cloud hosting platform for a large Rails 3.2 app.
>
> To reach my assets I'm using this:
>
> I'm using something like this:
>   config.action_controller.asset_host = Proc.new do |source, request =
> nil, *_|
>     if request && request.ssl?
>       "https://#{Settings.services.amazon.cloudfront_distribution}"
>     else
>       "http://#{Settings.services.amazon.cloudfront_distribution}"
>     end
>   end
>
> If you have any tips on a asset-less deploy configuration (digested
> possibly) with real assets hosted elsewhere I'm all ears.
>
> Thanks.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment