Update your GitLab instance to 7.1+ (which requires Ruby 2.*) on a Debian 7 (Wheezy) server

So, you installed your GitLab instance as I described in my previous blog post but now you can't update to GitLab 7.1 because it officially requires "latest stable Ruby" which is not packaged for Debian Wheezy.
Warning: Using this method you will not be able to copy and paste the commands from the Upgrade docs anymore, but it's still preatty straightforward if you know basics of Linux systems.

First we need to update Ruby

Let's execute some (untrusted) script directly from web! What could go wrong?
I can't tell you how bad this is, but it looks like the whole Ruby community is rolling with it, so it can't be that bad, right? right?!. I suggest you download and check the script before you execute it...
root # cd /home/git root # su git git # \curl -sSL https://get.rvm.io -o rvm-installer git # cat rvm-installer git # bash < ./rvm-install git # source /home/git/.rvm/scripts/rvm git # rvm autolibs disable This installs the latest stable RVM version. Now we'll install the latest ruby version. git # rvm list known lists all the available ruby versions, look for the latest stable release (in our case that's ruby-2.1.2). Let's install it: git # rvm install 2.1.2 git # rvm use 2.1.2 Now you have to check if some Ruby requirements are not met with: git # rvm requirements If some are not met (there were none on my setup), install them with apt-get after getting out of git user: git # exit root # apt-get install ... root # su git Looks like Debian and RVM need a fix to play nicely together, namely add: [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" to the end off (/home/git/.bashrc), exit and su back and now everything should be ok. You can check with: git # ruby --version That's it, now off to actual GitLab stuff.

Make your current GitLab instance happy with new Ruby

We'll need to install the libs again for this ruby version (ofcourse beware of the postgres/mysql difference): root # service gitlab stop root # su git git # cd /home/git/gitlab git # bundle install --without development test postgres --deployment Now you can start GitLab and check the ruby version in /admin git # exit root # service gitlab start If everything went as planned, GitLab reports the installed Ruby version correctly. There's one unfortune consequence of using RVM as single user install. Namely sudo by default doesen't source .bashrc and therefore the standard commands in GitLab upgrade docs fail. One solution is to simply su to git user and just execute commands there (the ones previously executed with sudo).

Upgrade GitLab

Foolowing the docs at https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/6.9-to-7.0.md. root # su git git # cd /home/git/gitlab git # git stash git # git checkout 7-0-stable git # cd /home/git/gitlab-shell git # git fetch git # git checkout v1.9.6 git # cd /home/git/gitlab git # bundle install --without development test postgres --deployment git # bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production git # git diff origin/6-9-stable:config/gitlab.yml.example origin/7-0-stable:config/gitlab.yml.example git # exit root # cp /home/git/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab root # chmod +x /etc/init.d/gitlab root # service gitlab start root # service nginx restart For further upgrades I used the GitLab Upgrader. That I run manually when logged in as git user. root # su git git # cd /home/git/gitlab git # ruby bin/upgrade.rb

That's it!

So that's a quick and dirty writeup of what I did (at 3 in the morning :/) to get my Debian GitLab instance up to date.

A lot more in depth documentation is available:

Set up your own GitLab instance on a Debian 7 (Wheezy) server

After searching the web for a good (read: easy) way of installing GitLab on my Debian 7 (Wheezy) VPS I decided to go with the official instructions. But as usuall I had to make due with a bit of improvisation and therefore I'm writting down this modified quick'n'dirty version.

1. Dependencies

It's always good to update your machine prior doing anything major. root # apt-get update root # apt-get upgrade Note: I'm usually running my systems without sudo. This guide will presume you su-ed to root and are using sudo only to act as the git user. root # apt-get install sudo Now with the real dependencies: root # apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate Make sure you have installed Python version between 2.5 and 3.0 - by default wheezy comes with python 2.7 and that's good. Also it looks like python2 needs to be symlinked to python, which again by default should be a go. The check: user $ python --version user $ python2 --version We also need git 1.7.10 or higher, which again by default should be ok. To install: root # apt-get install git-core And to check the version: user $ git --version You will also need to have the mail sending installed and setup. This is way out of scope of this blog post. Next up is ruby. The official documentation suggest compiling it yourself, but there's no need, wheezy packs ruby (1.9.1 as of this writing) and again, this should be all ok. To install: root # apt-get install ruby ruby-dev To check: user $ ruby --version

System users

Add a user named "git" under which the whole sheebang will run: root # adduser --disabled-login --gecos 'GitLab' git root # sudo -u git -H git config --global user.name "GitLab" root # sudo -u git -H git config --global user.email "gitlab@localhost" root # sudo -u git -H git config --global core.autocrlf input

GitLab shell

