Use container labels in docker logging tags

Today I’ve created a docker swarm cluster and I wanted to send all docker logs to the AWS Cloudwatch Logs service.
Since I’m going to deploy the docker containers as stacks with services, I wanted to be able to have a cloudwatch stream
namd like this: stack/service/container/id.

Unfortunately looking at the docker documentation the tags available aren’t enough to have the service and stack name.

Symfony benchmark using HHVM

Yesterday Asm89 blogged about a custom version of symfony edited to run on Facebook’s HHVM. I’ve followed his great blog post (you can read it here) in how to setup HHVM to run the Symfony standard web application.

After that I’ve tested the performances compared to a nginx + php-fpm configuration and I wanted to share the results here.

BDD development in Symfony using real browsers

Unit testing is nice, behaviour testing is awesome!

Said that, everyone should run at least some unit tests, even if your application is simple. If you want to go a step further you can run behaviour tests, that means create features, stories, not...

Clearing APC cache using command line

Using Symfony’s APC autoloader you can improve performance by caching the location of each class. During a deploy, however, you may need to clear APC cache to be sure that if you move a class, things still works.

Scaling Symfony 2 with AWS OpsWorks

During the last complete rebuild of Goalshouter we needed to redesign our infrastructure to handle the big traffic we were expecting.

Our biggest difference between an everyday site is that 80% of the traffic is concentrated in some hours of sunday because most of the soccer matches are at that time.
We needed a solution that was being able to scale fast to a large number of servers.

According to New Relic on sunday afternoon the requests per second increases by 20x in a couple of minutes. Our match processing tool is a bit resource intensive and we need enough power to let teams track their matches and people follow them.

Mysql on ramdisk via osx homebrew

Having mysql running on a ramdisk can be a much faster way to unit test a database intensive application.

Supposing you’ve installed mysql or percosa server via homebrew (cause the paths it uses) you can directly run this script to create a virtual...

Capistrano: use a custom user instead of root with sudo

It’s a while that we use Capifony (capistrano addon for symfony 2 deployment) for our work projects.

This week we’ve switched to new servers so I decided to not use a custom user for nginx/php-fpm and stick to the default www-data. However, the deploy...

Symfony 2: Force incomplete users to complete registration

Last week I’ve completed social login into our work project using HWIOAuthBundle and I figured out that the twitter oauth wasn’t providing the user email address.

Since we use the email address a lot, also because without you can’t recover password...

Symfony 2.1, PHPUnit and Doctrine fixtures using SQLite

Everyone should make tests for their applications, testing is the best way to develop new feature without breaking older ones.

For this purpose we’re going to use Doctrine Fixtures’s bundle and Liip function test bundle which loads fixtures on runtime during tests. These two bundles plus a SQLite db makes tests easy because you don’t need a running MySQL server instance.

Jenkins and Symfony 2.1

At work we’ve start ed Test-driven development and I was going to use Jenkins for continuous integration and testing.

To add a job for correctly running tests within Jenkins i had to fork the xurumelous’ jenkins settings repository and change some code to get it working with the new Symfony 2.1 which uses composer to get the libraries.

Varnish and MaxCdn not caching, how to solve it

At work we’ve started using MaxCDN service because they’re offering 1TB of data transfer for free (nice offer tbh) for serving images. The problem was that after one week of usage there was no cache hit, all requests was still going straight to our servers.