Improving the precompile experience

17 views
Skip to first unread message

Richard Hulse

unread,
Mar 16, 2012, 4:24:21 PM3/16/12
to wellr...@googlegroups.com
For those who might not have seen it, I have written a blog post about getting rid of precompile on the production server.

In a nutshell, you precompile and commit locally, and change a couple of settings in your dev config to NOT serve those compiled assets (which is the default), but still use Sprockets. That means you only have to compile (and commit) when you change something, and the deploy is much faster.

If you are anything like me, I tend to code in phases. If I am working on features with no asset or Gem changes, and deploying often, it is nice to have the deploy speed back to what it was before Rails 3!


Cheers,
Richard 

nahum

unread,
Mar 16, 2012, 8:04:11 PM3/16/12
to wellr...@googlegroups.com
How do you ensure that you don't forgot to pre-compile your assets? IE prevent a deployment with the wrong/old assets?

--nahum

Matt Powell

unread,
Mar 16, 2012, 11:33:42 PM3/16/12
to wellr...@googlegroups.com
It's simple enough to write a pre-commit hook that scans a changelog, compares mtimes with compiled assets, and runs a rake task if the results are found wanting.

M
--
You received this message because you are subscribed to the Google Groups "WellRailed" group.
To view this discussion on the web visit https://groups.google.com/d/msg/wellrailed/-/eIZDf8q1jKIJ.
To post to this group, send email to wellr...@googlegroups.com.
To unsubscribe from this group, send email to wellrailed+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/wellrailed?hl=en.

Nahum Wild

unread,
Mar 17, 2012, 1:06:31 AM3/17/12
to wellr...@googlegroups.com
I'd rather have a slow deploy.

--nahum

Matt Powell

unread,
Mar 17, 2012, 3:07:53 AM3/17/12
to wellr...@googlegroups.com
Me too :)

Daryl Manning

unread,
Mar 17, 2012, 2:29:22 AM3/17/12
to wellr...@googlegroups.com
Out of curiosity, has anyone tried working with rack-pipeline from LivingSocial? 


Looking at it for some sinatra/padrino asset compiling.

Daryl.

Jared Armstrong

unread,
Mar 25, 2012, 10:49:48 PM3/25/12
to WellRailed
When the time comes when things are on fire and you have to deploy an
urgent patch -- having a deploy that only takes a couple of seconds
can be pretty valuable.

My position is that assets should only be precompiled if there are
changes affecting assets since the last deploy. Here's a Capistrano
deploy.rb snippet that checks this: https://gist.github.com/2202542

Personally, I'm indifferent on whether this should be done client-side
or server side. Arguably, you save CPU cycles precompiling from a
single location if you have multiple frontend servers... but other
than that it should take the same elapsed time (probably less, if you
have a decent server) whether you do it before or during a deploy.
That is, you still have to wait till your assets precompile before you
can deploy whether or not you do it server(s) or locally.

Jared

On Mar 17, 8:07 pm, Matt Powell <fauxpa...@gmail.com> wrote:
> Me too :)
>
>
>
>
>
>
>
> On Saturday, 17 March 2012 at 6:06 PM, Nahum Wild wrote:
> > I'd rather have a slow deploy.
>
> > --nahum
>
> > On Sat, Mar 17, 2012 at 16:33, Matt Powell <fauxpa...@gmail.com (mailto:fauxpa...@gmail.com)> wrote:
> > > It's simple enough to write a pre-commit hook that scans a changelog, compares mtimes with compiled assets, and runs a rake task if the results are found wanting.
>
> > > M
>
> > > On Saturday, 17 March 2012 at 1:04 PM, nahum wrote:
>
> > > > How do you ensure that you don't forgot to pre-compile your assets? IE prevent a deployment with the wrong/old assets?
>
> > > > --nahum
>
> > > > On Saturday, 17 March 2012 09:24:21 UTC+13, Richard Hulse wrote:
> > > > > For those who might not have seen it, I have written a blog post about getting rid of precompile on the production server.
>
> > > > > In a nutshell, you precompile and commit locally, and change a couple of settings in your dev config to NOT serve those compiled assets (which is the default), but still use Sprockets. That means you only have to compile (and commit) when you change something, and the deploy is much faster.
>
> > > > > If you are anything like me, I tend to code in phases. If I am working on features with no asset or Gem changes, and deploying often, it is nice to have the deploy speed back to what it was before Rails 3!
>
> > > > >http://richardhulse.blogspot.co.nz/2012/03/rails-how-to-compile-and-c...
>
> > > > > Cheers,
> > > > > Richard
>
> > > > --
> > > > You received this message because you are subscribed to the Google Groups "WellRailed" group.
> > > > To view this discussion on the web visithttps://groups.google.com/d/msg/wellrailed/-/eIZDf8q1jKIJ.
> > > > To post to this group, send email to wellr...@googlegroups.com (mailto:wellr...@googlegroups.com).
> > > > To unsubscribe from this group, send email to wellrailed+...@googlegroups.com (mailto:wellrailed%2Bunsu...@googlegroups.com).
> > > > For more options, visit this group athttp://groups.google.com/group/wellrailed?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups "WellRailed" group.
> > > To post to this group, send email to wellr...@googlegroups.com (mailto:wellr...@googlegroups.com).
> > > To unsubscribe from this group, send email to wellrailed+...@googlegroups.com (mailto:wellrailed%2Bunsu...@googlegroups.com).
> > > For more options, visit this group athttp://groups.google.com/group/wellrailed?hl=en.
Reply all
Reply to author
Forward
0 new messages