




















































































































































































































































































































































<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chebyte's Blog</title>
	<atom:link href="http://www.chebyte.com.ar/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chebyte.com.ar</link>
	<description>Programador freelance</description>
	<lastBuildDate>Thu, 24 Jun 2010 20:42:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TO-CSV con ActiveRecord</title>
		<link>http://www.chebyte.com.ar/2010/06/24/to-csv-con-activerecord/</link>
		<comments>http://www.chebyte.com.ar/2010/06/24/to-csv-con-activerecord/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 20:42:14 +0000</pubDate>
		<dc:creator>mauro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chebyte.com.ar/?p=197</guid>
		<description><![CDATA[Ultimament estuve jugando con la gema to-csv, la cual funciona muy bien, pero me encontre con la necesidad de agregar a mi csv de mi objeto csv alguna relacion del modelo, hice un fork de la gema http://github.com/chebyte/to-csv con los siguientes cambios:
has_many relationships:

# User.all.to_csv(:include => :applications)
belong_to relationship:

# User.all.to_csv(:include =>  rganization)
o combinar los dos

# User.all.to_csv(:include [...]]]></description>
			<content:encoded><![CDATA[<p>Ultimament estuve jugando con la gema <a href="http://github.com/ilmotta/to-csv">to-csv</a>, la cual funciona muy bien, pero me encontre con la necesidad de agregar a mi csv de mi objeto csv alguna relacion del modelo, hice un fork de la gema <a href="http://github.com/chebyte/to-csv">http://github.com/chebyte/to-csv</a> con los siguientes cambios:</p>
<p><strong>has_many relationships:<br />
</strong><br />
# User.all.to_csv(:include => :applications)</p>
<p><strong>belong_to relationship:<br />
</strong><br />
# User.all.to_csv(:include => <img src='http://www.chebyte.com.ar/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> rganization)</p>
<p><strong>o combinar los dos<br />
</strong><br />
# User.all.to_csv(:include => [:organization, :applications])</p>
<p>disfruten <img src='http://www.chebyte.com.ar/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.chebyte.com.ar/2010/06/24/to-csv-con-activerecord/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AWS-S3 con multiples conexiones</title>
		<link>http://www.chebyte.com.ar/2010/06/24/aws-s3-con-multiples-conexiones/</link>
		<comments>http://www.chebyte.com.ar/2010/06/24/aws-s3-con-multiples-conexiones/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 20:29:52 +0000</pubDate>
		<dc:creator>mauro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chebyte.com.ar/?p=191</guid>
		<description><![CDATA[Utilizando el otro dia la gema de aws-s3 me vi con la necesidad de darle soporte para multiple conexiones, para poder especificar la sesión a expirar.
Pueden encontrar el cambio en mi fork de la gema http://github.com/chebyte/aws-s3
Ejemplo

Hice las conexiones &#8220;chebyte&#8221; y &#8220;chebyte2&#8243;
espero que les sirva!
]]></description>
			<content:encoded><![CDATA[<p>Utilizando el otro dia la gema de aws-s3 me vi con la necesidad de darle soporte para multiple conexiones, para poder especificar la sesión a expirar.<br />
Pueden encontrar el cambio en mi fork de la gema <a href="http://github.com/chebyte/aws-s3">http://github.com/chebyte/aws-s3</a></p>
<p>Ejemplo</p>
<p><script src="http://gist.github.com/451890.js?file=gistfile1.txt"></script></p>
<p>Hice las conexiones &#8220;chebyte&#8221; y &#8220;chebyte2&#8243;</p>
<p>espero que les sirva!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chebyte.com.ar/2010/06/24/aws-s3-con-multiples-conexiones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git refspec warning</title>
		<link>http://www.chebyte.com.ar/2010/04/05/git-refspec-warning/</link>
		<comments>http://www.chebyte.com.ar/2010/04/05/git-refspec-warning/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 14:49:51 +0000</pubDate>
		<dc:creator>mauro</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.chebyte.com.ar/?p=188</guid>
		<description><![CDATA[si tienes este error en ubuntu

lo solucionas con esto
# git config &#8211;add push.default current
]]></description>
			<content:encoded><![CDATA[<p>si tienes este error en ubuntu</p>
<p><script src="http://gist.github.com/356413.js?file=git+refspec"></script></p>
<p>lo solucionas con esto</p>
<p># git config &#8211;add push.default current</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chebyte.com.ar/2010/04/05/git-refspec-warning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IRB con historial y colores</title>
		<link>http://www.chebyte.com.ar/2010/01/24/irb-history/</link>
		<comments>http://www.chebyte.com.ar/2010/01/24/irb-history/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 17:10:23 +0000</pubDate>
		<dc:creator>mauro</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.chebyte.com.ar/?p=183</guid>
		<description><![CDATA[Este es un buen truco para utilizar el history y colores en el irb de nuestro ruby

]]></description>
			<content:encoded><![CDATA[<p>Este es un buen truco para utilizar el history y colores en el irb de nuestro ruby</p>
<p><script src="http://gist.github.com/285317.js?file=gistfile1.sh"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chebyte.com.ar/2010/01/24/irb-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tuquito Railers: Linux para RubyOnRails</title>
		<link>http://www.chebyte.com.ar/2009/10/08/176/</link>
		<comments>http://www.chebyte.com.ar/2009/10/08/176/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 00:22:54 +0000</pubDate>
		<dc:creator>mauro</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Tuquito]]></category>

		<guid isPermaLink="false">http://www.chebyte.com.ar/?p=176</guid>
		<description><![CDATA[Para todos los programadores de RubyOnRails, hice Tuquito Railers e n DVD, una versión con numerosas características para tener todo un entorno de programación RubyOnRails en cuestión de segundos.
La decisión que tome para hacer esta versión de Tuquito fue la necesidad que los programadores no tienen demasiado tiempo para gastarlo configurando el entorno de desarrollo [...]]]></description>
			<content:encoded><![CDATA[<p>Para todos los programadores de <a href="http://www.rubyonrails.org" target="_blank">RubyOnRails,</a> hice Tuquito Railers e n DVD, una versión con numerosas características para tener todo un entorno de programación <a href="http://www.rubyonrails.org" target="_blank">RubyOnRails</a> en cuestión de segundos.<br />
La decisión que tome para hacer esta versión de Tuquito fue la necesidad que los programadores no tienen demasiado tiempo para gastarlo configurando el entorno de desarrollo como las bases de datos, apache, ides, etc&#8230; Con Tuquito Railers tenes todo eso y mas en tan solo un enter.</p>
<p><strong>Carecteristicas:</strong></p>
<p>* apache2 (soporte php,modrails)<br />
* mongrel (server rails)<br />
* postgresql<br />
* mysql<br />
* sqlite3<br />
* ruby 1.8.6 por defecto<br />
* gema rvm para versionado de ruby<br />
* rails 2.3.3 &#8211; 2.3.4<br />
* gvim (plugins de akita)<br />
* gedit(gmate)<br />
* netbeans 6.7.1<br />
* git (aliases, adaptado al promp) &#8211; subversion<br />
* irb hackeado (colores, history)<br />
* autocomplete para rake<br />
* virtualbox<br />
* rapache administracion grafica de apache<br />
* autotest(rspec) integrado al escritorio<br />
* <a href="http://blog.tuquito.org.ar/2009/08/13/tuquito-3-dijo-la-partera/" target="_blank">todos los features de <span class="il">tuquito</span> 3 desktop <img src='http://www.chebyte.com.ar/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </a></p>
<p><a title="tuquito railers" href="http://tuquito.solucionesroot.com/isos/tuquito3-railers.iso" target="_blank">Descargar Tuquito Railers 3</a></p>
<p><strong>md5:</strong> <span id=":ym">b919517e3e464846135a9ae1593eb20c</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chebyte.com.ar/2009/10/08/176/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mi nuevo desarrollo: Pulguientos.com</title>
		<link>http://www.chebyte.com.ar/2009/08/01/mi-nuevo-desarrollo-pulguientos-com/</link>
		<comments>http://www.chebyte.com.ar/2009/08/01/mi-nuevo-desarrollo-pulguientos-com/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 17:22:08 +0000</pubDate>
		<dc:creator>mauro</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.chebyte.com.ar/?p=168</guid>
		<description><![CDATA[Pulguientos.com es mi nuevo proyecto, orientado a todo lo referente del mundo animal, como me gusta llamarlo a mi el facebook de las mascotas.
En pulguientos.com podes comprar, vender, regalar o solo monstrar fotos de tus mascotas preferidas, tambien cada usuario podra tener su propio blog o participar de los foros.
Pulguientos.com es una red social basada [...]]]></description>
			<content:encoded><![CDATA[<p><a title="mascotas" href="http://www.pulguientos.com" target="_blank"><img class="alignleft" style="border: 0pt none;" title="pulguientos" src="http://www.pulguientos.com/images/logo.png?1247188475" alt="" width="234" height="43" />Pulguientos.com</a> es mi nuevo proyecto, orientado a todo lo referente del mundo animal, como me gusta llamarlo a mi el<a title="mascotas" href="http:/www.pulguientos.com" target="_blank"> facebook de las mascotas</a>.<br />
En <a title="mascotas" href="http://www.pulguientos.com" target="_blank">pulguientos.com</a> podes comprar, vender, regalar o solo monstrar fotos de tus <a title="mascotas" href="http://www.pulguientos.com" target="_blank">mascotas</a> preferidas, tambien cada usuario podra tener su propio blog o participar de los foros.<br />
<a title="mascotas" href="http://www.pulguientos.com" target="_blank">Pulguientos.com</a> es una red social basada en <a href="http://lovdbyless.com/" target="_blank">http://lovdbyless.com/</a>, al cual modifique bastente agregandole fixtures como:</p>
<p>* Facebook Connect<br />
* Ajax Multi Upload<br />
* FileColumn to PaperClip</p>
<p>Calculo que en unas semanas publicare el codigo en github asi puedan aprovecharlo.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chebyte.com.ar/2009/08/01/mi-nuevo-desarrollo-pulguientos-com/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Desinfecta tu html (sanitizer)</title>
		<link>http://www.chebyte.com.ar/2009/06/12/desinfecta-tu-html-sanitizer/</link>
		<comments>http://www.chebyte.com.ar/2009/06/12/desinfecta-tu-html-sanitizer/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 20:24:51 +0000</pubDate>
		<dc:creator>mauro</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.chebyte.com.ar/?p=155</guid>
		<description><![CDATA[



















simple_sanitizer_html es un plugin muy sencillo que arme para Rails, que te permite básicamente escapar el html.
Lo interesante de este plugin es que solo debemos extender el modelo y de forma automática guarda todo los registros escapando el html en la base de datos.
Instalar simple_sanitizer_html

  http://github.com/chebyte/simple_sanitizer_html/tree/master

Uso Práctico

# ruby script/generate model Post title:string copy:text


class Post
 [...]]]></description>
			<content:encoded><![CDATA[



















<p><a href="http://github.com/chebyte/simple_sanitizer_html/tree/master">simple_sanitizer_html </a>es un plugin muy sencillo que arme para Rails, que te permite básicamente<a href="http://www.chebyte.com.ar/2009/06/12/desinfecta-tu-html-sanitizer/"> escapar el html</a>.<br />
Lo interesante de este plugin es que solo debemos extender el modelo y de forma automática guarda todo los registros escapando el html en la base de datos.</p>
<p><strong>Instalar simple_sanitizer_html</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">  http:<span style="color:#006600; font-weight:bold;">//</span>github.<span style="color:#9900CC;">com</span><span style="color:#006600; font-weight:bold;">/</span>chebyte<span style="color:#006600; font-weight:bold;">/</span>simple_sanitizer_html<span style="color:#006600; font-weight:bold;">/</span>tree<span style="color:#006600; font-weight:bold;">/</span>master</pre></div></div>

<p><strong>Uso Práctico</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># ruby script/generate model Post title:string copy:text</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Post
 simple_sanitizer_html
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">$ ruby script<span style="color:#006600; font-weight:bold;">/</span>console 
Loading development environment <span style="color:#006600; font-weight:bold;">&#40;</span>Rails 2.3.2<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#CC0066; font-weight:bold;">p</span> <span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#CC0066; font-weight:bold;">p</span> = Post.<span style="color:#9900CC;">new</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;Post id: nil, title: nil, copy: nil, created_at: nil, updated_at: nil&gt;</span>
<span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#CC0066; font-weight:bold;">p</span>.<span style="color:#9900CC;">title</span> = <span style="color:#996600;">&quot;&lt;script&gt;alert('hi tuquito')&lt;/script&gt;&quot;</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;&lt;script&gt;alert('hi tuquito')&lt;/script&gt;&quot;</span>
<span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#CC0066; font-weight:bold;">p</span>.<span style="color:#9900CC;">save</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
<span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#CC0066; font-weight:bold;">p</span>.<span style="color:#9900CC;">title</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;&amp;lt;script&amp;gt;alert(&amp;#39;hi tuquito&amp;#39;)&amp;lt;/script&amp;gt;&quot;</span>
<span style="color:#006600; font-weight:bold;">&gt;&gt;</span></pre></div></div>

<p>Este plugin puede ser muy útil para<a href="http://www.chebyte.com.ar/2009/06/12/desinfecta-tu-html-sanitizer/"> prevenir ataques XSS</a> o del estilo</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chebyte.com.ar/2009/06/12/desinfecta-tu-html-sanitizer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google Scrap con Rails</title>
		<link>http://www.chebyte.com.ar/2009/06/12/google-scrap-con-rails/</link>
		<comments>http://www.chebyte.com.ar/2009/06/12/google-scrap-con-rails/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 20:18:47 +0000</pubDate>
		<dc:creator>mauro</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.chebyte.com.ar/?p=151</guid>
		<description><![CDATA[



















web_search_plugin es un nuevo plugin de Rails que hice, para poder obtener los resultados de una determinada consulta en google y mostrarla en tu sitio. Hasta el momento solo realiza búsquedas en Google, a futuro lo voy a integrar con Yahoo y Live.
Instalar web_search_plugin

# cd myapprails
# ruby script/plugin install git@github.com:chebyte/web_search_plugin.git

Uso
Como ejemplo, tenemos el modelo #link.rb

 [...]]]></description>
			<content:encoded><![CDATA[



















<p><a href="http://github.com/chebyte/web_search_plugin/tree/master">web_search_plugin</a> es un nuevo plugin de Rails que hice, para poder obtener los resultados de una determinada consulta en google y mostrarla en tu sitio. Hasta el momento solo realiza búsquedas en Google, a futuro lo voy a integrar con Yahoo y Live.</p>
<p><strong>Instalar web_search_plugin</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># cd myapprails</span>
<span style="color:#008000; font-style:italic;"># ruby script/plugin install git@github.com:chebyte/web_search_plugin.git</span></pre></div></div>

<p><strong>Uso</strong><br />
Como ejemplo, tenemos el modelo #link.rb</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"> <span style="color:#9966CC; font-weight:bold;">class</span> Link <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
   <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">Chebyte::WebSearch</span>
   web_search
 <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Ahora para obtener los resultados solo debemos llamar al método search_web</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"> Link.<span style="color:#9900CC;">google_search</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:query</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;tuquito&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>esto nos devolveria</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;Google::Response:0xb734d3cc @results=[{:domain=&gt;&quot;www.tuquito.org.ar&quot;, :content=&gt;&quot;Proyecto Linux de Tucumán, datos y temas relacionados al proyecto, foros y ayuda para usuarios de la distribución y descargas.&quot;, :title=&gt;&quot;Tuquito 3&quot;, :cache_url=&gt;&quot;http://www.google.com/search?q=cache:4NZXKc3gQA8J:www.tuquito.org.ar&quot;, :url=&gt;&quot;http://www.tuquito.org.ar/&quot;}, {:domain=&gt;&quot;en.wikipedia.org&quot;, :content=&gt;&quot;Oct 11, 2008 ... Tuquito is a Debian-based operating system created in Tucumán, Argentina, by Ignacio Díaz, Chris Arenas and Mauro Torres, students of The ...&quot;, :title=&gt;&quot;Tuquito - Wikipedia, the free encyclopedia&quot;, :cache_url=&gt;&quot;http://www.google.com/search?q=cache:a1xAEvHHujUJ:en.wikipedia.org&quot;, :url=&gt;&quot;http://en.wikipedia.org/wiki/Tuquito&quot;}, {:domain=&gt;&quot;www.slideshare.net&quot;, :content=&gt;&quot;Tuquito 3 Nuevo Diseño En varios idiomas (Ingles,Portugues y Español) Interfaces mas intuitivas Optimizado para la conectividad(wifi, ...&quot;, :title=&gt;&quot;Tuquito 3&quot;, :cache_url=&gt;&quot;http://www.google.com/search?q=cache:T8VfO-4iyioJ:www.slideshare.net&quot;, :url=&gt;&quot;http://www.slideshare.net/chebyte/tuquito-3&quot;}, {:domain=&gt;&quot;www.olpcnews.com&quot;, :content=&gt;&quot;OLPC Tuquito's team began to work at 1st January of 2007, with the knowledge acquisition about the project One Laptop Per Child and then with development ...&quot;, :title=&gt;&quot;OLPC Tuquito Project Progress in Argentina - OLPC News&quot;, :cache_url=&gt;&quot;http://www.google.com/search?q=cache:eoGfDNbaZ8kJ:www.olpcnews.com&quot;, :url=&gt;&quot;http://www.olpcnews.com/countries/argentina/olpc_tuquito_project_argentina.html&quot;}], @status=200, @size=4, @query=&quot;tuquito&quot;&gt;</span></pre></div></div>

<p>El resultado es un simple objecto hash, algunos de los campos disponibles son<br />
 <strong>   * title</strong> titulo del resultado<br />
   <strong> * url </strong>Url del resultado<br />
<strong>    * domain</strong> Root url del resultado<br />
  <strong>  * content </strong>contenido<br />
<strong>    * cache_url</strong> Google cache url</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chebyte.com.ar/2009/06/12/google-scrap-con-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Configurar passenger con nginx</title>
		<link>http://www.chebyte.com.ar/2009/06/07/configurar-passenger-con-nginx/</link>
		<comments>http://www.chebyte.com.ar/2009/06/07/configurar-passenger-con-nginx/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 20:18:11 +0000</pubDate>
		<dc:creator>mauro</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.chebyte.com.ar/?p=139</guid>
		<description><![CDATA[





























Instalar Ruby Enterprise Edition

sudo apt-get install build-essential zlib1g-dev libssl-dev libreadline5-dev


wget http://rubyforge.org/frs/download.php/51100/ruby-enterprise-1.8.6-20090201.tar.gz
tar xvfz ruby-enterprise-1.8.6-20090201.tar.gz 
rm ruby-enterprise-1.8.6-20090201.tar.gz 
cd ruby-enterprise-1.8.6-20090201/
sudo ./installer

Agregar ruby entrerprise al path del sistema

echo &#34;export PATH=/opt/ruby-enterprise-1.8.6-20090201/bin:$PATH&#34; &#62;&#62; ~/.profile &#38;&#38; . ~/.profile

Nginx

sudo /opt/ruby-enterprise-1.8.6-20090201/bin/passenger-install-nginx-module

Elegir la opcion 1. Yes: download, compile and install Nginx for me. (recommended)
Script de inicio Nginx
Agregar el siguiente codigo en

/etc/init.d/nginx
sudo chown root:root /etc/init.d/nginx

Probar una [...]]]></description>
			<content:encoded><![CDATA[





























<p><strong>Instalar Ruby Enterprise Edition</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">sudo apt<span style="color:#006600; font-weight:bold;">-</span>get install build<span style="color:#006600; font-weight:bold;">-</span>essential zlib1g<span style="color:#006600; font-weight:bold;">-</span>dev libssl<span style="color:#006600; font-weight:bold;">-</span>dev libreadline5<span style="color:#006600; font-weight:bold;">-</span>dev</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">wget http:<span style="color:#006600; font-weight:bold;">//</span>rubyforge.<span style="color:#9900CC;">org</span><span style="color:#006600; font-weight:bold;">/</span>frs<span style="color:#006600; font-weight:bold;">/</span>download.<span style="color:#9900CC;">php</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">51100</span><span style="color:#006600; font-weight:bold;">/</span>ruby<span style="color:#006600; font-weight:bold;">-</span>enterprise<span style="color:#006600; font-weight:bold;">-</span>1.8.6<span style="color:#006600; font-weight:bold;">-</span>20090201.<span style="color:#9900CC;">tar</span>.<span style="color:#9900CC;">gz</span>
tar xvfz ruby<span style="color:#006600; font-weight:bold;">-</span>enterprise<span style="color:#006600; font-weight:bold;">-</span>1.8.6<span style="color:#006600; font-weight:bold;">-</span>20090201.<span style="color:#9900CC;">tar</span>.<span style="color:#9900CC;">gz</span> 
rm ruby<span style="color:#006600; font-weight:bold;">-</span>enterprise<span style="color:#006600; font-weight:bold;">-</span>1.8.6<span style="color:#006600; font-weight:bold;">-</span>20090201.<span style="color:#9900CC;">tar</span>.<span style="color:#9900CC;">gz</span> 
cd ruby<span style="color:#006600; font-weight:bold;">-</span>enterprise<span style="color:#006600; font-weight:bold;">-</span>1.8.6<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">20090201</span><span style="color:#006600; font-weight:bold;">/</span>
sudo .<span style="color:#006600; font-weight:bold;">/</span>installer</pre></div></div>

<p>Agregar ruby entrerprise al path del sistema</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">echo <span style="color:#996600;">&quot;export PATH=/opt/ruby-enterprise-1.8.6-20090201/bin:$PATH&quot;</span> <span style="color:#006600; font-weight:bold;">&gt;&gt;</span> ~<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">profile</span> <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> . ~<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">profile</span></pre></div></div>

<p><strong>Nginx</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">sudo <span style="color:#006600; font-weight:bold;">/</span>opt<span style="color:#006600; font-weight:bold;">/</span>ruby<span style="color:#006600; font-weight:bold;">-</span>enterprise<span style="color:#006600; font-weight:bold;">-</span>1.8.6<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">20090201</span><span style="color:#006600; font-weight:bold;">/</span>bin<span style="color:#006600; font-weight:bold;">/</span>passenger<span style="color:#006600; font-weight:bold;">-</span>install<span style="color:#006600; font-weight:bold;">-</span>nginx<span style="color:#006600; font-weight:bold;">-</span><span style="color:#9966CC; font-weight:bold;">module</span></pre></div></div>

<p><em>Elegir la opcion 1. Yes: download, compile and install Nginx for me. (recommended)</em></p>
<p><strong>Script de inicio Nginx</strong></p>
<p>Agregar el <a href="http://gist.github.com/125465">siguiente codigo</a> en</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">/</span>etc<span style="color:#006600; font-weight:bold;">/</span>init.<span style="color:#9900CC;">d</span><span style="color:#006600; font-weight:bold;">/</span>nginx
sudo chown root:root <span style="color:#006600; font-weight:bold;">/</span>etc<span style="color:#006600; font-weight:bold;">/</span>init.<span style="color:#9900CC;">d</span><span style="color:#006600; font-weight:bold;">/</span>nginx</pre></div></div>

<p><strong>Probar una aplicacion rails en nginx</strong><br />
agregar un virtual host</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">server <span style="color:#006600; font-weight:bold;">&#123;</span>
    listen <span style="color:#006666;">80</span>;
    <span style="color:#008000; font-style:italic;"># server_name www.mycook.com;</span>
    root <span style="color:#006600; font-weight:bold;">/</span>home<span style="color:#006600; font-weight:bold;">/</span>deploy<span style="color:#006600; font-weight:bold;">/</span>testapp<span style="color:#006600; font-weight:bold;">/</span>public;
    passenger_enabled on;
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.chebyte.com.ar/2009/06/07/configurar-passenger-con-nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configurar un servidor con thin y nginx</title>
		<link>http://www.chebyte.com.ar/2009/06/07/configurar-un-servidor-con-thin-y-nginx/</link>
		<comments>http://www.chebyte.com.ar/2009/06/07/configurar-un-servidor-con-thin-y-nginx/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 20:07:12 +0000</pubDate>
		<dc:creator>mauro</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.chebyte.com.ar/?p=132</guid>
		<description><![CDATA[


































Instalar thin

  sudo gem install thin

Configurar thin en el sistema

 sudo thin install

Configurar thin en nginx

sudo thin config -C /etc/thin/&#60;config-name&#62;.yml -c &#60;rails-app-root-path&#62; --servers &#60;number-of-threads&#62; -e &#60;environment&#62; --socket /tmp/thin.sock

Reemplaza config-name con el nombre del archivo de configuracion, rails-app-root-path con la ruta de tu aplicacion rails, number-of-threads con el numero de procesos de thin que quieres iniciar [...]]]></description>
			<content:encoded><![CDATA[


































<p><strong>Instalar thin</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">  sudo gem install thin</pre></div></div>

<p><strong>Configurar thin en el sistema</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"> sudo thin install</pre></div></div>

<p><strong>Configurar thin en nginx</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">sudo thin config <span style="color:#006600; font-weight:bold;">-</span>C <span style="color:#006600; font-weight:bold;">/</span>etc<span style="color:#006600; font-weight:bold;">/</span>thin<span style="color:#006600; font-weight:bold;">/&lt;</span>config<span style="color:#006600; font-weight:bold;">-</span>name<span style="color:#006600; font-weight:bold;">&gt;</span>.<span style="color:#9900CC;">yml</span> <span style="color:#006600; font-weight:bold;">-</span>c <span style="color:#006600; font-weight:bold;">&lt;</span>rails<span style="color:#006600; font-weight:bold;">-</span>app<span style="color:#006600; font-weight:bold;">-</span>root<span style="color:#006600; font-weight:bold;">-</span>path<span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006600; font-weight:bold;">--</span>servers <span style="color:#006600; font-weight:bold;">&lt;</span>number<span style="color:#006600; font-weight:bold;">-</span>of<span style="color:#006600; font-weight:bold;">-</span>threads<span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006600; font-weight:bold;">-</span>e <span style="color:#006600; font-weight:bold;">&lt;</span>environment<span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006600; font-weight:bold;">--</span>socket <span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>thin.<span style="color:#9900CC;">sock</span></pre></div></div>

<p>Reemplaza config-name con el nombre del archivo de configuracion, rails-app-root-path con la ruta de tu aplicacion rails, number-of-threads con el numero de procesos de thin que quieres iniciar y  environment con el enviroment que quieres inicializar, por ejemplo</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">$ sudo thin config <span style="color:#006600; font-weight:bold;">-</span>C <span style="color:#006600; font-weight:bold;">/</span>etc<span style="color:#006600; font-weight:bold;">/</span>thin<span style="color:#006600; font-weight:bold;">/</span>chebyte.<span style="color:#9900CC;">com</span>.<span style="color:#9900CC;">ar</span>.<span style="color:#9900CC;">yml</span> <span style="color:#006600; font-weight:bold;">-</span>c <span style="color:#006600; font-weight:bold;">/</span>var<span style="color:#006600; font-weight:bold;">/</span>rails<span style="color:#006600; font-weight:bold;">/</span>chebyte <span style="color:#006600; font-weight:bold;">--</span>servers <span style="color:#006666;">5</span> <span style="color:#006600; font-weight:bold;">-</span>e production <span style="color:#006600; font-weight:bold;">--</span>socket <span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>thin.<span style="color:#9900CC;">sock</span></pre></div></div>

<p>Esto nos generara el siguiente archivo en /etc/thin</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">---</span>
pid: tmp<span style="color:#006600; font-weight:bold;">/</span>pids<span style="color:#006600; font-weight:bold;">/</span>thin.<span style="color:#9900CC;">pid</span>
socket: <span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>thin.<span style="color:#9900CC;">sock</span>
log: log<span style="color:#006600; font-weight:bold;">/</span>thin.<span style="color:#9900CC;">log</span>
timeout: <span style="color:#006666;">30</span>
max_conns: <span style="color:#006666;">1024</span>
chdir: <span style="color:#006600; font-weight:bold;">/</span>var<span style="color:#006600; font-weight:bold;">/</span>ror<span style="color:#006600; font-weight:bold;">/</span>chebyte
max_persistent_conns: <span style="color:#006666;">512</span>
environment: production
servers: <span style="color:#006666;">4</span>
daemonize: <span style="color:#0000FF; font-weight:bold;">true</span>
<span style="color:#CC0066; font-weight:bold;">require</span>: <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p><strong>Iniciamos thin</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">/</span>etc<span style="color:#006600; font-weight:bold;">/</span>init.<span style="color:#9900CC;">d</span><span style="color:#006600; font-weight:bold;">/</span>thin start</pre></div></div>

<p><strong>&#8211;socket /tmp/thin.sock</strong> esta opcion permite que nginx se comunique con thin mediante socket y no mediante una interace ethernet interna, muy recomendado para obtener mas perfomance</p>
<p><strong>Configurar thin en nginx</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">user nginx;
worker_processes <span style="color:#006666;">5</span>;
&nbsp;
error_log <span style="color:#006600; font-weight:bold;">/</span>var<span style="color:#006600; font-weight:bold;">/</span>log<span style="color:#006600; font-weight:bold;">/</span>nginx.<span style="color:#9900CC;">error</span>.<span style="color:#9900CC;">log</span>;
pid <span style="color:#006600; font-weight:bold;">/</span>var<span style="color:#006600; font-weight:bold;">/</span>run<span style="color:#006600; font-weight:bold;">/</span>nginx.<span style="color:#9900CC;">pid</span>;
&nbsp;
events <span style="color:#006600; font-weight:bold;">&#123;</span>
  worker_connections <span style="color:#006666;">1024</span>;
<span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
http <span style="color:#006600; font-weight:bold;">&#123;</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> mime.<span style="color:#9900CC;">types</span>;
  default_type application<span style="color:#006600; font-weight:bold;">/</span>octet<span style="color:#006600; font-weight:bold;">-</span>stream;
&nbsp;
  log_format main <span style="color:#996600;">'$remote_addr - $remote_user [$time_local] $request '</span>
                      <span style="color:#996600;">'&quot;$status&quot; $body_bytes_sent &quot;$http_referer&quot; '</span>
                      <span style="color:#996600;">'&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;'</span>;
&nbsp;
  access_log <span style="color:#006600; font-weight:bold;">/</span>var<span style="color:#006600; font-weight:bold;">/</span>log<span style="color:#006600; font-weight:bold;">/</span>nginx.<span style="color:#9900CC;">access</span>.<span style="color:#9900CC;">log</span> main;
&nbsp;
  sendfile on;
&nbsp;
  keepalive_timeout <span style="color:#006666;">65</span>;
&nbsp;
  upstream thin_cluster <span style="color:#006600; font-weight:bold;">&#123;</span>
    server unix:<span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>thin.0.<span style="color:#9900CC;">sock</span>;
    server unix:<span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>thin.1.<span style="color:#9900CC;">sock</span>;
    server unix:<span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>thin.2.<span style="color:#9900CC;">sock</span>;
    server unix:<span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>thin.3.<span style="color:#9900CC;">sock</span>;
    server unix:<span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>thin.4.<span style="color:#9900CC;">sock</span>;
  <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
  server <span style="color:#006600; font-weight:bold;">&#123;</span>
    listen <span style="color:#006666;">80</span>;
    server_name www.<span style="color:#9900CC;">myserver</span>.<span style="color:#9900CC;">com</span>;
&nbsp;
    root <span style="color:#006600; font-weight:bold;">/</span>var<span style="color:#006600; font-weight:bold;">/</span>rails<span style="color:#006600; font-weight:bold;">/</span>mysapp<span style="color:#006600; font-weight:bold;">/</span>public;
&nbsp;
    location <span style="color:#006600; font-weight:bold;">/</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
      proxy_set_header X<span style="color:#006600; font-weight:bold;">-</span>Real<span style="color:#006600; font-weight:bold;">-</span>IP <span style="color:#ff6633; font-weight:bold;">$remote_addr</span>;
      proxy_set_header X<span style="color:#006600; font-weight:bold;">-</span>Forwarded<span style="color:#006600; font-weight:bold;">-</span><span style="color:#9966CC; font-weight:bold;">For</span> <span style="color:#ff6633; font-weight:bold;">$proxy_add_x_forwarded_for</span>;
      proxy_set_header Host <span style="color:#ff6633; font-weight:bold;">$http_host</span>;
      proxy_redirect <span style="color:#0000FF; font-weight:bold;">false</span>;
&nbsp;
      <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">-</span>f <span style="color:#ff6633; font-weight:bold;">$request_filename</span><span style="color:#006600; font-weight:bold;">/</span>index.<span style="color:#9900CC;">html</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
        rewrite <span style="color:#006600; font-weight:bold;">&#40;</span>.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#41;</span> $<span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">/</span>index.<span style="color:#9900CC;">html</span> <span style="color:#9966CC; font-weight:bold;">break</span>;
      <span style="color:#006600; font-weight:bold;">&#125;</span>
      <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">-</span>f <span style="color:#ff6633; font-weight:bold;">$request_filename</span>.<span style="color:#9900CC;">html</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
        rewrite <span style="color:#006600; font-weight:bold;">&#40;</span>.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#41;</span> $1.<span style="color:#9900CC;">html</span> <span style="color:#9966CC; font-weight:bold;">break</span>;
      <span style="color:#006600; font-weight:bold;">&#125;</span>
      <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<span style="color:#006600; font-weight:bold;">-</span>f <span style="color:#ff6633; font-weight:bold;">$request_filename</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
        proxy_pass http:<span style="color:#006600; font-weight:bold;">//</span>thin_cluster;
        <span style="color:#9966CC; font-weight:bold;">break</span>;
      <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
    error_page <span style="color:#006666;">500</span> <span style="color:#006666;">502</span> <span style="color:#006666;">503</span> <span style="color:#006666;">504</span> <span style="color:#006600; font-weight:bold;">/</span>50x.<span style="color:#9900CC;">html</span>;
    location = <span style="color:#006600; font-weight:bold;">/</span>50x.<span style="color:#9900CC;">html</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
      root html;
    <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.chebyte.com.ar/2009/06/07/configurar-un-servidor-con-thin-y-nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
