GitlabHQ – SQLite to mySQL

As our GitlabHQ setup at SRMvision is mean to stay, we wanted to migrate from the standard SQLite database to an easier to manage for us : mySQL.
The steps are quite straighforward, first, setup mySQL :

create database gitlab; 
grant all privileges on gitlab.* to "gitlab" identified by "gitlab"; 
flush privileges;

Then prepare to dump the data out of GitlabHQ, stop your webserver, then, from your GitlabHQ folder :

bundle exec rake db:data:dump RAILS_ENV=production

this will create a db/data.yml file. All you have to do now is reconfigure GitlabHQ to connect to mySQL and reimport the data. The database configuration takes place in the config/database.yml file, backup your existing file and rename the database.yml.example :

mv config/database.yml config/database.yml.old
cp config/database.yml.example config/database.yml

Then edit the file to reflect your new configuration, only the production section is relevant in our case :

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: gitlabhq_development
  pool: 5
  username: root
  password: "secure password"
  # socket: /tmp/mysql.sock

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: gitlabhq_test
  pool: 5
  username: root
  password: "secure password"
  # socket: /tmp/mysql.sock

production:
  adapter: mysql2
  encoding: utf8
  reconnect: true # allows to autoreconnect if the mysql service restarts
  database: gitlab # to replace with your database name
  pool: 5
  username: gitlab # to replace with your credentials
  password: "gitlab" # to replace with your credentials
  socket: /var/run/mysqld/mysqld.sock # mysql socket location on debian

Once this is done, you have to create the schema and restore your data :

bundle exec rake db:setup RAILS_ENV=production
bundle exec rake db:data:load RAILS_ENV=production

Job’s done, you just need to restart the GitlabHQ server now (nginx, apache…). If you encounter a problem and this does not work as expected, you just have to restore the database.yml.old file to go back to SQLite.

GitLabHQ and a good branching model

Migrating to Git


At work, we made the move from subversion to git as our version control tool. I used git for a few times before we migrate the whole project thanks to the git-svn bridge, and, apart from the usual headache when it comes to merging branches, I was rather convinced we would make the migration to git. To explain what branching model I was expecting to use, I dig the Internet for a good tool, hoping to migrate our so “1.0″ Trac version control and issue management to a more github like one.

Founds

There is not as much tools as I first thought, I found gitorious, which seems to be a good tool, but it looks complicated to setup and lacks (or I didn’t find it) a good graphical representation of the branches in the repository.

I came across gitlabhq, which is a starting project, but promising as it aims to mimic github in many ways. I’ve tried it and I must say I am very impressed, it is now one of the tool we use internally, it is not yet a perfect tool but it does its jobs very well. We still use our old Trac environment with git integration to hunt down our bugs and control ticket workflow with commit messages (blog post to come). We also use Trac’s wiki to write our internal documentation toward developpers.
Continue reading