Notes
In the last 24 months
The last time I wrote something here was in 2012. What happened since then?
It’s been quite a ride actually. I lived in 3 different cities on two continents and had some realizations on the way I want to work and the importance it had on my life.
If you (still) follow me on twitter, you might have seen some changes. I’m tweeting more and more in French and less and less about technologies. It didn’t went unnoticed to @clochix and he asked me what I was doing and if there was a chance that I could wrote about that somewhere.
In the last 24 months, I left Paris and lived in Montreal, Berlin and now Amsterdam. I met a whole bunch of people, made new friends along the way and basically hadn’t too much to worry about because as I often say to people I meet “when you’re a developer, you can basically work from anywhere”. The freedom you get by doing that has its obvious drawbacks, but the upsides are really fun.
In the last 24 months, my views on work changed as well. As I was reading on autonomy and independence, I realized that being an employee was unsatisfying to me. It has its good sides but it was mostly frustrating in the end. I decided to become a freelancer. Who doesn’t need some php/symfony2/golang expertise in this world right now? Of course, there’s more to that: I wanted to
create something from my hands and my brain. This is something incredibly hard to do when you’re in an office for 5 days a week and that you also happen to enjoy your evenings and your weekends. Freelancing gives me the possibility to balance my workload between my clients and my projects. With freelancing, I can confront my classic gen-x/gen-y developer bullshit to the real world. And I can’t really tell you how good it is. In times where offices are transformed into playgrounds and that your company is paying for your breakfasts and your friday booze, trying to accomplish something by yourself can be seen as mad. Why would you refuse all these privileges? I don’t really know, but I just had to the feeling that I should do it.
In the last 24 months, I must admit I lost interest in the IT industry. I could state a lot of reasons for that but it would raise endless debates because none of us would be right or wrong. The fact is that I can get bored quickly when things look and act the same. This industry has bored me. I’ll get more involved again when the monoculture is less strong.
I tried to build (alone) different products but somehow always failed developing them past a certain point. This is something utterly frustrating.
Luckily during the Symfony Live 2013 in Berlin, I had the chance to have a few conversations with Dustin Whittle, Fabien
Potencier and Francois Zaninotto who gave me really good advices: “Don’t create a business alone”, “It’s harder than you think, but rewarding”, “Think of the future of your product and how it will evolve”, and “expose your projects to like-minded people”.
Now the funny thing in life is that if you give room for surprises to happen, they might actually do. At the beginning of the year, a conversation with my good friend Flore led to something like that (jokes, usual stupidity and facebook stickers removed for clarity).
- Her: “I think I want to start a record label, but it’s tough”
- Me: “I never told you that but I have this idea in my mind since quite a while now.”
- Her: “Well it would be fun to do that together. We should think about that maybe…”
- Me: “Yeah, let’s think about it”
A few weeks later, it was on. We were creating a record label. This is a new adventure and even if I’m clearly out of my comfort zone, I enjoy it more and more. Music is my passion
and I’m glad I can see tech not as an end, but as a mean. I often asked myself who would create a time-consuming small business in the worst industry to do business at this time? The only answer I got is “Maybe the same guy who doesn’t like his office to look like a playground.”
Why I Stopped self-hosting my mails, IM and website
A year ago, I started an experiment. I wanted to quit gmail and gtalk services and prove me that I could host my emails and my IM myself. It went quite well but I decided to stop and subscribed to fastmail.fm and to hosted.im.
Installation
A year ago, I spent some days installing a fully functionnal mail/web/jabber server. Hopefully, I had some good tutorials about setting up a mail server. On the jabber side, it was quite easy even if sometime, my WTF-o-meter level was really high. I blame my totally absent knowledge of erlang and mnesia here.
The easiest part was to set-up varnish and nginx on the server. This is because I use these technologies every day. I still think that serving static files with a reverse proxy could be much more easier and quicker to setup.
Backuping is easy and cheap, thanks to Amazon S3. I did not suffer any crash and did not have to restore my data. I think I would have cried if I had to do that because of the time needed to set-up the server again. The pain would have been bearable thanks to the EBS (if it doesn’t fail).
My final set-up used these technologies: Amazon EC2, Amazon S3, Amazon CloudFront, Amazon Elastic Block Storage, Postfix, Dovecot, Sieve, Varnish, Postgrey, Spamassassin, Nginx and Ejabberd.
Running it
Here is what I learned:
- SMTP servers obey Murphy’s Law. If you have an important mail to send, it will fail. Fallbacking to gmail happened too many time.
- ejabberd is stable. In a year of operation, it failed once and restarting it made did the trick. The guys behind ejabberd did a really great job.
- Spam was virtually absent from my mail. Spamassasin and postgrey worked well.
- Sieve is great. I mean really really GREAT. Filtering mail in gmail is a pain.
- Mail clients all suck. Sparrow was an exception.
- I’m not nerdy enough to use Mutt.
- I should have used a configuration management system like Chef, Puppet or
CFEngine to create the server. It would have doubled/tripled the time
required to configure it properly, but it would have been an asset if I
wanted to migrate my services to another host, which I considered at some
point.
Now
Yesterday, and after too many problem with my SMTP server, I decided to end this experiment and started looking for a reliable mail provider. I chose fastmail.fm because of the price, migrations processes and the Sieve support.
This website is now hosted by Amazon S3. The only cron job that I had is now run on heroku. My jabber service is being migrated to hosted.im.
This will costs me around 50$ a year and this is definitely worth the time I won’t put in managing a server.
Creating, installing and configuring software is easy. Achieving reliability is hard.
Authenticated Cross-Domains AJAX Requests with CORS
Yesterday, I lost a significant amount of time dealing with cross-domain AJAX requests and I thought I might share a bit of what I learned.
- jQuery 1.5.0 is BROKEN when it comes to cross-domain AJAX requests. Upgrade to at least jQuery 1.5.1.
- Access-Control-Allow-Origin WON’T accept a wildcard value if your XHR’s withCredentials option is set to true. Also, it won’t accept a list of origin. If you want to accept requests from a lot of domains, you can match the Origin request header against a set of domains and set the Access-Control-Allow-Origin accordingly.
- Access-Control-Allow-Headers and Access-Control-Allow-Methods CORS header does not support * as a value. You have to be specific, even during your prototyping phase.
Hope it helps.
Serving a maintenance page with varnish
Yesterday during the SOPA Blackout, this website was on strike. The billions of readers of this blog had a static page explaining why this website was offline instead of the normal content. As a good nerd, I turned this operation into a technological one and instead of serving a static html with nginx, I decided to use varnish. Yes, varnish. I never wrote
anything about the absolutely amazing architecture of this blog but basically, static files are generated from RestructuredText, served by nginx and cached by varnish. Let’s get back to the point. I wanted varnish to serve a static page with a 503 status code (for SEO purpose). It took a bit of VCL knowledge and here is how to do
it:
/etc/varnish/maintenance.vcl backend default { .host = “127.0.0.1”; .port = “8080”; }sub vcl_recv { error 503; }sub vcl_error { set obj.http.Content-Type = “text/html; charset=utf-8”; # you can put absolutely what you want synthetic {“ <html> <head> </head> <body> <h1>This website is under maintenance.</h1> </body> </html> “}; return (deliver); }
The trick here is the synthetic keyword which is described in the varnish documentation like this:
The synthetic keyword is used to produce a synthetic response body in `vcl_error`. It takes a single string as argument.
Now that you have a cool VCL for your maintenance page, you can load this vcl in varnish like this:
varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret "vcl.load maintenance /etc/varnish/maintenance.vcl
and to replace the original rules by those described in maintenance.vcl
varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret "vcl.use maintenance"
And varnish will serve the maintenance page. Like a boss.
Back from SfDay 2011 Cologne
I’m now back to my daily work at SensioLabs after some days spent at Cologne, mostly for the Symfony Day 2011. It was truly great to be there. I had the chance to put faces on twitter nicknames and to talk in front of the crowd. I was a bit nervous and wasn’t as relaxed as I would liked to be. I will try to work on my english pronunciation for the next times.
Many thanks to the SensioLabs Deutschland & Interlution team, it was really a nice moment.
Oh, and here are the slides of my talk.