As of this writing the latest gitlab shell is version 1.8.0 - check it and correct the branch part in the second command (-b v1.8.0): root # cd /home/git root # sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.8.0 root # cd gitlab-shell root # sudo -u git -H cp config.yml.example config.yml Now you'll need to edit the configuration. Bare minimum is editing of "github_url" which has to be a dedicated domain/subdomain and cannot be a subdirectory. After that we'll install the GitLab shell. root # sudo -u git -H editor config.yml root # sudo -u git -H ./bin/install

Database

GitLab supports MySQL and PostgreSQL databases. The setup is nicely documented GitLab databases documentation

GitLab

As with GitLab Shell you'll need to check the latest stable branch of GitLab in the source and replace the 6-4-stable part in the second commend: root # cd /home/git root # sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-4-stable gitlab root # cd gitlab That'll check out the latest code and now you'll need to configure it. Again, the bare minimum configuration is the domain/subdomain (host directive near the top). root # cd /home/git/gitlab root # sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml root # sudo -u git -H editor config/gitlab.yml Next there's a bunch of checking/setting stuff that should already be done, but newertheless: root # chown -R git log/ root # chown -R git tmp/ root # chmod -R u+rwX log/ root # chmod -R u+rwX tmp/ root # sudo -u git -H mkdir /home/git/gitlab-satellites root # sudo -u git -H mkdir tmp/pids/ root # sudo -u git -H mkdir tmp/sockets/ root # chmod -R u+rwX tmp/pids/ root # chmod -R u+rwX tmp/sockets/ root # sudo -u git -H mkdir public/uploads root # sudo chmod -R u+rwX public/uploads There, a lot of groundwork done. Now we need to copy the example unicorn configuration and edit it (I didn't edit anything if I'm not mistaken, but ymmv): root # sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb root # sudo -u git -H editor config/unicorn.rb Next up is the Rack attack config: root # sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb root # sudo -u git -H editor config/initializers/rack_attack.rb Next up on the configuration is the database config. Ofcourse you need to configure the correct access credidentials. For MySQL: root # sudo -u git cp config/database.yml.mysql config/database.yml For PostgreSQL: root # sudo -u git cp config/database.yml.postgresql config/database.yml And edit config and make it read to git only afterwards: root # sudo -u git -H editor config/database.yml root # sudo -u git -H chmod o-rwx config/database.yml Next up are the gems, I suggest you go make yourself a coffie while this runs: For MySQL: root # cd /home/git/gitlab root # sudo -u git -H bundle install --deployment --without development test postgres aws For PostgreSQL: root # cd /home/git/gitlab root # sudo -u git -H bundle install --deployment --without development test mysql aws After that's done, we need to initialize the database and activate advanced features (oh my!). You'll need to follow the on-screen instructions and mark down the login. root # cd /home/git/gitlab root # sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production There we're almost done. Now we need to compile the assets: root # sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production

Debian/Linux support stuff

