• Skip to site navigation
  • Skip to blog entries
  • Skip to archive page
  • Skip to left sidebar
  • Skip to right sidebar

Entries by Señor Rolando

l.p.g. - flammable gas

  • home
  • about
  • privacy

Sunday, May 6. 2012

There is no magic in deploying Rails' assets without a javascript runtime at the production site

Rails is a great playground and web development framework. And as it is with playgrounds: people do crazy things with it all the time. Like coming up with the asset pipeline. Which is a great thing, of course. It takes all the usual assets of a web development game – images, javascript, and stylesheets – and transforms them so that they are fast and easy to use. That's just amazing.

Amazing until it comes to deployment. A tough subject with Rails in general. And the asset pipeline doesn't make it any easier. Because it heavily depends on a working javascript runtime at the production site. But who wants to have a javascript runtime on a production server? If one is not using Node.js as a backend framework, that is? Correct: nobody with a sane right half of a brain.

The office documentation on the asset pipeline has some kind of a solution:
If you do not have write access to your production file system, you can call this task locally and then deploy the compiled assets.


It does not, however, really say how to do so. You have basically two options:

Precompile the assets locally and check them into your favourite version control system.

This works. The precompilation puts everything into public/assets/. You check this in. And Capistrano handles everything else magically.

The trouble with this approach is, though, that it isn't really clean and doesn't feel right. Why? Because compiled things should not end up version controlled. And because you mess up your repository with potentially old and outdated files that have an MD5 fingerprint in their filename. An elegant solution looks different.

Precompile the assets and copy the result over to your production site when deploying everything else as well.

This looks way better.

The only question is: How? Deployment is – hopefully – done via Capistrano. Which – for most of us – works like magic. Which is generally a good thing. So take a breath of fresh air, fill up your glass of red wine, and head over to: Stackoverflow, of course. There, Aaron Renoir shows a code snipped that you just need to add to config/deploy.rb, adjust some paths, and: et voilà, done.



So, that's what you do:

  1. Add the above mentioned code snipped to your deploy.rb.

  2. Run bundle install --without assets on the production site.

  3. Run bundle exec rake assets:precompile locally.

  4. Run env RAILS_ENV=production cap deploy locally.

  5. Watch the magic happen.



Now, who again is saying that Rails seems to be slowly turning towards being the new Java of web development? Makes one think, doesn't it?
Posted by
Señor Rolando
| No comments | No Trackbacks
Defined tags for this entry: asset pipeline, capistrano, rails

Friday, April 27. 2012

Fish. Or: Don't just like - care!

Fish: There is no back button.

This is one of the plain and simple rules of Fish – a tap essay. Which is actually an app, a reading app by Robin Sloan. And it doesn't really do much more than simply showing text. One tap at a time. So, you can't do anything more with the app than reading it's text linearly. From start to end. Without going back in between.

And guess what? It's the text that counts. Which is about not just clicking a plain like button when you stumble across something great. Instead, it asks you to care. To care about all the things we find and deem valuable.

To care is not an easy thing, though. Because, first of all, we need to be able to actually get to where the value is. Like Robin Sloan's essay. Which comes as an app. A native app. And this is not deemed as an exceptionally fine idea by everybody. Like, not so by Tim Berners Lee. Who asks us to go out, open our eyes, and see whether we can actually like something. By being able to access it:
“Every time somebody puts a magazine on a phone now and doesn’t put it on to a web app [a form of open software] you know we lose a whole lot of information to the general public discourse – I can’t link to it, so I can’t tweet it, I can’t discuss it, I can’t like it, I can’t hate it.”


Both texts are full of valuable ideas and insights, full of reminders, and inspirations. Worth a look.
Posted by
Señor Rolando
| No comments | No Trackbacks
Defined tags for this entry: app, robin sloan, tim berners-lee

Tuesday, April 24. 2012

En passant optimisation

Premature optimisation is a silly thing. But knowing a thing or two about the environment one is working in may just help to speed things up without affecting much of the respective development environment. Like this little comment on saving bandwidth on a web app's requests by simply separating static assets from dynamic content:
[…] when an asset is fetched from the same domain as your website, the user agent that fetches that asset will upload any cookie data that is stored for that domain and that matches that path. Since Rails stores session data in cookies by default, you can imagine how much unnecessary data is being transfered back and forth just to fetch some asset files.


The price is some overhead in deployment, which now targets at least two destinations instead of just one. But it's a nice little boost that can be collected en passant.
Posted by
Señor Rolando
| No comments | No Trackbacks
Defined tags for this entry: development

Thursday, April 19. 2012

Wanted: non-VC media

This is an overdue request:
I’d rather our tech journalists recalibrated their focus on those companies that are demonstrably gaining traction (as evidenced by revenue) rather than focus on the latest shiny social media offering with a dubious value proposition.


Good point. And if anybody knows of some startup media that do just this, please let me know. Techcrunch, Mashable, Gründerszene – those aren't it. What is?
Posted by
Señor Rolando
| No comments | No Trackbacks
Defined tags for this entry: media, online, startup

Friday, March 2. 2012

Stop stealing dreams

Stop stealing dreams (what is school for?)

Seth Godin may not be everybody's friend. And he has a tendency for the pathetic at times. But when talking about education he often hits the mark.

His newest ebook talks about education. And schools. And what's currently wrong with both. And how to fix it:

The common school is going to take a generation to fix, and we mustn’t let up the pressure until it is fixed.

But in the meantime, go. Learn and lead and teach. If enough of us do this, school will have no choice but to listen, emulate, and rush to catch up.


Great stuff. Go there, take it, read it, share the love.
Posted by
Señor Rolando
| No comments | No Trackbacks
(Page 1 of 58, totaling 289 entries) next page »
Powered by s9y. Template based on bulletproof.