NSIS Installer with puppet

Posted septiembre 12th, 2012 in Blog, Operations by guzman

A few days ago we had to deal with a customer using NSIS (Nullsoft Scriptable Install System) which as usual was “black magic” and no documentation at all of the installation, just the guide used to install it almost a year ago for an older distro. Thankfully “the guide” was pretty well documented (Check it out here. )

We just needed to translate that guide to puppet and then we are done, sounds simple. Of course it wasn’t, we had to throw a few hours dealing with missing lib32 and a few more missing packages as we wanted to install latest stable from sourceforge without having to change anything from nsis to do a correct install.

The result is a puppet module to install Nsis and osslsigncode. It was tested on latest linux Debian stable (squeeze) and it works like a charm.

Installing the module it’s pretty easy, just clone the repo or download and uncompress it in your puppet modules folder. It’s important that the destination folder inside modules it’s nsis and not puppet-nsis.

To install nsis in a node you just include the class passing root_folder as the main folder to install.

The class will leave inside that folder three files and three folders, each download and the corresponding uncompressed folder for NSIS Source, NSIS Zip and OslSigncode source.

It’s safe to remove both source (nsis & osslsigncode) you only need the zip folder (usually nsis-2.46) where there are two “bin” folder, one as “Bin” that cames with the package and one as “bin”, created by make nsis install. I know it looks wrong but it works without complain like that. Everything except “bin” it’s what it came by default from sourceforage.

Github page: https://github.com/guruHub/puppet-nsis


Allow local traffic to access NAT with arno-iptables-firewall

Posted agosto 14th, 2012 in Blog, Operations, Virtualization by guzman

Arno iptables firewall script which comes with Debian Squeeze it’s wonderful, very customizable and already has support for many different scenarios, even some complex one which usually only way is writting yourself the extra rules.

But… there’s always a but. If you use NAT, your machines in the internal network won’t be able to access your public NAT services, will get connection refused.

Problem is, to be able to use it, arno would need to masquerade your traffic with a public IP and send your traffic back to internal machine.

Below is a patch to latest squeeze arno version (1.9.2.k-4) which will do exactly that

Continue Reading »

Graphite Functions Summarize, Highest Average, etc

Posted junio 29th, 2012 in Blog by mateo
In this post we are going to review the main graphite functions that I use in my everyday work and some tricks that I found really useful. But first, we need to explain, what is Graphite ?
According to the  developers:
Graphite consists of a storage backend and a web-based visualization frontend. Client applications send streams of numeric time-series data to the Graphite backend (called carbon), where it gets stored in fixed-size database files similar in design to RRD. The web frontend provides 2 distinct user interfaces for visualizing this data in graphs as well as a simple URL-based API for direct graph generation.
Graphite’s design is focussed on providing simple interfaces (both to users and applications), real-time visualization, high-availability, and enterprise scalability.

Graphite Functions

Graphite Functions

The graphite functions that we are going to review are: Summarize, Highest Average, Alias by Node and Derivative, but you can find more deep information at the Official Documentation.

Continue Reading »

Build custom Nginx Deb Packages

Posted mayo 27th, 2012 in Blog, Operations by Martín Loy

Create a temporary folder

Download debian package source

Now you will have something similar to:

Download nginx source and extract it

Copy debian package folder to new source

Edit debian/changelog and debian/control as you wish, keep in mind they have some particular syntax/format

To add/disable modules edit debian/rules

To build the package afterwards

OVH Servers affected by known Citrix bug CTX127395

Posted abril 9th, 2012 in Blog, Virtualization by Alfredo

If you have some XenServer 5.6 host that randomly (and suddenly) becomes completely unresponsive with no apparent reason, then it might be affected by an odd bug that has been documented by Citrix.

Is my server affected?

Potentially, any server based on the Nehalem (Xeon 75xx, 55xx, 35xx, 34xx) and Westmere (Xeon 56xx, 36xx) architectures can be affected.

How to know if my XenServer 5.6 is affected?

  1. Open a console to your XenServer host (SSH client, the console tab in XenCenter, or the local console).
  2. Make sure that your server is running on any of the affected architectures. To find out, run:
  3. If it is,  with administrative privileges run:

If the value of total C-States is bigger than 2, then this server is affected by the bug and if necessary, they must be disabled from the BIOS.

How to fix?
Continue Reading »

How to install nginx 1.0 on Debian Squeeze

Posted abril 2nd, 2012 in Blog, Web Development by Gastón Acosta Ramas


here i will show you how i’ve installed NginX 1.0 on Debian Squeeze Server, drectly from Nginx repos.


first of all, add these lines to /etc/apt/sources.list

then add the PGP signature to apt.

now, you can install NginX 1.0 by doing apt-get install nginx.

good luck!

WebDevelopment using vagrant

Posted marzo 21st, 2012 in Blog, Web Development by Gastón Acosta Ramas

if you’re working on various web projects, and some of them are based in different technologies, and/or using different frameworks, it’s difficult to have one development environment, and keep it tidy, clean and working.

In my case, i’ve some projects under NginX others under Apache2, others in different architectures, and i’ve to test some projects in different SO.

well, here i’ll show you how i used vagrant as a solution for this problem.

