Categories
.NET Continous Integration Docker MS SQL Server Programming Project Management

Automate Testing: Gitlab, Dotnet

I always want to test my .NET based application on my personal Gitlab based repo. But since, my old project is too much a mess to do the effort for. So, when we got to rewrite the whole project, I was happy to get my experience on Unit Testing with automation of CI. I still don’t do much of CD as my development environment is still limited to development only.

So, I read about it and using Gitlab’s YML configuration, I was able to run the xUnit based Unit Test easily. It was simple too, call a MS/dotnet docker as base image, then dotnet build and later dotnet test .

But the problem arise when I have to connect to database and then I cannot get SQLCMD command to work, though I get the MS SQL Server based service to started, but until that command runs which is not present in ms dotnet docker, I cannot reload my database easily. For that I have to write code to bootstrap and create database. So, I try to search for it, and after lot of fail attempt and surprisingly no example of how to use database with YML configuration other than basic example for Mysql or Microsoft’s own docker file example. I found no info on this.

So, I decide to create a new docker image, I want to do it my way. So, I use a Ubuntu Docker image, install dotnet 2.2 on that image with mssql-cmd tools. I didn’t install MS SQL Server as I can use that as service. So using this docker image, I get my Unit testing working. This help me automate my project workflow and help me get best out of me, without need to worry about hidden errors.

My this docker image is available for anyone need it at Docker hub:

https://hub.docker.com/r/archergod/dotnetcoredb

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
Management MySQL Project Management Server Configuration

Installing Redmine 2.3.3 on Ubuntu 13

Okay, today I install Redmine on Azure hosted Ubuntu 13.04. The steps are easy once I get it done after 2 days of working and finding what is right to do. So, let us start on installation, but a little history first.

I see that Bitnami has put quite a few Redmine VM Images on VM depot. But unfortunately all are on older version of Ubuntu. But I still thought I can upgrade them for my use, so I use the latest [Ubuntu 12] based image and try to do ‘do-release-upgrade’ it download lot of things, but in end it fail to update the machine. So, I now opt to use core Linux machine to install what I need. So, I create a VM using Ubuntu 13.04. It was easy as usual. Once the machine is up. I once run do-release-upgrade to install all latest package and there are quite a lot of them. It took around 20-30 minute for my Very small instance of VM to install them.

Once the machine is ready, now we need to install: Apache, MySQL [so I can host not just redmine but couple of my other website as well]. And to extract the latest source of Redmine we also need SVN [package name ‘subversion’] on server as well. I usually use svn version only, but you can download zip/tarball as well.

So install is as follow:

# sudo apt-get install subversion
# sudo apt-get install apache2 libapache2-mod-passenger
# sudo apt-get install mysql-server mysql-client
# sudo apt-get install ruby ruby-dev
# sudo apt-get install imagemagick libmagickwand-dev ruby-rmagick

Above statements will install subversion, apache, MySQL, ruby and ruby-dev, imagemagick and ruby-rmagick .. they all are prerequesties and you might already gave those. Once this is done..

Download Redmine 2.3.3 from svn using this Redmine Download link http://www.redmine.org/projects/redmine/wiki/Download

#svn co http://svn.redmine.org/redmine/branches/2.5-stable redmine-2.5

Now, we need GEM Bundler to be installed. so

 # sudo gem install bundler

Now navigate to Redmine folder, oh you can download redmine in any folder, as long as you are ready to use your <redmine folder>/public as your document root. if not you can use symbolic link of public folder as well in apache. Just thought to tell this now. In next step we will create a Gemfile.local to tell the installer to use rack’ version 1.4.5 as by default it install version 1.5.2 and it doesn’t work for me and I see lot of people had problem with it, so just create a Gemfile.local with one line in it and use your bundler install to do it.

# cd redmine-2.3 
# sudo cat > Gemfile.local << "EOF"
gem "rack", "~> 1.4.5"
EOF
# sudo bundle install --without development test mysql
# rake generate_secret_token

Once you did that it install redmine or rather just built it. We now need a database to store redmine data, so create MySQL database, username and password as you want. Obviously you don’t want to use root username. Once you create that user and database. then go to redmine/config folder, you will find database.yml.example file, copy it as database.yml go to production section of MySQL db, enter your login info and change database type t0 mysql2 [it is just new library of MySQL with ruby, you can still use [mysql] but it might give error so better change it.

production:
  adapter: mysql2
  database: redmine_default
  host: localhost
  username: redmine
  password: some-secure-plain-text-password
  encoding: utf8

Now run following commant to Create Database Table, clear unwanted data and session

rake db:migrate RAILS_ENV=production 
rake tmp:cache:clear
rake tmp:sessions:clear

Now, second last step: Creating a virtual Host or defining the DocumentRoot so our apache can use redmine installation. Add following Virtual Host Tag, you can add other information as you like, but keep this as minimum you need. Please change “[” and “]” with “<” and “>” as my editor doesn’t allow me to use them below…

[Virtualhost *:80]
DocumentRoot /usr/local/share/redmine-2.3.0/public
[Directory /usr/local/share/redmine-2.3.0/public]
AllowOverride all
Options -MultiViews
[/Directory]
[/VirtualHost]

Restart Apache

# sudo service apache2 restart

Now, go to your domain, IP address base url whaterver it is, and login using “admin” as username and password. You are most probably ready to rock. If not you should enable error login using /config/environment/production.rb file and then check what error you might get from Redmine.

Categories
Management Project Management

Quality assurance

Hi,

One of my friend told me that they have a QA department in their company. I ask him what is QA ? and get this old word in new look “Quanlity Assurance”. At that time I neglect that word and doesn’t bother about it, as i don’t know what it is and why we need it.

Today, I have been asked that why I haven’t check the coding pattern of developers working under me. Hmm , as a project manager and handling 15 projects at one go is it possible for me to check those things ? my answer  was NO. Not sure  if my  boss  like  my answer or not (and ofcourse he doesn’t).

But now  is the  time for us to think on Quality Management. Can  a project manager  get enough time to think even to check the coding?

It is partical problem in Small Software companies, they spend money, but on programmers only. But to make an application click we need more than just programmers. We need to re-read our SDLC Books, and should realize that we need a complete hierarchy to complete a project.

Even a Good programmer cannot do miracles. Software programming is Team work, Senior programmer/team leader/project manager all are good if their complete team is and is commited to do good.

Categories
Project Management

Resource Management

I have been working as Software Developer from last 2 yrs. During this time I come across lot of good and bad things about project management. To my experince with project management most of project we got in trouble are due to bad coding level or bad planning of project. These are two things that trouble me a lot in these two years.

This also teach me to make balance between different level of programmer working on same project. One thing that i notice is that good level programmers fight with problem like how to make code efficient where as low skill programmer keep themself busy with questions like How to make query, how to make Text box to do this and that, or user interface has some bugs how to fix them.

Though recently i come across one another major problem with project management, proper resource allocation, with resources i mean hardware and software and not man power, One of my project got delay just because of late supply of hardware, now as a programmer thats the worsts thing I want in my project to get delay because we don’t have proper hardware or software for that matter. One can teach Junior programmer programming skill but management budget handling is not in our hand as Programmer.

Anyways life is now on road as my Three week long quest ends when I Configure EXIM and now its delivering mail to my virtual mail box 🙂

So rest about management when I learn to manage myself and my projects (this counter always remain above 5 )

Sumit Gupta