pieter michels

Github    Ask me anything   

programming trip and tech thoughts

January 23, 2012 at 8:36pm

0 notes

How to login to postgresql through psql from a linux user →

If you get these errors while trying to access your PostgreSQL database through ‘psql’:

psql: FATAL:  Peer authentication failed for user “postgres”

Exactly what I was looking for.
So I updated my postgreSQL install script.

8:34pm

0 notes

RVM loses default Ruby version when starting new shell

I recently installed a new Ruby version on a server using RVM. To make sure your new ruby installation will be used by default, you have to invoke the follow command:

(I already blogged about this)

But now, my server kept forgetting this and each time I ssh’ed to the server (and thus starting a new shell) I was back at the default system Ruby version.

It seems you can repair your RVM environments (I didn’t know I broke something in the first place?):

January 2, 2012 at 5:28pm

0 notes

Varnish Guru Meditation

I had a problem where a Rails application communicated with a third-party API (Dropbox) to do some actions. The request would take significantly more time than a regular request, lasting for more than 15 second easily (fetching numerous directories and files).
Your browser won’t timeout on such requests, but in my case, Varnish was. It would serve me with the following message:

Clearly this is a safeguard of Varnish. It’s easy to fix this with a settings change in your ‘vim /etc/varnish/default.vcl’ file.

December 29, 2011 at 2:45pm

0 notes

Linode rocks →

I’ve been using Linode to host my websites for the past 2+ years and I’m thoroughly impressed by the service. I can’t recommend them enough — it is easily the best web hosting service I’ve used to date.

Couldn’t agree more.

December 28, 2011 at 8:31am

Notes

PDFKit Usage →

Wkhtmltopdf is an open source project that uses the WebKit rendering engine to convert HTML to native PDF code. This is the muscle behind the PDFKit gem and other projects like WickedPdf. In this article I am only going to focus on PDFKit with Rails. But many topics will apply to both PDFKit and WickedPdf since they use wkhtmltopdf on the backside.

Great guide for starting with PDFKit.

December 1, 2011 at 8:51am

0 notes

VirtualBox Linux local networking

From time to time, I run an Ubuntu virtual host on my Mac OSX machine (in VirtualBox) for testing and trying. It took me a while to figure out, how to setup this virtual machine so it has access to the Internet as well as local access to my host.

For referencial purposes, here goes:

In your VirtualBox preferences, add a ‘host-only network’ (vboxnet0). 

Adapter Settings:

DHCP Server:

Make sure you have your VirtualBox instance set up with two networks interfaces: NAT (1) and Host-only (2). Default settings are ok.

On your Ubuntu guest:

And then restart your networing.

Additionally, I configure my local Linux machine as a headless OS, as a result I only access it through SSH.

And reboot

November 23, 2011 at 2:35pm

0 notes

The twelve-factor methodology →

In the modern era, software is commonly delivered as a service: called web apps, or software-as-a-service. The twelve-factor app is a methodology for building software-as-a-service apps that:

  • Use declarative formats for setup automation, to minimize time and cost for new developers joining the project;
  • Have a clean contract with the underlying operating system, offering maximum portability between execution environments;
  • Are suitable for deployment on modern cloud platforms, obviating the need for servers and systems administration;
  • Minimize divergence between development and production, enabling continuous deployment for maximum agility;
  • And can scale up without significant changes to tooling, architecture, or development practices.

Source: http://www.12factor.net