<?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>pastbedti.me &#187; Hosting</title>
	<atom:link href="http://www.pastbedti.me/category/hosting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pastbedti.me</link>
	<description>About ruby, rails, postgresql and stuff....</description>
	<lastBuildDate>Wed, 01 Jun 2011 20:09:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Deploying a Sinatra app with Apache and Phusion Passenger a.k.a. mod_rack</title>
		<link>http://www.pastbedti.me/2009/11/deploying-a-sinatra-app-with-apache-and-phusion-passenger-a-k-a-mod_rack/</link>
		<comments>http://www.pastbedti.me/2009/11/deploying-a-sinatra-app-with-apache-and-phusion-passenger-a-k-a-mod_rack/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 22:01:30 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sinatra]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[webroot]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=610</guid>
		<description><![CDATA[My Sinatra + Apache + Passenger setup did not just run Deploying a simple Sinatra rack application under Apache and Phusion Passenger turned out not work out of the box for me. I already had a virtual host so I decided to deploy with passengers sub URI (sub URI documentation). To make this work you&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<h3>My Sinatra + Apache + Passenger setup did not just run <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </h3>
<p>Deploying a simple Sinatra rack application under Apache and Phusion Passenger turned out not work out of the box for me. </p>
<p>I already had a virtual host so I decided to deploy with passengers sub URI (<a href="http://www.modrails.com/documentation/Users%20guide.html#deploying_rack_to_sub_uri" target="_blank">sub URI documentation</a>).</p>
<p>To make this work you&#8217;ll need Apache installed with Phusion Passenger setup (<a href="http://www.modrails.com/install.html" target="_blank">Passenger installation</a>)</p>
<p>
<h3>This is what I started with</h3>
<p>This is my folders for the already existing website.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># Existing homedir</span><br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #666666; font-style: italic;"># Current webroot</span><br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span>htdocs</div></td></tr></tbody></table></div>
<p>
<h3>Creating folders and files for Sinatra</h3>
<p>The first thing you want to do is to create folders and files for Sinatra.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mkdir /home/my_web/sinatra</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cd /home/my_web/sinatra<br />
mkdir tmp<br />
mkdir logs<br />
mkdir public<br />
touch app.rb<br />
touch config.ru</div></td></tr></tbody></table></div>
<p>
<h3>Create symlink</h3>
<p>Create a symbolic link from our current webroot to the new Sinatra app so that apache/passenger can find it.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span>sinatra<span style="color: #000000; font-weight: bold;">/</span>public <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>app</div></td></tr></tbody></table></div>
<p>
<h3>Creating the application</h3>
<p>We also need a Sinatra application for this to work so lets fill those files.</p>
<p>
<h4>File: config.ru</h4>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'app'</span><br />
<br />
set <span style="color:#ff3333; font-weight:bold;">:environment</span>, ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'RACK_ENV'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_sym</span><br />
set <span style="color:#ff3333; font-weight:bold;">:app_file</span>, &nbsp; &nbsp; <span style="color:#996600;">'app.rb'</span><br />
disable <span style="color:#ff3333; font-weight:bold;">:run</span><br />
<br />
log = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;logs/sinatra.log&quot;</span>, <span style="color:#996600;">&quot;a&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
STDOUT.<span style="color:#9900CC;">reopen</span><span style="color:#006600; font-weight:bold;">&#40;</span>log<span style="color:#006600; font-weight:bold;">&#41;</span><br />
STDERR.<span style="color:#9900CC;">reopen</span><span style="color:#006600; font-weight:bold;">&#40;</span>log<span style="color:#006600; font-weight:bold;">&#41;</span><br />
<br />
run <span style="color:#6666ff; font-weight:bold;">Sinatra::Application</span></div></td></tr></tbody></table></div>
<p>
<h4>File: app.rb</h4>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span><br />
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'sinatra'</span><br />
<br />
before <span style="color:#9966CC; font-weight:bold;">do</span> <br />
&nbsp; <span style="color:#008000; font-style:italic;"># Strip the last / from the path</span><br />
&nbsp; request.<span style="color:#9900CC;">env</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'PATH_INFO'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#CC0066; font-weight:bold;">gsub!</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>\<span style="color:#006600; font-weight:bold;">/</span>$<span style="color:#006600; font-weight:bold;">/</span>, <span style="color:#996600;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
get <span style="color:#996600;">''</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp;<span style="color:#996600;">&quot;Hello world&quot;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></td></tr></tbody></table></div>
<p>
<h3>Apache configuration</h3>
<p>Now we need to setup apache so that it can find our Sinatra app and load it.</p>
<p>The only thing you need to do is add the following line to your existing VirtualHost block:</p>
<div class="codecolorer-container apache twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">RackBaseURI /app</div></td></tr></tbody></table></div>
<p>This line will tell passenger to look into our existing webroot for a symlink thats named app and which points to our rack app.  (<a href="http://www.modrails.com/documentation/Users%20guide.html#RackBaseURI" target="_blank">RackBaseURI  documentation</a>)</p>
<p>
<h3>Virtual host entry</h3>
<div class="codecolorer-container apache twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">80</span>&gt;<br />
&nbsp; <span style="color: #00007f;">ServerName</span> www.example.com<br />
&nbsp; <span style="color: #00007f;">ServerAlias</span> example.com<br />
&nbsp; <span style="color: #00007f;">DocumentRoot</span> /home/my_web/htdocs/<br />
&nbsp; RackBaseURI /app<br />
<br />
&nbsp; &lt;<span style="color: #000000; font-weight:bold;">Directory</span> <span style="color: #7f007f;">&quot;/home/my_web/htdocs/&quot;</span>&gt;<br />
&nbsp; &nbsp; <span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span><br />
&nbsp; &nbsp; <span style="color: #00007f;">Allow</span> from <span style="color: #0000ff;">all</span><br />
&nbsp; &nbsp; <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">All</span><br />
&nbsp; &lt;/<span style="color: #000000; font-weight:bold;">Directory</span>&gt;<br />
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</div></td></tr></tbody></table></div>
<p>The best part is that you are allowed to specify this option multiple times. So you can easily setup multiple apps under the same virtual host.</p>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2009/11/deploying-a-sinatra-app-with-apache-and-phusion-passenger-a-k-a-mod_rack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running couchdb under an unprivileged user account.</title>
		<link>http://www.pastbedti.me/2009/04/running-couchdb-under-an-unprivileged-user-account/</link>
		<comments>http://www.pastbedti.me/2009/04/running-couchdb-under-an-unprivileged-user-account/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 18:23:55 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[couchdb]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[unprivileged]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=423</guid>
		<description><![CDATA[When helping a friend last night with couchdb a got stuck when trying to start it as an unprivileged user. The error messages you get from couchdb is far from easy to understand. This is my way of solving it. 1234567$ couchdb kernel-poll not supported; &#34;K&#34; parameter ignored Apache CouchDB 0.9.0 (LogLevel=info) is starting. {&#34;init [...]]]></description>
			<content:encoded><![CDATA[<p>When helping a friend last night with couchdb a got stuck when trying to start it as an unprivileged user. The error messages you get from couchdb is far from easy to understand. </p>
<p>This is my way of solving it.<br />
<span id="more-423"></span></p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ couchdb<br />
kernel-poll not supported; &quot;K&quot; parameter ignored<br />
Apache CouchDB 0.9.0 (LogLevel=info) is starting.<br />
{&quot;init terminating in do_boot&quot;,{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}}<br />
<br />
Crash dump was written to: erl_crash.dump<br />
init terminating in do_boot ()</div></td></tr></tbody></table></div>
<p>Even with debug turned on it&#8217;s pretty hard to understand.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">kernel-poll not supported; &quot;K&quot; parameter ignored<br />
Apache CouchDB 0.9.0 (LogLevel=debug) is starting.<br />
Configuration Settings [&quot;./couchdb/local.ini&quot;]:<br />
&nbsp; [Couch] BindAddress=&quot;127.0.0.1&quot;<br />
&nbsp; [Couch] ConsoleStartupMsg=&quot;Apache CouchDB is starting.&quot;<br />
&nbsp; [Couch] DbRootDir=&quot;/home/mathias/couchdb&quot;<br />
&nbsp; [Couch] DocumentRoot=&quot;/home/mathias/couchdb/www&quot;<br />
&nbsp; [Couch] LogFile=&quot;/home/mathias/couchdb/couch.log&quot;<br />
&nbsp; [Couch] LogLevel=&quot;debug&quot;<br />
&nbsp; [Couch] Port=&quot;5984&quot;<br />
&nbsp; [Couch] UtilDriverDir=&quot;/usr/local/lib/couchdb/erlang/lib/couch-0.8.1-incubating/priv/lib&quot;<br />
&nbsp; [Couch Query Servers] javascript=&quot;/usr/local/bin/couchjs /usr/local/share/couchdb/server/main.js&quot;<br />
&nbsp; [couchdb] database_dir=&quot;/home/mathias/couchdb&quot;<br />
&nbsp; [couchdb] view_index_dir=&quot;/home/mathias/couchdb&quot;<br />
&nbsp; [httpd] bind_address=&quot;127.0.0.1&quot;<br />
&nbsp; [httpd] port=&quot;5984&quot;<br />
&nbsp; [log] level=&quot;debug&quot;<br />
[error] [&lt;0.41.0&gt;] {error_report,&lt;0.21.0&gt;,<br />
&nbsp; &nbsp; {&lt;0.41.0&gt;,crash_report,<br />
&nbsp; &nbsp; &nbsp;[[{pid,&lt;0.41.0&gt;},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{registered_name,couch_server},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{error_info,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{exit,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{badarg,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[{erlang,list_to_integer,[undefined]},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {couch_server,init,1},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {gen_server,init_it,6},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {proc_lib,init_p_do_apply,3}]},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{initial_call,{couch_server,init,['Argument__1']}},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{ancestors,[couch_primary_services,couch_server_sup,&lt;0.1.0&gt;]},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{messages,[]},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{links,[&lt;0.36.0&gt;]},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{dictionary,[]},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{trap_exit,false},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{status,running},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{heap_size,233},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{stack_size,23},<br />
&nbsp; &nbsp; &nbsp; &nbsp;{reductions,113}],<br />
&nbsp; &nbsp; &nbsp; []]}}<br />
{&quot;init terminating in do_boot&quot;,{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}}<br />
<br />
Crash dump was written to: erl_crash.dump<br />
init terminating in do_boot ()</div></td></tr></tbody></table></div>
<p>When running things as unprivileged users the usual problems are that you do not have access to read/write files or binding to the lower ports A.K.A. &#8220;well known ports&#8221;.  With that in mind I located the original config files for couchdb with the plan of copying or overriding them. </p>
<p>My config files where located under <strong>/usr/local/etc/couchdb/</strong></p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ ls -lsa /usr/local/etc/couchdb/<br />
4 -rw-r--r-- 1 root root 2626 2009-04-10 11:58 default.ini<br />
4 -rw-r--r-- 1 root root &nbsp;847 2009-04-10 14:17 local.ini</div></td></tr></tbody></table></div>
<p>Reading the documentation I found out that local.ini is just for overriding stuff and local.ini will never be overwritten by any upgrades. The config files contain lots of settings, but my aim is just to get it to start so I focus on the things that I think is the problem and thats all the PATH settings. </p>
<p>In my  unprivileged users home folder I created a folder named couchdb to hold my config and datafiles. I also created a www folder inside it. </p>
<p>After that I create my local.ini to override my settings:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ cat couchdb/local.ini <br />
<br />
[couchdb]<br />
database_dir = ./couchdb<br />
view_index_dir = ./couchdb<br />
<br />
[httpd]<br />
port = 5984<br />
bind_address = 127.0.0.1<br />
<br />
[log]<br />
level = info<br />
file=./couchdb/couch.log</div></td></tr></tbody></table></div>
<p>When our new config is in place we can try to start couchdb again.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ couchdb -C ./couchdb/local.ini -p ./couchdb/couch.pid -b<br />
Apache CouchDB has started, time to relax.</div></td></tr></tbody></table></div>
<p><strong>-C</strong> means use configuration FILE (chainable, does not reset system default). If we do not want to use the system config at all we can use a lowercase -c but we want to keep our overridden config as small as possible right now.</p>
<p><strong>-p</strong> is the path to our pid file and <strong>-b</strong> tells couchdb to spawn in the background.</p>
<p>If you are on your local machine you can just launch your browser and point it to <a href="http://127.0.0.1:5984/">http://127.0.0.1:5984/</a></p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">{&quot;couchdb&quot;:&quot;Welcome&quot;,&quot;version&quot;:&quot;0.9.0&quot;}</div></td></tr></tbody></table></div>
<p>or you can access the admin gui trough: <a href="http://127.0.0.1:5984/_utils/index.html">http://127.0.0.1:5984/_utils/index.html</a>.</p>
<p>After I started to write this blogpost I did found a page on the Couchdb wiki that explains Error messages and solutions and here it is: <a href="http://wiki.apache.org/couchdb/Error_messages">http://wiki.apache.org/couchdb/Error_messages</a>.</p>
<p>Happy haxxing! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2009/04/running-couchdb-under-an-unprivileged-user-account/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Painful experience with rails InvalidAuthenticityToken</title>
		<link>http://www.pastbedti.me/2009/03/painfully-experience-with-rails-invalidauthenticitytoken/</link>
		<comments>http://www.pastbedti.me/2009/03/painfully-experience-with-rails-invalidauthenticitytoken/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 19:22:25 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[domains]]></category>
		<category><![CDATA[painful]]></category>
		<category><![CDATA[staging]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=406</guid>
		<description><![CDATA[Today I had a really painful experience with rails InvalidAuthenticityToken. It turned out not to have anything to do with rails at all and there is where the painful part come in to play. We had an application which needed a staging environment. When everything where setup and after the first deploy to the new [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had a really painful experience with rails InvalidAuthenticityToken. It  turned out not to have anything to do with rails at all and there is where the painful part come in to play. </p>
<p><span id="more-406"></span></p>
<p>We had an application which needed a staging environment. When everything where setup and after the first deploy to the new environment everything seemed fine at first but when we tried to login we got these fine messages:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):<br />
&nbsp; &nbsp; /vendor/rails/actionpack/lib/action_controller/request_forgery_protection.rb:86:in `verify_authenticity_token'<br />
&nbsp; &nbsp; /vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `send'<br />
&nbsp; &nbsp; /vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `evaluate_method'<br />
&nbsp; &nbsp; /vendor/rails/activesupport/lib/active_support/callbacks.rb:166:in `call'<br />
&nbsp; &nbsp; /vendor/rails/actionpack/lib/action_controller/filters.rb:225:in `call'<br />
&nbsp; &nbsp; /vendor/rails/actionpack/lib/action_controller/filters.rb:629:in `run_before_filters'<br />
&nbsp; &nbsp; /vendor/rails/actionpack/lib/action_controller/filters.rb:615:in `call_filters'<br />
&nbsp; &nbsp; /vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'<br />
&nbsp; &nbsp; /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'</div></td></tr></tbody></table></div>
<p>After about two hours of troubleshooting the only problem left where that the browser did not get the cookie. We used telnet to check the headers and the cookie where there&#8230; ok, the browser is broken&#8230;. sure&#8230; </p>
<p>Then, finally it came to me&#8230; what if,&#8230; the hostname is broken? Broken hostname you tell me? Just for fun I changed the hostname and bada-bong bada-bing everything is working&#8230;. Now I get this creepy feeling of the big mistake I have made&#8230; </p>
<p>The thing is that I have worked with domains for many years and I know very well that you CANNOT have underscores in your domains. But my peanut brain do not think of subdomains as a domain-name. So we had a sub-domain with an underscore. Putting a underscore in the domainname makes Safari and some versions of Explorer not to accept cookies and that makes rails AuthenticityToken to treat me as a hacker&#8230;. </p>
<p>As a punishment I will force myself to read RFC 1035 (<a href="http://tools.ietf.org/html/rfc1035">http://tools.ietf.org/html/rfc1035</a>).</p>
<p>Over and out&#8230;. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2009/03/painfully-experience-with-rails-invalidauthenticitytoken/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Handling a staging environment with capistrano / rails</title>
		<link>http://www.pastbedti.me/2009/01/handling-a-staging-environment-with-capistrano-rails/</link>
		<comments>http://www.pastbedti.me/2009/01/handling-a-staging-environment-with-capistrano-rails/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 20:49:06 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[staging]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=342</guid>
		<description><![CDATA[Just before christmas I worked with one of our customers new server cluster or cloud if you may. This cluster has production nodes and staging nodes and this post is about how to get capistrano to play nice with both production and the staging environment. I have googled for a solution but all solutions I [...]]]></description>
			<content:encoded><![CDATA[<p>Just before christmas I worked with one of our customers new server cluster or cloud if you may.<br />
This cluster has production nodes and staging nodes and this post is about how to get capistrano to play nice with both production and the staging environment.<br />
<span id="more-342"></span></p>
<p>I have googled for a solution but all solutions I found where pretty ugly so i decided to create my own.  When writing this line I did a test googling just to give an example of a bad example and my first result where the <a href="http://weblog.jamisbuck.org/">buckblogs</a> blog. A post about <a href="http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage">a plugin called multistage</a> I do not how I could miss that <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>But as my solution is so simple I will continue this post and show you anyway. </p>
<p>As usual I have written to much bullshit and I guess that you just want is some code so here you go.</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">desc <span style="color:#996600;">&quot;Run tasks in production enviroment.&quot;</span><br />
task <span style="color:#ff3333; font-weight:bold;">:production</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># Production nodes </span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;192.168.1.30&quot;</span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;192.168.2.30&quot;</span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:db</span>, &nbsp;<span style="color:#996600;">&quot;192.168.1.30&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span> <br />
<br />
desc <span style="color:#996600;">&quot;Run tasks in staging enviroment.&quot;</span><br />
task <span style="color:#ff3333; font-weight:bold;">:staging</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># Staging nodes </span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:web</span>, <span style="color:#996600;">&quot;192.168.1.60&quot;</span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;192.168.2.60&quot;</span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:db</span>, &nbsp;<span style="color:#996600;">&quot;192.168.1.60&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#0000FF; font-weight:bold;">true</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></td></tr></tbody></table></div>
<p>This is all there is to it. Splitting your role definitions into different tasks.<br />
Now you may wonder how you use this when deploying or whatever you do.</p>
<p>Just add those tasks as params to <strong>cap</strong>.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cap staging deploy:check<br />
cap staging deploy<br />
<span style="color: #666666; font-style: italic;"># or </span><br />
cap production deploy:check<br />
cap production deploy</div></td></tr></tbody></table></div>
<p></p>
<h3>And here is a little bonus</h3>
<p>Just to spice this up a bit I added another useful function. A little warning if you are about to deploy to your production environment. When running a big/important site you do not want to deploy into the wrong environment <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>This is how the final code looks.</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">desc <span style="color:#996600;">&quot;Run tasks in production enviroment.&quot;</span><br />
task <span style="color:#ff3333; font-weight:bold;">:production</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># Prompt to make really sure we want to deploy into prouction</span><br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;<span style="color:#000099;">\n</span><span style="color:#000099;">\e</span>[0;31m &nbsp; ######################################################################&quot;</span> <br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot; &nbsp; #<span style="color:#000099;">\n</span> &nbsp; # &nbsp; &nbsp; &nbsp; Are you REALLY sure you want to deploy to production?&quot;</span><br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot; &nbsp; #<span style="color:#000099;">\n</span> &nbsp; # &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Enter y/N + enter to continue<span style="color:#000099;">\n</span> &nbsp; #&quot;</span><br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot; &nbsp; ######################################################################<span style="color:#000099;">\e</span>[0m<span style="color:#000099;">\n</span>&quot;</span> <br />
&nbsp; proceed = STDIN.<span style="color:#CC0066; font-weight:bold;">gets</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span>..<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#0000FF; font-weight:bold;">nil</span> <br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">exit</span> <span style="color:#9966CC; font-weight:bold;">unless</span> proceed == <span style="color:#996600;">'y'</span> <span style="color:#006600; font-weight:bold;">||</span> proceed == <span style="color:#996600;">'Y'</span> <br />
&nbsp; <br />
&nbsp; <span style="color:#008000; font-style:italic;"># Production nodes </span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;192.168.1.30&quot;</span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;192.168.2.30&quot;</span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:db</span>, &nbsp;<span style="color:#996600;">&quot;192.168.1.30&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span> <br />
<br />
desc <span style="color:#996600;">&quot;Run tasks in staging enviroment.&quot;</span><br />
task <span style="color:#ff3333; font-weight:bold;">:staging</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># Staging nodes </span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:web</span>, <span style="color:#996600;">&quot;192.168.1.60&quot;</span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;192.168.2.60&quot;</span><br />
&nbsp; role <span style="color:#ff3333; font-weight:bold;">:db</span>, &nbsp;<span style="color:#996600;">&quot;192.168.1.60&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#0000FF; font-weight:bold;">true</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></td></tr></tbody></table></div>
<p>
When this code is used you will get something like the image below.<br />
<br />
<img src="http://www.pastbedti.me/wp-content/uploads/2009/01/deploying_to_production.png" alt="Warning when deploying to production" title="Warning when deploying to production" width="562" height="276" class="alignnone size-full wp-image-360" /></p>
<p>And thats all there is to it. The only thing that I think is missing is a warning/notice if you do not specify either production/staging. Like it is now you will get an error when capistrano cannot find any valid servers.</p>
<p>Happy deploying! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2009/01/handling-a-staging-environment-with-capistrano-rails/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>PostgreSQL logging with syslog-ng</title>
		<link>http://www.pastbedti.me/2008/12/postgresql-logging-with-syslog-ng/</link>
		<comments>http://www.pastbedti.me/2008/12/postgresql-logging-with-syslog-ng/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 22:25:16 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[pgFouine]]></category>
		<category><![CDATA[syslog ng]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=293</guid>
		<description><![CDATA[Today I where about to analyze a PostgreSQL database with the wonderful pgFouine. On the machine syslog-ng where installed as logging daemon and I have never worked with PostgreSQL logging and syslog-ng. This post is about how to get them to work together. pgFouine is pretty simple to setup and the process is where well [...]]]></description>
			<content:encoded><![CDATA[<p>Today I where about to analyze a PostgreSQL database with the wonderful <a href="http://pgfouine.projects.postgresql.org/">pgFouine</a>. On the machine syslog-ng where  installed as logging daemon and I have never worked with PostgreSQL logging and syslog-ng. This post is about how to get them to work together. </p>
<p><span id="more-293"></span></p>
<p>pgFouine is pretty simple to setup and the process is where well documented at their website (<a href="http://pgfouine.projects.postgresql.org/tutorial.html">http://pgfouine.projects.postgresql.org/tutorial.html</a>).</p>
<p>However syslog-ng is very different if you are used to &#8220;normal&#8221; syslog daemon. </p>
<p>The first thing you have to do is setup PostgreSQL as the instructions says on the website. The next step is to tell syslog-ng to log you postgres data to a separate file.</p>
<p>The first thing to create in syslog-ng.conf is a destination. Destination blocks is used to send logs somewhere.</p>
<p>By adding the following row we tell syslog-ng that there is a destination called postgres and that we want this data in /var/log/pgsql.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">destination postgres <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #c20cb9; font-weight: bold;">file</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;/var/log/pgsql&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #7a0874; font-weight: bold;">&#125;</span>;</div></td></tr></tbody></table></div>
<p>Now we are ready to add a filter to caputre our PostgreSQL data. Filters can both be used to include or exclude data from you logs. The following row in your syslog-conf captures all data sent to local0 or whatever you called it in postgresql.conf <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">filter f_postgres <span style="color: #7a0874; font-weight: bold;">&#123;</span> facility<span style="color: #7a0874; font-weight: bold;">&#40;</span>local0<span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #7a0874; font-weight: bold;">&#125;</span>;</div></td></tr></tbody></table></div>
<p>It&#8217;s time to join our destination with our filter and the following line tells syslog-ng to join our source, destination and filter together.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">log { source(src); filter(f_postgres); destination(postgres); };</div></td></tr></tbody></table></div>
<p>Put these lines in your syslog-ng.conf and restart syslog-ng and also PostgreSQL and you will have logging in a separate file! </p>
<p>Next step is to write a little guide to pgFouine <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/12/postgresql-logging-with-syslog-ng/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ruby enterprise edition (REE) on Gentoo failed and some performance experience.</title>
		<link>http://www.pastbedti.me/2008/12/ruby-enterprise-edition-ree-on-gentoo-failed-and-some-performance-experience/</link>
		<comments>http://www.pastbedti.me/2008/12/ruby-enterprise-edition-ree-on-gentoo-failed-and-some-performance-experience/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 20:44:36 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby_enterprise]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=280</guid>
		<description><![CDATA[Today I got the chance to give Ruby Enterprise Edition a try. We are currently working with a really fun new environment and you do not get better opportunities to try new stuff as when you have a complete new environment thats not in production. So we gave REE a shoot. When compiling REE with got in trouble really fast and this [...]]]></description>
			<content:encoded><![CDATA[<p>Today I got the chance to give <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a> a try. We are currently working with a really fun new environment and you do not get better opportunities to try new stuff as when you have a complete new environment thats not in production. So we gave REE a shoot. When compiling REE with got in trouble really fast and this post is about the quick fix to solve it and some of our early performance results.</p>
<p><span id="more-280"></span></p>
<p>The installation of REE is nothing more that unpacking ruby-enterprise-1.8.6-20081205.tar.gz and the run the installer.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">tar</span> xzvf ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span>.tar.gz</div></td></tr></tbody></table></div>
<p>And after that we run</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #000000; font-weight: bold;">/</span>ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span><span style="color: #000000; font-weight: bold;">/</span>installer</div></td></tr></tbody></table></div>
<p>This is when our problems started.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> g+r,o+r,o-w <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span><span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<br />
<span style="color: #660033;">--------------------------------------------</span><br />
Installing RubyGems...<br />
<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby setup.rb <span style="color: #660033;">--no-ri</span> <span style="color: #660033;">--no-rdoc</span><br />
<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby: no such <span style="color: #c20cb9; font-weight: bold;">file</span> to load <span style="color: #660033;">--</span> auto_gem <span style="color: #7a0874; font-weight: bold;">&#40;</span>LoadError<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">***</span> Cannot <span style="color: #c20cb9; font-weight: bold;">install</span> RubyGems</div></td></tr></tbody></table></div>
<p>This one took some time to find but first I could not understand why auto_gem was not found and also why it tried to load auto_gem when the installation of rubygems is not done.</p>
<p>After a few minutes of thinking and digging i found my environment variable RUBYOPT which was set to -rauto_gem.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">RUBYOPT</span>=-rauto_gem</div></td></tr></tbody></table></div>
<p>This one makes rubygems to autoload when you run something in ruby. I already had this line because i had ruby/rubygems installed before we installed REE. I still want this enviroment but not during the installation so i disabled it by starting the installer like this:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">RUBYOPT</span>=<span style="color: #ff0000;">&quot;&quot;</span> .<span style="color: #000000; font-weight: bold;">/</span>ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span><span style="color: #000000; font-weight: bold;">/</span>installer</div></td></tr></tbody></table></div>
<p>Passing the environment variable before the command just sets it for this command.</p>
<p>If you do want this change permanent some digging in /etc found there is no less that 3 files where this variable is set <em>(depending of shells)</em>.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-R</span> <span style="color: #ff0000;">&quot;RUBYOPT&quot;</span> <span style="color: #000000; font-weight: bold;">*</span><br />
csh.env:setenv RUBYOPT <span style="color: #ff0000;">'-rauto_gem'</span><br />
env.d<span style="color: #000000; font-weight: bold;">/</span>10rubygems:<span style="color: #007800;">RUBYOPT</span>=<span style="color: #ff0000;">&quot;-rauto_gem&quot;</span><br />
profile.env:export <span style="color: #007800;">RUBYOPT</span>=<span style="color: #ff0000;">'-rauto_gem'</span></div></td></tr></tbody></table></div>
<p>After changing this variable everything worked as expected! </p>
<p>So far our experience with REE is great. With plain old ruby we where running about 15 <a href="http://www.modrails.com/">passenger (mod_rails)</a> instances and we where using around 1.6GB memory. After The ruby enterprise upgrade we are now using 26 instances with only 1.7GB memory. CPU loads when stressing seems to be 50% less with REE and pages load times are much more stable.</p>
<p>You have to take these measurements with a bit of salt because we only had around an hour of testing but they seem pretty impressive so far.</p>
<p>I will get back with more performance data as we play.</p>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/12/ruby-enterprise-edition-ree-on-gentoo-failed-and-some-performance-experience/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Reset/recover MySQL root password in freebsd</title>
		<link>http://www.pastbedti.me/2008/11/resetrecover-mysql-root-password-in-freebsd/</link>
		<comments>http://www.pastbedti.me/2008/11/resetrecover-mysql-root-password-in-freebsd/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 14:49:16 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[passwords]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=219</guid>
		<description><![CDATA[This is a little memory note for my self and hopefully it can help someone else how to reset MySQL root password. It happens that we are asked to do some work on our customers dedicated servers and when that happens it&#8217;s not that uncommon that there is not a single person alive that has [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is a little memory note for my self and hopefully it can help someone else how to reset MySQL root password.</em> </p>
<p>It happens that we are asked to do some work on our customers dedicated servers and when that happens it&#8217;s not that uncommon that there is not a single person alive that has the root password for the MySQL server. When that happen it&#8217;s good to know how to reset it <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>This post is about how simple it&#8217;s to reset MySQL&#8217;s root password under FreeBSD.<br />
<span id="more-219"></span></p>
<p>The first step is to start MySQL without it&#8217;s grant tables.</p>
<p>Under FreeBSD you pass your mysql startup parameters in /etc/rc.conf</p>
<p>Add the following to /etc/rc.conf. We add &#8211;skip-networking to because we do not want someone from the outside to connect without passwords to our server.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">mysql_enable</span>=<span style="color: #ff0000;">&quot;YES&quot;</span><br />
<span style="color: #007800;">mysql_args</span>=<span style="color: #ff0000;">&quot;--skip-grant-tables --skip-networking&quot;</span></div></td></tr></tbody></table></div>
<p>And then restart MySQL with the following command.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>mysql-server restart</div></td></tr></tbody></table></div>
<p>When MySQL comes back online it&#8217;s running without grant tables which means that you do not have to use a password to connect to it (no one has to).</p>
<p>Simply connect as root (without password) and issue the following SQL query.</p>
<div class="codecolorer-container sql twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&gt;</span> mysql <span style="color: #66cc66;">-</span>u root mysql<br />
<br />
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">UPDATE</span> mysql<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span> <span style="color: #993333; font-weight: bold;">SET</span> Password<span style="color: #66cc66;">=</span>PASSWORD<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'&lt;Your new password&gt;'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #993333; font-weight: bold;">USER</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'root'</span>;</div></td></tr></tbody></table></div>
<p>Now we are almost done. Just comment the skip-grant-tables line from rc.conf and restart MySQL and you should have a brand new root password. </p>
<p>For for other *nix users the process is the same except from how you pass your MySQL params to MySQL at startup. You can also start MySQL manually with something like this.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;</span>path to safe_mysqld<span style="color: #000000; font-weight: bold;">&gt;/</span>safe_mysqld <span style="color: #660033;">--user</span>=mysql <span style="color: #660033;">--skip-grant-tables</span> <span style="color: #660033;">--skip-networking</span> <span style="color: #000000; font-weight: bold;">&amp;</span></div></td></tr></tbody></table></div>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/11/resetrecover-mysql-root-password-in-freebsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Password protecting folders with nginx gotcha</title>
		<link>http://www.pastbedti.me/2008/11/password-protecting-folders-with-nginx-gotcha/</link>
		<comments>http://www.pastbedti.me/2008/11/password-protecting-folders-with-nginx-gotcha/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 23:30:10 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[passwords]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=123</guid>
		<description><![CDATA[Today I was playing with nginx&#8217;s flv module. The page I made where private enough to password protect so i thought it would be great opportunity to learn how to do this with nginx. When password protecting folders with apache I usually do something like this 123456&#60;Location /secret&#62; &#160; &#160; AuthType Basic &#160; &#160; AuthName &#34;Restricted Directory&#34; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was playing with nginx&#8217;s <a href="http://wiki.codemongers.com/NginxHttpFlvStreamModule">flv module</a>. The page I made where private enough to password protect so i thought it would be great opportunity to learn how to do this with nginx.</p>
<p><span id="more-123"></span></p>
<p>When <a href="http://httpd.apache.org/docs/2.0/howto/auth.html">password protecting folders with apache</a> I usually do something like this</p>
<div class="codecolorer-container apache twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;<span style="color: #000000; font-weight:bold;">Location</span> /secret&gt;<br />
&nbsp; &nbsp; <span style="color: #00007f;">AuthType</span> Basic<br />
&nbsp; &nbsp; <span style="color: #00007f;">AuthName</span> <span style="color: #7f007f;">&quot;Restricted Directory&quot;</span><br />
&nbsp; &nbsp; <span style="color: #00007f;">AuthUserFile</span> /usr/local/apache/.htpasswd<br />
&nbsp; &nbsp; <span style="color: #00007f;">Require</span> <span style="color: #00007f;">user</span> billg<br />
&lt;/<span style="color: #000000; font-weight:bold;">Directory</span>&gt;</div></td></tr></tbody></table></div>
<p>This code protects the folder named secret and everything below it.<br />
 <br />
Ok, get back get to nginx already!</p>
<p>Nginx also have a <a href="http://wiki.codemongers.com/NginxHttpCoreModule#location">location</a> module and this is how i first started out.</p>
<div class="codecolorer-container apache twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">location = /secret {<br />
&nbsp; &nbsp; auth_basic <span style="color: #7f007f;">&quot;Restricted&quot;</span>;<br />
&nbsp; &nbsp; auth_basic_user_file /etc/nginx/htpass;<br />
}</div></td></tr></tbody></table></div>
<p>First this seemed like a good idea. Accessing /secret got me authenticate and thats good. BUT! Accessing files below /secret like /secret/image.gif skipped authentication. </p>
<p>Using that equal sign was a big mistake. Equal sign matches exactly that string and nothing else. </p>
<p>To get this example working the way i want (just like the apache example) we have two ways to go. </p>
<p>1. We dump the equal sign,<br />
2. We change the equal sign to a regular-expression sign (~).</p>
<p>Before choosing 1 or 2 you should know that when choosing 1. Rules with regular expressions and any longer conventional blocks will be matched before your rule. So my suggestion is to use a regular expression match so that nginx halts the search.</p>
<p>Alt 1.</p>
<div class="codecolorer-container apache twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">location /secret {<br />
&nbsp; &nbsp; auth_basic <span style="color: #7f007f;">&quot;Restricted&quot;</span>;<br />
&nbsp; &nbsp; auth_basic_user_file /etc/nginx/htpass;<br />
}</div></td></tr></tbody></table></div>
<p>Alt 2.</p>
<div class="codecolorer-container apache twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">location ~ ^/secret {<br />
&nbsp; &nbsp; auth_basic <span style="color: #7f007f;">&quot;Restricted&quot;</span>;<br />
&nbsp; &nbsp; auth_basic_user_file /etc/nginx/htpass;<br />
}</div></td></tr></tbody></table></div>
<p>Happy password protecting! </p>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/11/password-protecting-folders-with-nginx-gotcha/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Gentoo/Linux freezing under VMware ESX/ESXi</title>
		<link>http://www.pastbedti.me/2008/11/gentoolinux-freezing-under-vmware-esxesxi/</link>
		<comments>http://www.pastbedti.me/2008/11/gentoolinux-freezing-under-vmware-esxesxi/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 22:02:58 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Operatingsystem]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=117</guid>
		<description><![CDATA[We recently got in trouble with two Gentoo machines that where running under VMware ESX &#38; ESXi. The hosts froze randomly (Even the console in vmware froze). Especially when putting a little load on the machines. After hours of testing we found that removing virtual CPU&#8217;s from the host solved the problem. More that one CPU got [...]]]></description>
			<content:encoded><![CDATA[<p>We recently got in trouble with two <a title="Gentoo" href="http://www.gentoo.org/">Gentoo</a> machines that where running under VMware ESX &amp; ESXi.</p>
<p>The hosts froze randomly (<em>Even the console in vmware froze</em>). Especially when putting a little load on the machines. After hours of testing we found that removing virtual CPU&#8217;s from the host solved the problem. More that one CPU got the machine to freeze after some time.</p>
<p><strong>!! Unsatisfied solution !!</strong> So after a couple of more hours we found a working solution&#8230;.</p>
<p><span id="more-117"></span></p>
<p>The solution was to disable the time stamp counter hardware in the host. This is done by passing <strong>notsc</strong> on the kernel command line. </p>
<p>We found people running <a title="Ubuntu" href="http://www.ubuntu.com/">Ubuntu </a>with a similar problem and some of them solved the problem with passing clocksource=acpi_pm on the kernel command line. The clocksource problem is known by VMware and more information can be found here <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1007020">http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1007020</a>. This did however not solved our problem but some readers may find it helpful. </p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/11/gentoolinux-freezing-under-vmware-esxesxi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Putting a WordPress blog behind a nginx frontend (with a bit of cheating)</title>
		<link>http://www.pastbedti.me/2008/07/putting-a-wordpress-blog-behind-a-nginx-frontend-with-a-bit-of-cheating/</link>
		<comments>http://www.pastbedti.me/2008/07/putting-a-wordpress-blog-behind-a-nginx-frontend-with-a-bit-of-cheating/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 21:12:10 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.stjernstrom.se/?p=16</guid>
		<description><![CDATA[This is how I did a quick fix for a client of ours that are running a Ruby On Rails app behind an nginx/mongrel setup. The mission where to move their wordpress weblog to the same server as the website. The easiest way had been to add another IP and install apache behind it. They [...]]]></description>
			<content:encoded><![CDATA[<p>This is how I did a quick fix for a client of ours that are running a Ruby On Rails app behind an <a href="http://nginx.net/" target="_blank">nginx</a>/<a href="http://mongrel.rubyforge.org/" target="_blank">mongrel</a> setup.</p>
<p><strong>The mission where to move their <a href="http://wordpress.org/" target="_blank">wordpress</a> weblog to the same server as the website.</strong></p>
<p>The easiest way had been to add another IP and install apache behind it. They did not like this solution because they thought they where about to loose google page-rank if the blog and the website where on different ip&#8217;s. ok, Fair enough.</p>
<p>The simple solution became to install apache and just proxy the request thought nginx.</p>
<p><span id="more-16"></span></p>
<p><a href="http://wiki.codemongers.com/NginxHttpProxyModule" target="_blank">proxying</a> with nginx cannot be any easier&#8230;. the first try.</p>
<p>Apache is listening on 127.0.0.1:8080 and we want /blog to be proxied to apache.</p>
<div class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; location /blog/ {<br />
&nbsp; &nbsp;proxy_pass &nbsp; &nbsp; &nbsp; http://127.0.0.1:8080/;<br />
&nbsp; }</div></td></tr></tbody></table></div>
<p>This seemed like a good idea but when apache gets this request the hostname is 127.0.0.1 and wordpress will not like that and will redirect to the host-name that we had setup in wordpress. Just as i write this post i realize that i could just have changed that to 127.0.0.1 and we had been done. </p>
<p>Sometimes you can&#8217;t see the Forest because of the trees&#8230; </p>
<p>I tok me a wile to figure that we where redirected again by wordpress so my solution became this:</p>
<div class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; location /blog/ {<br />
&nbsp; &nbsp;proxy_set_header Host www.example.se;<br />
&nbsp; &nbsp;proxy_pass &nbsp; &nbsp; &nbsp; http://127.0.0.1:8080/;<br />
}</div></td></tr></tbody></table></div>
<p>This make nginx set a Host header with each request so that apache think we are always on the correct host&#8230;  Even doe we can solve this by setting 127.0.0.1 in wordpress this can be usefull if you have more that one wordpress installation behind nginx .</p>
<p>Happy hacking!</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/07/putting-a-wordpress-blog-behind-a-nginx-frontend-with-a-bit-of-cheating/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