Note: Most of the instructions that follow are for the straightforward installation as described above and need some tweaking if you have a special case. First we'll set the init script and set it so that GitLab will start on boot: root # ln -s /home/git/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab root # update-rc.d gitlab defaults 21 root # service gitlab start Next up is Logrotate: root # ln -s /home/git/gitlab/lib/support/logrotate/gitlab /etc/logrotate.d/gitlab Now you can check the application status (also handy later on): root # cd /home/git/gitlab root # sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production The final thing to do is to set up the nginx web server, we only skim this part, because there're a lot of good tutorial regarding this (you'll need to replace the hostname/subdomain to match what you used above). root # apt-get install nginx root # cp /home/git/gitlab/lib/support/nginx/gitlab /etc/nginx/sites-enabled/gitlab root # edit /etc/nginx/sites-enabled/gitlab root # service nginx reload

That's it!

Now you can open the domain/subdomain url and see for yourself. Special thanks to mmoll and newton on #gitlab@freenode irc for the help.

A lot more in depth documentation is available:

Set up your own Transifex server in virtualenv

So lately I was in need of some good web based translation software. I knew transifex is open source and therefore I went poking around their site - but not much open source info is up on their site.
I tried the -git version without success and therefore went with the stable 1.2.1 version[1].
First set up the enviroment and code: # virtualenv tx # cd tx/ # source bin/activate # wget https://github.com/downloads/transifex/transifex/transifex-1.2.1.tar.gz # tar xzvf transifex-1.2.1.tar.gz # mv indifex-* transifex/ Second install all the needed dependencies (with the help of modified/completed requirements.txt[2]): # wget http://txt.si/files/transifex-1.2.1/requirements.txt # pip install -r requirements.txt Third patch, set up and configure Transifex server:
Because of deprecated setting in transifex/settings/40-apps.conf you need to swap SCRATCH_DIR value with os.path.join(PROJECT_PATH, 'scratchdir') # cd transifex/ # ./manage.py txcreatedirs # ./manage.py syncdb # ./manage.py migrate # ./manage.py txlanguages # ./manage.py txcreatenoticetypes # ./manage.py collectstatic There it is. Now you can use the built in django's runserver to access your site or set it up the same way you do with any other django app.
Note: uploading with transifex-client is not working because of some permission problems (it _should_ be fixed, but it isn't) that I'm yet to track down.

[1] - https://github.com/transifex/transifex/downloads
[2] - http://txt.si/files/transifex-1.2.1/requirements.txt

Play League of Legends on 64bit Archlinux with xf86-video-ati

Getting League Of Legends working on a 64bit Archlinux installation with ati open source drivers (xf86-video-ati) is actually quite straightforward once you know what to install (presuming you already have multilib system) :).
First, you need to have your open source ati graphic drivers set up correctly. This is out of scope, but well documented on Archlinux Wiki[1].
Second, you need to install some 32bit libraries:
  • lib32-ati-dri - from Multilib
  • lib32-gnutls - from Multilib
  • playonlinux - from Community
  • lib32-libtxc_dxtn - from AUR[2]
You can check if everything works by installing lib32-mesa-demos from Multilib and running: # glxinfo32 | grep direct # glxinfo32 | grep GL_EXT_texture_compression_s3tc Third, open Play On Linux, find League of Legends in Install (note: check the Testing checkbox) and follow the on-screen instructions.

P.S: If Play On Linux says it can't find OpenGL libraries (after you installed lib32-ati-dri) and you had an old ATI graphics driver stack installation, check if /etc/profile.d/radeon.sh exsists and delete it.

Big thanks to lordheavy and pango on #playonlinux for all the help/assistance.

[1] - https://wiki.archlinux.org/index.php/ATI
[2] - http://aur.archlinux.org/packages.php?ID=40343

Rescue and update an old RTD1073 based media player

Quite some years ago I purchased a simple chinese Realtek RTD1073 based player. That's the same as the first generation Xtreamer, Asus O!Play and many others. The chipset was quite popular because it was cheap and offers quite a lot at least on paper. A vibrant community quickly formed around the chipset/players but it was unfortunately quite severly crippled by the GPL violations, lack of documentation and a big binary DvdPlayer application that is responsible for almost everything - from IR recieving to actual GUI display. I used it a bit but the interface was horrible and performance lacking. I shelved it and it was collecting dust for 2 years. But recently I decided to clean it up and update it, ensuing a lot of fun. The documentation about the devices is scattered far and beyond the internet. I tried to collect some of it in a wiki[1].
First I tried to update it to the latest image that the company I bought it from is providing. That didn't go that well as it seems that they changed the remote and mine was not working anymore. That's quite easy to fix - simply telnet to your device and force an upgrade with: # echo "http://my-home-server/install.img" > /tmp/installing_source # kill -6 1 This forces the system to reflash itself with the new install.img. When that was complete (beware - it can take up to 20min) I decided to update it to a latest PBO GUI2.0[2] that looks quite good.
This FW requires a new bootcode (the lower level parts of the system) which update was believed to be only doable over a serial connection. I found an excellent resource in moServices[3] where they provide an install.img that updates the bootcode to the latest known version 23[4] (use the file for R1/R3). Unfortunately that updates the whole system too with a (seemingly) stock Asus O!Play one that has hardware checks and refuses to work on non Asus O!Play hardware. This renders the device unusable with DvdPlayer restarting itself over and over again. The device also doesen't request an IP via DHCP and therefore seems stuck. But fortunately it does set an default IP 192.168.0.9. I connected the device directly to my computer, set the computer IP to 192.168.0.10, telneted to 192.168.0.9 and restored the system as shown before.
But this time I used another moServices goodie caled AMP r8[5] with pohd skin[2] (I replaced the install.img on the server with the downloaded one). That flashed the new FW - with removed hardware checks and a good looking GUI.
Almost done. I just had to get the remote working. Fortunately AMP r8 comes with irfake installed and a great tutorial on how to configure it[6]. And that's it, now my cheap chinese media player boots with Asus logo and A.C.Ryan branded interface - but hey, it works (albeit a bit shabby on some content - most notably 1080p problems and audio)! :D
Thanks to all the people that made this possible!

[1] - http://w.p2p.si
[2] - http://www.acryan.com/forums/viewtopic.php?f=152&t=10077
[3] - http://moservices.org/
[4] - http://moservices.org/forum/viewtopic.php?f=12&t=98
[5] - http://www.moservices.org/forum/viewtopic.php?f=12&t=1030&sid=6c51ece999c6acc57b922e4c13b305ca
[6] - http://www.moservices.org/forum/viewtopic.php?f=12&t=179
Next Page »