Archive for category Off-Topic

Gitlab full Postgresql backup and restore

GitLab and Posgresql

GitLab can be used with Postgresql as its database engine  (beside MySQL),  and all come ready to make backups and restores of its databases and git repositories by using a ruby script (rake). This is the recommended way because it lets you recover everything wit not pending transactiond on database and Git sides.

The problem

The documentation explains all you have to perform a manual backup and restore, but the latter fails because it tries to insert existing registers that generate conflicts like this one:

ALTER SEQUENCE
psql:/home/git/gitlab/tmp/backups/db/database.sql:812: ERROR: relation "users" already exists

The Solution

The postgresql backup must erase all tables before trying to recreate them and insert the registers. That can be done by including the  –clean r -c  to the pg_dump command. This option must be edited in the ruby script that makes the backup, which is  /home/git/gitlab/lib/backup/database.rb by default. In this file you have to find this part of code and substitute the following bold line:

require 'yaml'
module Backup
 class Database
 attr_reader :config, :db_dir
def initialize
 @config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env]
 @db_dir = File.join(Gitlab.config.backup.path, 'db')
 FileUtils.mkdir_p(@db_dir) unless Dir.exists?(@db_dir)
 end
def dump
 success = case config["adapter"]
 when /^mysql/ then
 print "Dumping MySQL database #{config['database']} ... "
 system('mysqldump', *mysql_args, config['database'], out: db_file_name)
 when "postgresql" then
 print "Dumping PostgreSQL database #{config['database']} ... "
 pg_env
 system('pg_dump', config['database'], out: db_file_name)
 end
 report_success(success)
 end

This line must be replaced with this other line:

system('pg_dump', config['database'], '-c', out: db_file_name)

Here you can see that option -c is passed as argument to command pg_dump. This will force to include all DROPS needed in the generated .sql  for the GitLab backup.

Update

In GitLab 7.4 this issue was fixed with https://gitlab.com/gitlab-org/gitlab-ce/commit/77b57c114be6b1fa02538c35066ccc363bfe68e6 [Thanks Sytse Sijbrandij]


,

2 Comments

Cupcakes Weekend

Cocosette cupcakes

Cupcake de Cocosette

Last weekend mi girlfriend and I decided to make our first cupcakes. Before somebody asks me wheter I cook, the answer is no. My participation was as a cook assistant and the person who googled the cupcake recipes.

We made two batches, the first ones were made using cocosettes as base (cocosette is a coconut savored cookie here in Venezuela) following the recipe sugguested by a friend of mime, Viviana Trujillo, blogger at bocaditosgourmet.com.ve. In particular, we follow the recipe 1  la receta 1 of her project 52 (52 cupcake recipes). We had to modify that recipe because instead of 12 we tried making 6 cupcakes, so We had to reduce que cuantities by half. The resulta is shown on the first picture. As you can see, the cupcake has a buttercream on the top made with cocosette as well, a little sweet for our taste but delicius.

Buttercream de cocosette

The cupcake itself was not so fluffy but we could eat it without difficulty and it real tasted like coconut and cocosette. verdad puede apreciarse.

Chocolate cupcakes

Cupcake de chocolate

The other stuff my girlfriend wanted to do were some chocolate cupcakes. I did a research on internet but no recipe convince us. So Lourdes decided to use the same recipe for the cocosette cupcake,  except the coconut based ingredients. We also used a little of baking soda as baking powder . As you can see, the cupcakes grew up so much, but dispaite this fact they also tasted delicius and were more fluffy than the cocosette cupcakes. we learned, as wel said by Viviana, we must not fill the tray more than 2/3.

We earned the experience and we want to make more cupcakes!

4 Comments

How to exclude files on cPanel’s backups

 

cPanel Backups

When the falling down of Megaupload, all files I had hosted there (by the way, all legal) I had to start serving them from my hosting. This brought me a additional problem, because my blog’s backups increased from 60 MB to 3 GB. Due to I automated the backups with cPanel, and due to I didn’t see any option to exclude files and folders, so I was ready to do all the backup work, I mean, to use the MySQL client to make the database backups, generate the compressed file by my own only with the important files, make a cron job, etc…but seeing the files on my home directory I came across a files named cpbackup-exclude.conf. Doing a little research, indeed this file allows to exclude files an folders when doing a full backup on cPanel. Just create the file in the user’s home directory and add the path to be excluded. But bear in mind its format is a litlle tricky, so let’s see how I edited it for my blog:

