Category: Code

Why to use Vagrant or Docker for development?

Few years ago, I was introduced to Vagrant and for me it was the most elegant tools I ever used, at the end it ended up the most annoying argument I ever hear all the time ” It works on my computer “, at that my team at the company used to use MAMP (yes they all use MAC so we are all have the same OS but different versions), and when I did introduced Vagrant they really liked the idea, especially that it was so easy to have your environment up and running in just few hours (based on your internet connection and what tools you will have to download).

Now things got more better, so I created a Vagrant file which we all used and share, it was based on Vaprobash and everything went so simple after that, we never heard that annoying phrase anymore, we all now have the same environment (despite the fact that I always update & upgrade my installed image, and I cant guarantee that everyone else does that), and the benefit was way more than what we though, now if we are working for a Node.js project, you can just grab a Vagrant file or image for it, if we are working on PHP the choices are open and we have no limit.

Continue reading

Filed under: Code, docker, Other, PHP

PHPStorm Settings Repository

I have been using PHPStorm for about 3y or more (I think I got my license at the end of 2012), and to be honest I never though about syncing my setting, I try hard not to format and reinstall apps, as much as I can I try to avoid this option ..

any way on Saturday I was working on windows, and though about syncing my setting with PHPStorm on mac (and it was a bad Idea btw), but the thing is that I found out that I can easily create a git repo and just push my settings to it, and then whenever I need I can just pull it and use it.

you can read more about the plugin which come bundled with PHPStorm here.

And if you want my advice, never use the same setting on different OS’s unless you are sure the settings will be the same (on Windows Docker setting is not the same as in Mac), I dont think it will also sync the themes (need to more about that), but its good to know that you can have an auto backup for your settings incase you wanted to restore it later.

Filed under: Code, PHP

The myth about Docker depends_on and links

I have been reading lately (again) a lot of articles which try to explain to the developers how to use Docker for development, now they are all good (in general), each try to make simple and easy for you to move and use docker, and everyone advice you to use depends_on and links (but remember links is a legacy compose item so with Docker 1.13 you should use depends_on ).

both some how works the same, except that depends_on will give you the ability to define the order which your images should start.

Continue reading

Filed under: Code, docker, Linux, MySQL, Nginx, PHP

How to remotely debug your nodejs app using PHPStorm

There are many ways to do that, but the simplest one is to do a small tunnel to your vagrant so you can connect to it as if you are connecting to local host.

so am going to use a script I found in gist ( and yes am lazy to write it every time), so all you have to do is download it and use it as the replacement to your vagrant ssh command .

Thanks to the author.

Continue reading

Filed under: Code

Run node apps on port 80 without Root permissions

Most of us run the node apps under the root user, so last time I talked about using IPTables to do some tricks which will route the requests from port 80 to port 8080.

Today I was able to do so without IPTables , and you can run this command with SUDO to give node the ability to use the port 80 :

I used it on Ubuntu 16.04 and it worked like a charm.

PS: I noticed that the command was not clear so I need to put it in an image

screen-shot-2016-11-09-at-10-58-39-am

Filed under: Code, Linux