How to update Gitlab 5.0 in place

Last modified: [last-modified]

It’s been a few days since I deployed Gitlab following an earlier article I posted. Now I want to check for updates and apply them. It’s actually pretty straight forward.

This article assumes you followed my earlier one in how to setup Gitlab 5.0 on CentOS 6. It also only performs updates within the 5.0 branch of Gitlab. It will not get you to say 5.1 when that gets released.

  1. Stop Gitlab
    # As ROOT
    [[email protected]~] service gitlab stop
  2. Switch to the Gitlab user and update Gitlab and Gitlab-shell
    [[email protected]~] su - sa_gitlab
    [[email protected]~] cd ~/gitlab
    [[email protected]~] git pull
    [[email protected]~] bundle install
    
    [[email protected]~] cd ~/gitlab-shell
    [[email protected]~] git pull
  3. Switch back to root and restart Gitlab
    # As ROOT
    [[email protected]~] service gitlab start

Google Maps not letting you sign-in on your Blackberry?

Last modified: [last-modified]

Update(s)

2013-04-04 – People are starting to report Google authentication is working again!

2014-01-07 – Fixed Dropbox link, mirror should have still been working. People are reporting this issue is happening again. I’ve moved on to a Q10 so I won’t be much help this time.

 

Original Post

Today I was trying to build myself a custom map in Google Maps and then load it up on my Blackberry 9810 running Google Maps 4.5.3. When I tried to sign-in to Google Maps I was instantly signed out.

Some quick research online shows this is a known issue that Google has acknowledged on March 11th, 2013 but not fixed yet.

