Category: MySQL

How to test and auto deploy your laravel code from Gitlab

Few days ago, I was playing with the new Laravel 5.4 and Gitlab CI, and got to the point where I wanted the CI to test my code once I push it.

Using google lead me to this post on Laracasts, and it was the starting point for me, there you can get important files .gitlab-ci.yml and .gitlab-ci.sh  , basically the first one will define the stages for the testing and the second one will build the environment for your test.

So lets look at a short version of .gitlab-ci.yml

Continue reading

Filed under: Business, Code, docker, Laravel, Linux, MySQL, PHP

Docker compose wait don’t run it now

One of the main problem you will face when you work with Docker is that you are not 100% sure that the service on the ImageX is ready for you to use it or even for ImageY to communicate with it.

For example, lets say that you have the ImageX which run MySQL/MariaDB (or any other DB), and ImageY which run PHP, no matter how you try you cant be sure that ImageX is ready to accept connections from ImageY and CRUD some data from it, so Docker docs stated that you should find some solution for that, and they do provide some simple instruction for it on Controlling startup order in Compose.

Continue reading

Filed under: docker, Linux, MySQL, 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

What I have learned about Docker in the past few days

In the past few days, I was only reading about Docker, trying to understand it more and more, see how can I use it and how can I implement it in my workflow, and yet still need a lot to learn.

In my learning journey I depends on reading articles (a lot of articles), checking Docker documentation, watching online courses or even youtube videos, and trust me not all of them is worth the time I spend because either they are old or does not cover the situation am trying to achieve in my head. And am not saying they are bad, but everyone knows that Docker release cycle is fast, and with each new version they introduce a big breaking features which will not work with the older versions, so if you dont follow up fast you will lose the track and thats also apply to any article you read, if its talking about version 1.11 mean while you are working with 1.12, you may get lucky and you find the solution for the issue you are facing.

Now enough with this long talk, which is debatable by the way, lets focus about what I have learned in the past few days and how I got what I want fast.

Basically I wanted to have a small API + Database images, based on Docker like this

Continue reading

Filed under: docker, Linux, MySQL, nodejs, Other

Configure your MySQL/Mariadb server to accept local connections

So lets say that you have created a Database server, and you wanted to accept only connections from other servers using the internal/private IP, to be honest I found that the easy way is to do that via iptables, am not going to talk about how to save your iptables as I will assume that you know how to do so, if you dont search using google.com

Lets assume that your private ip is 10.2.10.2 and your public ip is 192.168.2.10 so now you will have to execute the following commands :

Continue reading

Filed under: Linux, MySQL