Servers for Hackers author Chris Fidao on securing servers and deploying to them
Interviewed by Christophe Limpalair on 03/27/2015
Like me, I'm sure you're always trying to better your development workflow. I bet you're also interested in constantly learning more and you aren't always satisfied with just "I don't care to know how it works as long as it works fine."
That's why I asked Chris Fidao to be on the show and to walk us through his development environment stack. The biggest takeaway I got from this interview is the power in automation. As you'll see, Chris only had to properly configure a server once, and then he wrote small scripts to follow the same steps every single time. Now when he deploys a new server, he just runs the scripts and he's ready to push code live.
He wrote a book called Servers for Hackers, which covers what I just mentioned and a lot more. That way if you have any questions or want to get more in-depth answers, you can check it out and get your answers. Buying the book through that link will also help keep these interviews free by supporting the site. Enjoy!
Better development workflow
Are you still using a tool like WAMP or XAMPP for your PHP applications? I was until a few months ago. Now, I can't go back.
I heard about something called Vagrant and it completely changed my workflow.
Vagrant lowers development environment setup time, makes sure your entire team of developers has the exact same setup, and makes it possible to mimic your live server(s). It can be very easy to setup, especially if you use something like PuPHPet or Protobox.
As you will see in the interview, Chris has a set of scripts in place to automate his server deployments. This saves a lot of time when deploying new servers.
One tool he mentions a few times is Ansible.
Ansible helps keep your server in the state you expect it to be. Use cases include:
- Application Deployment
- Configuration Management
- Cloud & Amazon (AWS, EC2) Automation
- Continuous Delivery
Chris shows us some of his configuration files. They look really easy to setup and they will save you quite a bit of time while making everything more predictable and avoiding unpleasant surprises.
Pushing Code Live
As Chris explains in the interview, this part depends on your site.
If it's a smaller and static site, you can use something like secure copy (scp) and RSYNC.
For larger sites, you could use git with a webhook to deploy by having something listening for a change on your live server. It can then pull it in the server from git.
You could also use Envoy, Fabric, or Capistrano to name a few.
Nginx and PHP-FPM and how they communicate
I ask Chris to explain how Nginx processes requests and communicates with PHP-FPM.
He explains the difference between TCP and Unix Sockets, and when to use one over the other.
I also ask why Nginx usually has better performance than Apache, and to explain the architecture behind it.
Monitoring is an extremely important part of managing servers. Chris had a problem with one of his servers and managed to catch it before it crashed the server thanks to monitoring.
I wrote a blog post about it here.
Here are a few tools you can check out:
How did this interview help you?
If you learned anything from this interview, please thank our guest for their time.
Oh, and help your followers learn by clicking the Tweet button below :)