public_html/wp-content/uploads/*
backup-*
tmp/*

 

First line indicates not to make backups of files under public_html/wp-content/uploads, relative to my user account. Notice that it ends with * wildcard, otherwise it will be misinterpreted, even though you put a directory path. Second line states not to make backups of files beginning with “backup-“, this way backups of backups are avoided. Finally, last line says not to make a backup of temp files of my user account.

After doing all this, my backup decreased from 3 GB to50 20 MB of disk space…much better!!

2 Comments

ISEIT 2011 prom

Photos courtesy of Rómulo Rodríguez.

On September 24, 2011 I enjoyed sharing some time with former students (really a few time because a was lecturing another course), now good friends, at ISEIT’s 2011 prom. This time were Yureinmy , Javier and Rómulo, although Viviana and Ronald missed the occasion (among others). It’s a joy to see they have achieved their goals, and to have helped a little in the process!!

Congratulations and success!!

,

4 Comments

The Locha: Venezuelan coin of Bs. 12½ cents

12 1/2

Everytime I got a Bs. 12½ cents like the one shown in the above picture I wonder what was thinking Venezuelan government when emitting this coin. Do they want to recall the past by bringing back the Locha to our times? Do they want to relive the ol saying “..in the fighting for the locha” ? Let’s face it, nobody knows what to do with these coins. For example, I have got changes where this coin has been mixed up with coins of Bs. 0.10, Bs. 0.25 or even Bs. 0.50. Have you seen any price multiple of this value? Exactly…nothing is handle with this coin.

I think the best thing one can do is to wait until somebody gives you another one and use them as a Bs. 0.25 coin. What is the best thing the Venezuelan government can do? To assume its mistake and stop circulating them.

What do you think?

2 Comments

Five Englishs word overused in Spanish

English over Spanish

Anglicisms have existed in Spanish since ever and I have to admit some of them are useful and almost natural (for instance: tickets, DVD, etc.), but there’s something I don’t understand, the fact that even if there is a Spanish word people have to use another one borrow from English (or any other language). If you work in IT thing is even worse because people tends to overuse some terms. Here I leave you some examples and how they should be used in Spanish.

  1. Renderizar (to render) = reproducir, traducir, interpretar.
  2. Machear (to match) = emparejar, asociar.
  3. Rebootear (to reboot) = reiniciar.
  4. Backupear (to backup) = respaldar, copiar (copia de seguridad).
  5. Forwardear (to forward) = reenviar.

Have you heard any English word overused in Spanish?

4 Comments

Luis’ Blog turns 3 years-old

Happy-3rd-Birthday

That’s right, It’s has been 3 years since I started this hobby that allows me in one way or another to share my experiences (most of the tech-related). Many people would say  I’m an “idle” because I post regularly (yes, I must admit sometimes even three posts per week) but is a way to share what I learn in the moment, and even to leave it as future reference of something I did and later I forgot how I did it.

I hope there will be more years to come!!!

10 Comments

Lenovo IdeaPad S10-3 BIOS issue

Página de Lenovo - BIOS (3)

Due to some issues with the wireless interface related to the Atheros driver I tried to install the most recent BIOS for my Lenovo IdeaPad S10-3. Once I followed the steps, that basically is to run a program which backup the current BIOS and update it to 2ACN31WW version, my netbook didn’t  recognize such BIOS. I mean, it booted up but you couldn’t see video signal or load the boot manager.

After calling customer support they diagnosed that it was really a issue related to the BIOS update, they put me in contact with the local technical service. There I was informed that they would last about two weeks to fix the problem because my netbook is the latest model…

The solution

They called me back next day to notify me that my netbook was already fixed. I asked what they did and they said they had to replace the mother board, and my wireless issue was gone. Maybe it was reset when there wasn’t any energy from the battery or the AC cable.

Later by curiosity I checked out the BIOS version that comes after the fix and it was my surprise:

Lenovo S10-3 - BIOS

As you can see, it came with a lower version than the one provided by Lenovo. And there’s a Lenovo community forum where the same issue is commented after updating the BIOS. So, be careful when updating your BIOS!!

References

34 Comments

ISEIT 2010 graduation

Photos courtesy of Luis León.

On September 18, 2010 I enjoyed spending some time with former students, now good friends, at ISEIT’s 2010 graduation. People like Daniel , Francisco , Luis García, Robinson, Eduardo, Nelwin, Luis León, y many more (sorry if i forget someone). It’s a joy to see they have achieved their goals, and to have helped a little in the process!!

Congratulations and success!!

,

4 Comments

Learn English by siging a rap

I came across this video by Chiddy Bang, and I think it’s great, the rhythm, the video art, and the song. Because I know it’s hard to understand song with a fast rhythm such as rap, here you are the video and its lyric:

Read the rest of this entry »

4 Comments