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

Enjoy…

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 »

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

How to install mongoPress on Debian 6

Posted abril 9th, 2012 in Operations, Web Development by Gastón Acosta Ramas

Here i will explain you how i’ve installed MongoPress into a debian squeeze box:

First of all we need a basic webserver, in this case i’ve installed apache but it works with nginx too.

it’s important to install php5-gd package, because it’s a MongoPress requisite.

Now install MongoDB.

add mongodb repo for debian.

install via apt-get

Now we need php5 driver for MongoDB.

run following commands only if you don’t have pecl installed yet.

install php5-mongo via pecl

now we have to enable the extension in php.ini
by adding this line in php.ini

We have the server ready to receive MongoPress!!
configure an apache VirtualHost, with rewrite allowed. and in the document root for this VHost run:

now open the browser and follow mongopress installation process.

I recommend you to use RockMongo wich is similar to PHPMyAdmin but for MongoDB.

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
//remember: NO TRAILING SLASH

//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
http://codex.wordpress.org/Editing_wp-config.php

and that’s all folks.