Setting up dnsmasq on MacOS with Homebrew

So earlier I posted about my decision to Dockerize my entire development environment. In that post I mentioned that you can either manually edit your /etc/hosts file or install a dns server to point domains to your local web server.

Disclaimer: this nothing to do with Docker, this steps are can be used even if you are running your own instance of web server directly on your machine.

dnsmasq is a simple DNS server that does a lot but it is not as complicated and full featured as stuff like BIND. In this article I will be using dnsmasq to spoof all the DNS requests to “.test” domain to my own local machine. Having my web server running (nginx) and listening for domains set on the virtualhost configurations I will then be able to serve my apps locally.

Continue reading “Setting up dnsmasq on MacOS with Homebrew”

LaraDock: Dockerizing my PHP Development Environment

As a PHP Developer I’ve always had instances of webserver, php & database server running as first level services on my Development machines. I can claim that configuring LAMP (recently LEMP) stack was always one of the first things I’d do when I get a new machine.

I’ve been using Docker for running other services such as Redis, Mongo, Elasticsearch, Neo4J and … but today I am going to completely configure my development environment on top of containers on my new Mac.

Thanks to LaraDock this process should be much easier and smooth. For those of you who don’t know about LaraDock, it’s a set of containers with configurations templates that can come handy to any PHP developers.

Although the project is targeting Laravel developers, but any PHP developer can benefit from these tools.

Why the change?

Running a traditional LAMP/LEMP stack setup has no issues, but occasionally there are some glitches time to time that I’m hoping to avoid by fully going Dockerized.

  • I realised sometimes OS updates (Specially Major Updates) can mess up with services installed on the machine. This is simply inevitable and has happened to me multiple times so far. So this way I only need to make sure my Docker service is running.
  • I realised that I hesitate more on updating my services fearing that they may break. I believe going with Docker should make the process of upgrading those services easier.
  • Things sometimes break! I remember when homebrew simply changed where formulas for PHP were, they added it to the core formulas and I had a hard time updating from PHP 7.0 to 7.2.

I’ll however install php itself on the machine for times that I want to run php scripts within the console or work with the PHP Built-in Webserver.

LaraDock comes with many containers, but I am more interested in a LAMP stack of containers, so we will be starting nginx, mariadb, php-fpm and make sure they will be always up by modifying the restart-policy variable.

Continue reading “LaraDock: Dockerizing my PHP Development Environment”

do you find it hard to breath when listening to music with earphones?

I was in the lift the other day when I noticed it for the first time, I had my earbuds on and listening to music on the way back home.

The lift was taking longer than usual, it lift was stopping on every single floor and new people who were back from work coming in, soon there was not much room left in the lift. While most of them were looking at their phones and going out one by one, I felt it hard to breath, as if I was unconsciously holding my breath.

Being breathless was enough to make me anxious and then again that was making me harder to breath. I felt like I am making so much noise as I breath. Like when you struggle to breath in & out with a blocked nose.

Continue reading “do you find it hard to breath when listening to music with earphones?”

run quick ad-hoc tasks using Ansible

Ansible with no doubt is one of the most popular tools that its name always comes up in every discussion about DevOps Automation. Its no joke that Ansible does its best when it’s used against an inventory of infrastructure containing nodes with designated roles and tasks.

at my work I often find myself in need to provision and configure single nodes, machines that are not a part of any architecture & their only reason to exist is to serve a single purpose.

Ansible has a list of hundreds of useful modules that can always come in handy in these provisioning tasks, but I find it rather difficult to create an inventory or a playbook just for a single use of a module on my target server. What works here is to use Ansible for ad-hock tasks by using the command line options.

All the information that I’m posting here are in Ansibles documentation as well as the help menu, but I was not able to find a cheatsheet or a single page that gives tips on how to use Ansible against single IP nodes.

Continue reading “run quick ad-hoc tasks using Ansible”

a more Production friendly ELK stack with Docker

recently I spend a big chunk of my time in office doing DevOps related tasks. Elasticsearch is one of the technologies that we use a lot for both production and development.

ever since I had to deal with elasticsearch instances in the office I decided to move them to docker containers, that would make my life easier as we have multiple clusters running.

there are many ELK stack docker images out there, but I found elk-docker be the closest to what I’m looking for. The image documentation is pretty good to get you started but I decided to create a docker-compose file that makes more sense for a fast more production ready box.

Continue reading “a more Production friendly ELK stack with Docker”