Skip to main content

Posts

Showing posts from December, 2014

Using multiple accounts with Github

If you're like me and have a personal Github account but work for a company that also uses Github you will probably want to be able to set up multiple accounts on Github. It's pretty simple to do so: Firstly you need to create a new key for your company account. Make sure that you save it to a file other than the default id_rsa otherwise you'll overwrite your default ssh key. For illustration lets save it to ~/.ssh/id_rsa_alternate ssh-keygen -t rsa -C "your-email-address"   Now open up your company account on Github and navigate through the settings to manage your ssh keys.  Use the following command: cat ~/.ssh/id_rsa_alternate.pub   Copy and paste the output into a new key on your company Github account. Next we add the new key to our identity: ssh-add ~/.ssh/id_rsa_alternate Edit (or touch) your ssh config file at ~/.ssh/config and include a new option for authenticating using your company account: Host github-COMPANY HostName

Caching Laravel with Varnish

PHP Framework popularity as at 2013 - Sitepoint After having a very good experience with using Varnish to cache a Wordpress site we decided to look at caching Laravel. Laravel always generates cookies regardless of whether a person is logged in or not.  This interferes with Varnish which by default will pass all requests with a cookie to the backend and skip the cache. In our particular case our site supported the ability for users to login and would then present them with custom content.  This means that cookies are not restricted to a particular path so we can't discard cookies based on the request as we did for Wordpress when discarding everything except /wp-admin/* requests. My solution was to use a package called session-monster ( Packagist  ) which sets a response header if the data in the Laravel session can be ignored.  Varnish can detect this header and prevent the cookie from being set since we don't really need it.  This together with the varnish confi

Wordpress on Hiphop / Nginx / Varnish

I recently was asked to investigate speeding up one of the Wordpress sites of a fairly large government organization in Britain.  A large part of my investigation focused on the server stack because I felt that we could get more out of the hardware that was provisioned for us. I decided to set up a stack on my development machine to see how it would work and if it was feasible.  I settled on nginX with hiphop and a Varnish frontend cache.  I realize that nginX would be just fine as the cache and server but in this particular case it would not be possible to replace Apache with nginx on the live server.  I also wanted to experiment with ESI and it looked better documented in Varnish than nginx. Installing HHVM is very easy: wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | apt-key add - echo deb http://dl.hhvm.com/ubuntu saucy main | tee /etc/apt/sources.list.d/hhvm.list apt-get update apt-get install hhvm Installing nginx is also very easy: sudo apt-get up