Categories
Continous Integration MySQL PHP Programming Project Management

Experience with BitBucket CI

I have been using bitbucket for quite sometime, and really like their service. Recently, I come to know that they have Beta of CI through pipeline, that can run any docker from Docker hub. I thought to give it a try though I have my own build setup on my local machine and really don’t need it. But why not test something new.

So, my project is regular website, which is coded in Custom PHP (no framework) and using MySQL database. I wrote some Unit Test using PHPUnit test, so all I need is to run those test when I commit to Bitbucket. It seems pretty straight forward as Bitbucket configuration example shows the configuration file for PHPUnit test. I pick it up, change path and run. My test failed, as they never get the MySQL extension for PHP. What? PHPunit test docker doesn’t have database extension installed? So, how we are suppose to test it?

Well, there are few ways, one is you use multiple docker (multi-docker environment) which I recently studied is available and I didn’t yet test it. And other is you create your own docker and use it. Install whatever you need to make it happen. Also, I realize that installing MySQL will not make any good unless I install database on it before test and change it’s certain values for testing. So, I create a new docker that has everything I need for my project, all PHP extension and database server. (You can use it from https://hub.docker.com/r/archergod/phpall/). Then I update configuration file to do following:

  1. Run MySQL service (yes by default docker do not initiate run.d etc, not sure why) and hence no service auto start.
  2. Then run `mysql` to import a Script (SQL) file to create and install database, and users needed. I put everything in that one SQL file and run it as root MySQL user. It is only a docker doing testing.
  3. then Navigate to Directory in respect to my Git folder as my default bitbucket leave your prompt at git folder.
  4. Run your test.

It does a great work, though every time you push to git, it create a CI request and download docker image, set it up based on BitBucket’s script and then run your script. So it take 2 minute extra to set the machine. If you are in habbit to push every 2 hr of work, then you end up running your test every 2 hr on every push.

But basically it is all good and is free too, which I like most. Though I have GitLab at my local machine and it works exceptionally great, but BitBucket’s CI is good and different. And in some cases is better than Gitlab’s CI.

Categories
Joyous MySQL Operating System

MySql 5.5 : funny about it

Just saw the release note of MySql 5.5. Looks exciting upgrade, but what looks most funny about the software is the fact that they claim to improve performance by 1500% on windows [some 372% on linux]. Looks great work by them. But I found this information funny, as my some Open source lover friends always claim that because of windows bad structure mysql perform bad on Windows machine as compare to linux. But now my argument to them is if it is bad structure of windows, then how they achieve 1500% improvement by improving their code and not windows ? Often people forgot when comparing software that run on multi platform that the optimization of core software can only be for either OS [if they share same code], and that cause performance issues.

But whatever it is, I am happy to see MySql perform better on windows as I am bound to use windows with kind of resources I can afford for my development and maintainability I can handle.

Good work Team !!!

Categories
MySQL Server Configuration

MySQL : Crash and Upgrade

Today, I face a new problem with MySQL. I got the database to crash quite a few times since morning. Event logs shows that there is a fault in mysqld.exe, but that error was not very clear on specific reason of fault. After searching for articles and forums, I got a hint that in past [about 3-4 yrs], one guy has same random crash problem and he found that crash was related to some store procedure. This give me a clue and I found that in my case it is a corrupted database file. I need to investigate as why that database got corrupted as it is the latest database created in system and was working fine just another day.

Anyways, this lead me to upgrade database server after 6-7 months. It was pretty easy though, just download the new version and run the setup. everything was done automatically. Isn’t it that very simple.

Categories
Database MySQL

MySQL WorkBench : New GUI

I was looking at MySQL.com and found a new GUI, which came as replacement of old MYSQL administrative GUI. My impression was not good to learn that they have something new, as I thought it might be just that they get their old interface opensourced or something. But when I install this application, hmm .. it looks really good, a decently good managed user interface. Meet all modern application GUI stuff, still keep it professional. Though I download a Beta version but so far so good, it does all basic work I need to perform in manner I am habitual. Looks like I can relay on this interface in future.

Categories
Server Configuration SQL

MySQL “Server has gone away” error

A useful like to know the reason of “Server has gone away” error of MySQL.

http://blog.taragana.com/index.php/archive/mysql-tip-mysql-server-has-gone-away-or-lost-connection-to-server-during-query-fix/

It has very good information on why it happens, so you can check and correct the error.

Categories
Links Programming SQL

Comparing Date Range (Date Interaction checking through SQL)

As title says, I was looking to compare User give date range with date range saved in mysql Database. I search internet and found a great  small function that solve this problem for me, though they create a function for some programming language but I use same function in mysql (as per mysql syntax) and its all done

select * from  TableName where
(‘2008-04-16’ = start_date) or
if((‘2008-04-16’ > start_date),(‘2008-04-16′<=end_date),(start_date<=’2008-08-20’))

here 2008-04-16 is user enter date, and 2008-08-20 is user end end date for date range I collect from web form, and start_date and end_date is field in my table that define date range.

you can read about function here http://ryanfarley.com/blog/archive/2004/08/19/966.aspx