There is a work around I found online that few users have had success with (I was not one of them):

  1. Uninstall Google Maps 4.5.3
  2. Reboot your device
  3. Download Google Maps 3.0.1 (https://dl.dropboxusercontent.com/u/22772464/GoogleMap-v3.zip) (Mirror: GoogleMap-v3)
  4. Extract it and copy it over to your Blackberry
  5. Run GoogleMap-v3.jad and install it
  6. Launch Google Maps and accept the license agreement. If all you want is Latitude you might want to stop here until Google fixes 4.5.3 because the next step may or may not work.
  7. Go to m.google.com and download Google Maps 4.5.3
  8. Restart your device if prompted. If not don’t worry about it.
  9. Launch Google Maps and see if you can stay signed in. Some people reported success with this method. I did not.

 

Since I wanted access to custom maps I’ve created and not Latitude this is what worked for me:

  1. Launch Google Maps 4.5.3
  2. Go to ‘Layers’
  3. Go to ‘More Layers
  4. Go to ‘My Maps’
  5. Sign-in
  6. The instant the ‘Signing In’ box dissappears repeat steps 3-5 quickly and tap your custom map

If you’re fast enough your custom map will load into Google Maps and remain cached. It took me a couple tries but I eventually got it.

 

References

 

How to install Gitlab 5.0 on CentOS 6 or RHEL6

Last modified: [last-modified]

I’ve been eagerly waiting for Gitlab 5.0 to be released so that Gitolite dependency would go away. Well a few days ago I got my wish. I followed the documentation provided by the Gitlab guys at https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md  and as expected it didn’t quite match up with what needs to be done to deploy on CentOS 6. It is after all written for Ubuntu. These instructions should also work for Redhat Enterprise 6 and are meant for a fresh installation. Not an upgrade.

Using the official document as a guide I managed to get things deployed on my system and now I’m going to share it with you.

I installed Gitlab 5.0 on CentOS 6.4 64-bit and used MySQL as my database back end and configured my existing Apache deployment to proxy connections to Gitlab. I also installed it under a custom user account and not the default ‘git’ account that the Gitlab documentation tells you to use.

I’m going to assume you already have a CentOS server up and running, SELinux is disabled, you aren’t using a firewall (iptables), the default CentOS Python 2.6 packages installed and Sendmail or Postfix up and running.

If you are running a Minimal Install of CentOS 6 see Olav’s comment below.

Unfortunately the version of Ruby that comes with CentOS 6 is to old for Gitlab so we need to compile that from source. The method I use will install the latest version of Ruby. If you have the CentOS Ruby packages installed it shouldn’t matter. These instructions should allow you to run both versions.

  1. Install the development tools necessary to compile applications from source
    [[email protected] ~] yum -y groupinstall "Development Tools"
    [[email protected] ~] yum install perl-ExtUtils-MakeMaker postgresql-devel

     

  2. Install missing dependencies  I believe this is all of them. If anything is missing drop me a comment and I’ll update this guide.
    [[email protected] ~] yum install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib zlib-devel openssl-devel libyaml-devel readline readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick libicu libicu-devel libffi-devel make bzip2 autoconf automake libtool bison iconv-devel redis

     

  3. Start redis and enable it on boot
    [[email protected]~] service redis start
    [[email protected]~] chkconfig --levels 35 redis on

     

  4. Create a new user account that we’ll run Gitlab under. I’m going to use ‘sa_gitlab’. Gitlab will be deployed in it’s home directory. On my server I want that to be in ‘/data/apps’ instead of ‘/home’
    [[email protected]~] adduser sa_gitlab --home-dir=/data/apps/sa_gitlab
    
    # If you want users to be able to use public/private key pairs you need to set a password for the sa_gitlab account. Make sure you use a strong password. This is neccessary to allow SSH access with public/private keys.
    [[email protected]~] passwd sa_gitlab

     

  5. Become the ‘sa_gitlab’ user and setup the ‘authorized_keys’ list and generate Gitlabs private key
    [[email protected]~] su - sa_gitlab
    
    [[email protected]~] mkdir -p /data/apps/sa_gitlab/.ssh
    [[email protected]~] chmod -R 700 /data/apps/sa_gitlab/.ssh
    [[email protected]~] echo "" > /data/apps/sa_gitlab/.ssh/authorized_keys
    [[email protected]~] chmod -R 600 /data/apps/sa_gitlab/.ssh/authorized_keys
    
    # This generates a 2048 bit key pair see below if you're paranoid :)
    [[email protected]~] ssh-keygen -q -N '' -t rsa -f /data/apps/sa_gitlab/.ssh/id_rsa
    # This generates a 4096 bit key pair
    [[email protected]~] ssh-keygen -q -b 4096 -N '' -t rsa -f /data/apps/sa_gitlab/.ssh/id_rsa
    
    [[email protected]~] cat /data/apps/sa_gitlab/.ssh/id_rsa.pub >> /data/apps/sa_gitlab/.ssh/authorized_keys

     

  6. Create a ‘temp’ dir for us to work with and a ‘ruby’ dir for Ruby to be installed into. Then download, configured and install Ruby 1.9.3
    [[email protected]~] mkdir temp
    [[email protected]~] mkdir ruby
    [[email protected]~] cd temp
    [[email protected]~] wget -c "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz"
    [[email protected]~] tar -xf ruby-1.9.3-p392.tar.gz
    [[email protected]~] cd ruby-1.9.3-p392
    [[email protected]~] ./configure --prefix=/data/apps/sa_gitlab/ruby
    [[email protected]~] make
    [[email protected]~] make install

     

  7. Download, compile and install the latest version of git
    [[email protected]~] cd ~/temp
    [[email protected]~] wget -c https://git-core.googlecode.com/files/git-1.8.2.3.tar.gz
    [[email protected]~] tar -xf git-1.8.2.3.tar.gz
    [[email protected]~] cd git-1.8.2.3
    [[email protected]~] ./configure --prefix=/data/apps/sa_gitlab/git
    [[email protected]~] make
    [[email protected]~] make install

     

  8. Add the new installation of Ruby to the ‘sa_gitlab’ users PATH so you can use our complied version of Ruby. Also my CentOS came with an old version of bundle installed by default which is to old. We’ll create an alias in the sa_gitlab users bash profile to reference our compiled version of ‘bundle’
    [[email protected]~] vim ~/.bash_profile
    
    # -------- Make the following edits --------
    
    # Change the PATH line to look like this:
    PATH=$HOME/git/bin:$HOME/ruby/bin:$PATH:$HOME/bin;
    
    # -------- Save and close the file --------
    
    [[email protected]~] vim ~/.bashrc
    
    # -------- Make the following edits --------
    
    # Add this to the bottom. I know it's redundant but it solves a problem when gitlab calls /usr/bin/env
    PATH=$HOME/git/bin:$HOME/ruby/bin:$PATH:$HOME/bin;
    
    # -------- Save and close the file --------
    
    # Re-export your PATH
    [[email protected]~] PATH=$HOME/git/bin:$HOME/ruby/bin:$PATH:$HOME/bin;
    
    # Verify your using the right version of Ruby now
    [[email protected]~] which ruby
    ~/ruby/bin/ruby
    
    [[email protected]~] ruby --version
    ruby 1.9.3p392 (2013-02-22) [x86_64-linux]
    
    [[email protected]~] which git
    ~/git/bin/git
    
    [[email protected] ~] git --version
    git version 1.8.2.3

     

  9. Install bundler
    [[email protected]~] gem install bundler

     

  10. Download gitlab-shell
    [[email protected]~] cd ~/
    [[email protected]~] mkdir gitlab-shell
    [[email protected]~] git clone https://github.com/gitlabhq/gitlab-shell.git gitlab-shell/

     

  11. Configure gitlab-shell and install it
    [[email protected]~] cd gitlab-shell/
    [[email protected]~] cp config.yml.example config.yml
    [[email protected]~] vim config.yml
    
    # -------- Make the following edits --------
    	user: sa_gitlab
    	gitlab_url: "http://git.yourdomain.com/"
    	repos_path: "/data/apps/sa_gitlab/repositories"
    	auth_file: "/data/apps/sa_gitlab/.ssh/authorized_keys"
    # -------- Save and close the file --------
    
    [[email protected]~] ./bin/install

     

  12. Create yourself a MySQL database on your server and a dedicated user account with full access to it.
  13. Download Gitlab 5.0
    [[email protected]~] cd ~/
    [[email protected]~] mkdir gitlab
    [[email protected]~] git clone https://github.com/gitlabhq/gitlabhq.git gitlab
    [[email protected]~] cd gitlab
    [[email protected]~] git checkout 5-0-stable

     

  14. Edit the Gitlab configuration file
    [[email protected]~] cp config/gitlab.yml.example config/gitlab.yml
    [[email protected]~] vim config/gitlab.yml
    
    # -------- Make the following edits --------
    	host: git.yourdomain.com
    	port: 80
    	https: false
    	user: sa_gitlab
    	email_from: [email protected]
    	support_email: [email protected]
    
    	satellites:
          # Relative paths are relative to Rails.root (default: tmp/repo_satellites/)
          path: /data/apps/sa_gitlab/gitlab-satellites/
    
        gitlab_shell:
          # REPOS_PATH MUST NOT BE A SYMLINK!!!
          repos_path: /data/apps/sa_gitlab/repositories/
          hooks_path: /data/apps/sa_gitlab/gitlab-shell/hooks/
    
        git:
          bin_path: /data/apps/sa_gitlab/git/bin/git
    
    # -------- Save and close the file --------

     

  15. Fix up some permissions
    [[email protected]~] chown -R sa_gitlab log/
    [[email protected]~] chown -R sa_gitlab tmp/
    [[email protected]~] chmod -R u+rwX  log/
    [[email protected]~] chmod -R u+rwX  tmp/

     

  16. Create the satellites directory and configure the database
    [[email protected]~] mkdir /data/apps/sa_gitlab/gitlab-satellites/
    [[email protected]~] mkdir tmp/pids/
    [[email protected]~] chmod -R u+rwX  tmp/pids/
    [[email protected]~] cp config/unicorn.rb.example config/unicorn.rb
    [[email protected]~] vim config/unicorn.rb
    
    # -------- Make the following edits --------
    # You can change the port that Gitlab will run on to anything. If you don't want to proxy connections to Gitlab via Apache and don't have a web-server running you can set this to 80 or 443. I also commented out the gitlab.socket line because I think it overrides listening on a port
        #listen "#{app_dir}/tmp/sockets/gitlab.socket"
        listen "127.0.0.1:65527"  # listen to port 8080 on the loopback interface
    # -------- Save and close the file --------
    
    [[email protected]~] cp config/database.yml.mysql config/database.yml
    
    # -------- Make the following edits --------
    vim config/database.yml
    	database: [DATABASE NAME]
    	username: [DATABASE USER]
    	password: "[DATABASE USER PASSWORD]"
    	host: localhost
    # -------- Save and close the file --------

     

  17. Install charlocks_holmes
    [[email protected]~] cd ~/gitlab
    [[email protected]~] gem install charlock_holmes --version '0.6.9'

     

  18. Setup the database structure, setup Gitlab and populate the database with default data. Yes one of the commands below says ‘postgres’ instead of ‘mysql’. Note the ‘–without’ in front of it
    [[email protected]~] /data/apps/sa_gitlab/ruby/bin/bundle install --deployment --without development test postgres
    [[email protected]~] /data/apps/sa_gitlab/ruby/bin/bundle exec rake gitlab:setup RAILS_ENV=production
    [[email protected]~] /data/apps/sa_gitlab/ruby/bin/bundle exec rake db:seed_fu RAILS_ENV=production

     

  19. Setup the Gitlab Init script. THis file requires a little bit of tweaking because I chose not to use the ‘git’ user. We also have to tell the script where to find our new version of bundle otherwise it will try to use the old version that comes with CentOS. The following is done as root
    [[email protected]~] curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-0-stable/init.d/gitlab
    [[email protected]~] chmod +x /etc/init.d/gitlab
    [[email protected]~] vim /etc/init.d/gitlab
    
    # -------- Make the following edits --------
    # The lines with a + are lines you need to add to the script
    
        APP_ROOT="/data/apps/sa_gitlab/gitlab"
    +   APP_USER="sa_gitlab"
    # Search and replace "sudo -u git -H bash" with "sudo -u $APP_USER -H bash
    
    # -------- Save and close the file --------
    
    [[email protected]~] /etc/init.d/gitlab start
    [[email protected]~] /etc/init.d/gitlab status
    Gitlab service / Unicorn with PID 19988 is running.
    Gitlab service / Sidekiq with PID 20031 is running.
    
    [[email protected]~] chkconfig --add gitlab
    [[email protected]~] chkconfig --levels 35 gitlab on

     

  20. Switch back to the Gitlab user and check if anything has gone wrong
    [[email protected]~] su - sa_gitlab
    [[email protected]~] cd gitlab
    
    [[email protected]~] git config --global user.name  "GitLab"
    [[email protected]~] git config --global user.email "[email protected]"
    
    [[email protected]~] bundle exec rake gitlab:env:info RAILS_ENV=production
    # Check for errors
    
    [[email protected]~] bundle exec rake gitlab:check RAILS_ENV=production
    # Check for errors

     

  21. Finally if everything above worked out for you then Gitlab should be waiting for you at http://git.yourdomain.com:<PORT> where <PORT> is what we set back in step 14. If you’re happy with this then you’re done. Login with the default username and password ([email protected] / 5iveL!fe) for Gitlab and start using it. If you’re already running a web server and couldn’t run Gitlab on standard web ports add the following to your Apache config to proxy connections from Apache to Gitlab
    [[email protected]~] vim /etc/httpd/conf/httpd.conf
    
    # -------- Make the following edits --------
    
    	<VirtualHost *:80>
    			ServerName git.yourdomain.com
    			DocumentRoot /data/apps/sa_gitlab/gitlab/public
    			CustomLog logs/git.yourdomain.com combined
    			ErrorLog logs/git.yourdomain.com-error.log
    
    			ProxyPass /  http://127.0.0.1:65527/
    			ProxyPassReverse /  http://127.0.0.1:65527/
    			ProxyPreserveHost On
    	</VirtualHost>
    
    # -------- Save and close the file --------
    
    [[email protected]~] service httpd graceful

 

Once you’ve confirmed everything is working for you follow these instructions to run the whole thing over SSL. I’m going to assume you already have SSL certificates and mod_rewrite installed in Apache.

  1. Change the git-shell configuration to use https:// as the sa_gitlab user
    [[email protected]~] vim ~/gitlab-shell/config.yml
    
    # -------- Make the following edits --------
    
    # Add a 's' to the URL
    gitlab_url: "https://git.yourdomain.com/"
    
    # -------- Save and close the file --------
    
    [[email protected]~] vim ~/gitlab/config/gitlab.yml
    
    # -------- Make the following edits --------
    
        port: 443
        https: true
    
    # -------- Save and close the file --------


  2. Alter your Apache config with these virtual hosts
    [[email protected]~] vim /etc/httpd/conf/httpd.conf
    
    # -------- Make the following edits --------
    
    <VirtualHost *:80>
            ServerName git.yourdomain.com
            DocumentRoot /data/apps/sa_gitlab/gitlab/public
            CustomLog logs/git.yourdomain.com.log combined
            ErrorLog logs/git.yourdomain.com-error.log
    
            ProxyPass /  http://127.0.0.1:65527/
            ProxyPassReverse /  http://127.0.0.1:65527/
            ProxyPreserveHost On
    
            RewriteEngine On
            RewriteCond %{SERVER_PORT} 80
            RewriteRule ^(.*)$ https://git.yourdomain.com$1 [R,L]
    </VirtualHost>
    
    <VirtualHost *:443>
            ServerName git.yourdomain.com
            DocumentRoot /data/apps/sa_gitlab/gitlab/public
            CustomLog logs/git.yourdomain.com.log combined
            ErrorLog logs/git.yourdomain.com-error.log
    
            ProxyPass /  http://127.0.0.1:65527/
            ProxyPassReverse /  http://127.0.0.1:65527/
            ProxyPreserveHost On
    
            SSLEngine on
            SSLProtocol all -SSLv2
            SSLCipherSuite ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH
            SSLCertificateFile /etc/httpd/conf/certs/yourdomain.com.crt
            SSLCertificateKeyFile /etc/httpd/conf/certs/yourdomain.com.key
            SSLCertificateChainFile /etc/httpd/conf/certs/ca-bundle.pem
    </VirtualHost>
    
    # -------- Save and close the file --------
    
    [[email protected]~] service gitlab restart
    [[email protected]~] service httpd restart

     

That’s it! I hope I haven’t missed anything but if I have drop me a comment and I’ll update this post.

Update March 31st, 2013 – I’ve written an article on how to update Gitlab once you’ve gotten it installed. You can find it here.

Update April 23rd, 2013 – Gitlab 5.1 is out! If you’ve followed the above instructions you should have a functioning Gitlab 5.0 instance. To upgrade to Gitlab 5.1 head over to this article: How to upgrade Gitlab 5.0 to 5.1 on CentOS 6 or RHEL6

Update April 26th, 2013 – Fixed an error in step 16. I said to run ‘cd ~/’ and it should be ‘cd ~/gitlab’. Thank you Ronald for pointing that out.

Update April 28th, 2013 – There was an error with my curl command to grab the gitlab init script. I was getting it from the master branch instead of the 5.0 branch. In the latest master Gitlab has changed their init script in a way that it will not work with 5.0 deployments because they moved from unicorn to puma. I updated the URL so it grabs the 5.0 init script.

Update May 21st, 2013 – Added steps for downloading, compiling and installing the latest version of git for use with Gitlab. Resolves a bug I came across when using my original deployment instructions and the default version of git that comes with CentOS 6.

Update May 22nd, 2013 – Added step to modify gitlab/config/gitlab.yml to use the new version of git. I had assumed Gitlab got the location of the git binary from the PATH environmental variable.

 

References

 

Excel 2013 locking up when cut/copy and pasting?

It’s tax time and I was using Excel today to start tracking my expenses for the year. Every time I went to copy/paste or cut/paste data in Excel it would lockup and say “Not responding” for 30 seconds.

In my case I had an old network printer mapped that didn’t exist anymore. Once I removed that old printer the problem went away. It wasn’t even my default printer.

Chances are this problem isn’t limited to Excel or even the 2013 release of Microsoft Office.

Miss your Start Button in Windows 8?

It’s no secret a lot of people don’t really like the new Modern UI in Windows 8. I’ve had a few clients ask me to install Windows 7 on their new laptops that came with Windows 8. Instead I found Start8 which should get the job done, keep them on the latest and “greatest” Microsoft Operating System and save everyone some time and money.

Start8 has a 30 day trial and if the user likes it they can purchase it for $5. Much cheaper than paying a tech to wipe and re-install their laptop. Plus it’s easy enough they can do it themselves. I’ve even written up some step-by-step instructions.

Pass it on: How to install Start8