vagrant uses VirtualBox headless to provide you, an easy to use/handle VM.


  1. download vagrant from here.
  2. add your boxes (base vms.) by default you can download ubuntu base box, but here, you have a list of Vagrant boxes you can add.
  3. usefull commands you should know.

in my case i have /home/gargrag/projects/, and inside one folder per project with a vagrant box .

editing Vagrantfile you could  forward ports to your phisical vm, add shared folders and setup many other things like chef provisioning.

for example you can forward 3306 to 3306, 80 to 8080 and whatever you need.


happy develop!.

How to setup MySQL master -> slave replication

Posted febrero 23rd, 2012 in Blog, DataBases by Gastón Acosta Ramas

Hi, again.
here i will show you how to setup a master/slave, statement based, MySQL replication.

first of all we’re going to configure the master server.
this is what i added to my my.cnf file.

let’s create a user for the replication:

now we need a snapshot, or a dump from the master to put it into the server.
here are two ways. you need to lock the database to get synced the binlog pos and the data in the dump.
If you’re using MyISAM you can do this way:

if you’re using InnoDB you can do smth like this:

now go to the slave server.
add this lines into my.cnf

now stop the slave.

import the dump.

get the master info from the dump.

with the output of this command you should run a mysql query.
this query is to tell mysql slave in which position and file it begin to replicate.
if you have ran “SHOW MASTER STATUS”, you will use this info to run the change master query.

All done. start the slave and verify it’s running

*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_User: slave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000020
Read_Master_Log_Pos: 1375140
Relay_Log_File: mysqld-relay-bin.000005
Relay_Log_Pos: 1375234
Relay_Master_Log_File: mysql-bin.000020
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: wordpress_rep
Last_Errno: 0
Skip_Counter: 0
Exec_Master_Log_Pos: 1375140
Relay_Log_Space: 1375234
Until_Condition: None
Until_Log_Pos: 0
Master_SSL_Allowed: No
Seconds_Behind_Master: 0
1 row in set (0.00 sec)

the three most important parameters for this output are :
Seconds_Behind_Master: 0
Slave_IO_Running: Yes
Slave_SQL_Running: Yes

things to be carefull…

  1. in this example we’ve setted up a statement based replication, so all actions in master must be replicated in the slave, i mean triggers and functions
  2. mysql has a bug, documented here
    http://bugs.mysql.com/bug.php?id=10830, because of this bug, if you don’t execute “use bbdd” before make a query, this query is not logged into binlog, so it’s not replicated to the slave. BE CAREFULL.

Good Replicating!.

Basic multi-wordpress with only one installation and many wp-content folders

Posted febrero 15th, 2012 in Blog, Operations by Gastón Acosta Ramas

Maybe you’re one of those looking for a easy and effective multiworpdress setup. If that’s the case, here i will explain one approach to solve this situation.

suppose we want three blogs, under wp1.com, wp2.com and wp3.com domains.
and we have a webserver with mysql, nginx and php installed.

and a directory tree like this.

database names will be the same as domain name.

now, we will use the same wordpress installation, three different wp-content folders, and three different databases.
the magic is to dinamically load the correct database, and wp-config setting based on some parameter, in our case the HTTP_POST index at $_SERVER global.

now we go to our wp-config.php and do the magic.
first dinamically detect which domain is.

// if you have www.smth.com you can get domain
// using substr function.
$domain = substr($_SERVER['HTTP_HOST'],0,3);

second setup constants according to the domain.

define(‘DB_NAME’, $domain);
define(‘DB_USER’, ‘wp_global_user’);
define(‘DB_PASSWORD’, ‘*****’);
define(‘DB_HOST’, ‘localhost’);
define(‘DB_CHARSET’, ‘utf8′);
define(‘DB_COLLATE’, ”);

//and wp-content settings

//the trick here is thath te wp-content url and plugin url must be accesible
//straight via apache
define( ‘WP_CONTENT_DIR’, “/var/www/wp/wp-content/{$domain}” );
define( ‘WP_CONTENT_URL’, “/wp-content/{$domain}” );
define( ‘WP_PLUGIN_DIR’, “/var/www/wp/wp-content/{$domain}/plugins” );
define( ‘WP_PLUGIN_URL’, “/wp-content/{$domain}/plugins” );

// if you want more control
// you can add this lines
define( ‘WP_HOME’, “http://{$domain}” );
define( ‘WP_SITEURL’, “http://{$domain}” );


more documentation here

and that’s all folks.

How to install Scrapy on debian using virtualenv

Posted febrero 15th, 2012 in Blog, Data and Metrics by admin

Scrapy allthough it’s in python is the best swiss army knife tool arround for scraping, forget about nokogiri :) or nasty perl regexp crawlers.. scrapy is serious bussines.

In this guide i will show you how to setup python virtualenvs and install the last version of scrapy into one. If you are not really familiar with virtualenvs i suggest you read http://pypi.python.org/pypi/virtualenv.

Before starting you need to install

Once all packages are installed, lets setup our first virtualenv

Now lets install scrapy from the nightly build version (if you want to install a stable version, just checkout a branch instead)

If you follow every steps and the all mighty gods of linux grant you their grace, hopefully everything should work and you can test it by just running:

Some helpfull links you may find cool:
* http://www.stereoplex.com/blog/understanding-imports-and-pythonpath | Everything you should know about python paths
* http://doc.scrapy.org/en/0.12/topics/architecture.html | Scrapy architecture overview