<?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>My Wushu Blog &#187; Apache</title>
	<atom:link href="http://www.mywushublog.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mywushublog.com</link>
	<description></description>
	<lastBuildDate>Wed, 28 Jul 2010 05:05:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Setting up my own OpenID server</title>
		<link>http://www.mywushublog.com/2009/02/setting-up-my-own-openid-server/</link>
		<comments>http://www.mywushublog.com/2009/02/setting-up-my-own-openid-server/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 04:15:05 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[OpenID]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Tomcat 6]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=167</guid>
		<description><![CDATA[I&#8217;ve configured this blog to use my OpenID accounts. I have two (which totally goes against the single identity mindset of OpenID ) http://mcarlson.myopenid.com/ http://openid.evil-genius-network.com/mike The second one I just stood up today. I&#8217;m always concerned with who has my information, and if I can, I try to keep it all within the realm of my control. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve configured this blog to use my OpenID accounts. I have two (which totally goes against the single identity mindset of OpenID <img src='http://www.mywushublog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<ul>
<li><a href="http://mcarlson.myopenid.com/">http://mcarlson.myopenid.com/</a></li>
<li><a href="http://openid.evil-genius-network.com/mike">http://openid.evil-genius-network.com/mike</a></li>
</ul>
<p>The second one I just stood up today. I&#8217;m always concerned with who has my information, and if I can, I try to keep it all within the realm of my control. Also, the evil genius domain has absolutely no purpose besides a testing ground that I have no problems destroying <img src='http://www.mywushublog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Using my own OpenID service is attractive, most of all its a fun exercise. Lets go through what I did (so one day I can remember).</p>
<p>The easiest part was finding an OpenID server. A quick google search brought me here:</p>
<p><a href="http://wiki.openid.net/Run_your_own_identity_server">http://wiki.openid.net/Run_your_own_identity_server</a></p>
<p>The hard part was deciding which one I should use. I actually tried out 4 of them, <a href="http://siege.org/projects/phpMyID">phpMyID</a>, <a href="http://dennisbloete.de/projects/masquerade/">Masquerade</a>, <a href="http://trac.nicolast.be/djangoid">DjangoID</a>, and finally, <a href="http://code.google.com/p/openid-server/">Java OpenID Server</a>. I got three of them running, and in the end I simply settled on JOS. For now. I had a lot of fun building a MCV app in both Ruby on Rails and Django. I&#8217;ve been on a MCV kick, as a month ago I got pretty excited about Ruby on Rails. The big part where I shy away from Django or RoR is integrating things into Apache. With Java, I have Tomcat, and I&#8217;ve used it before so I have an immediate comfort level with it. I did have to ask <a href="http://www.titan-project.org/">Chris</a> for a little bit of help when it came to the mod_jk stuff.</p>
<p>First thing was to go over the JOS documentation. I knew I would need the following:</p>
<ul>
<li>Java App Server &#8211; I decided to use Apache&#8217;s Tomcat 6.0</li>
<li>A database &#8211; PostgreSQL 8.3</li>
<li>JCalendar, this was simple, as the readme pointed me to one</li>
</ul>
<p>Over the years, I&#8217;ve always used MySQL. It&#8217;s simple, light, and all the new fancy &#8220;Web 2.0&#8243; site use it. I&#8217;m considering making the switch to PostgreSQL for two reasons. 1) Sun seems to be mishandling the QA and release engineering of MySQL . 2) Recent benchmarks with FreeBSD 7.1 and PostgreSQL have been phenomenally good, and even though I&#8217;m not running a big site with millions of visitors I do like to keep up with whats current and performs well.</p>
<p>Second, I built the required applications and enabled both tomcat and PostgreSQL in /etc/rc.conf. Think of rc.conf as a simple text-based chkconfig, except with rc.conf, you can specify additional command arguments, profile environment, and anything else the application might support. I like the ease of the chkconfig/service system works in Linux, but FreeBSD&#8217;s run command (rc) system is very flexible and easier to tune.</p>
<pre style="padding-left: 30px;">&gt; sudo su -
$ cd /usr/ports/databases/postgresql83-server
$ make install
$ echo 'postgresql_enable="YES"' >> /etc/rc.conf
$ cd /usr/ports/www/tomcat6
$ make install
$ echo 'tomcat60_enable="YES"' >> /etc/rc.conf
$ cd /usr/ports/databases/postgresql-jdbc
$ make install
</pre>
<p>I could have simply added pre-built packages with &#8220;pkg_add -r tomcat6 postgresql83-server postgresql-jdbc&#8221; but I like seeing what compile time options are available, and then setting those. Hurray for the flexibility of FreeBSD!</p>
<p>One thing that you have to do with PostgreSQL (that you don&#8217;t have to do with MySQL) is initialize the database/config:</p>
<pre style="padding-left: 30px;">$ initdb /usr/local/pgsql/data
$ su - pgsql
> createdb jos-openid
> makepasswd --chars=13
 a nice 13 character random string
> createuser josuser -P
> psql jos-openid 

Welcome to psql 8.3.6, the PostgreSQL interactive terminal. Type:
        \copyright for distribution terms
        \h for help with SQL commands
        \? for help with psql commands
        \g or terminate with semicolon to execute query
        \q to quit

jos-openid=# select * from pg_user;
  usename | usesysid | usecreatedb | usesuper | usecatupd |  passwd  | valuntil | useconfig
 ---------+----------+-------------+----------+-----------+----------+----------+-----------
  pgsql   |       10 | t           | t        | t         | ******** |          |
  josuser |    16386 | t           | f        | f         | ******** |          |
(2 rows)
jos-openid=#
</pre>
<p>Next, I had to unpack the war file and modify the jdbc.properties to use PostgreSQL</p>
<pre style="padding-left: 30px;">jar -xvf jos-webapp-1.2.0.war .
...
jar -cvf /usr/local/tomcat6/webapps/ROOT.war .
</pre>
<p>Yeah, after configuring the app and zipping it back up, I called it ROOT, it was a lot easier this way. I didn&#8217;t want to manage multiple java apps at this point. I can be a very lazy admin <img src='http://www.mywushublog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>After starting both Tomcat and PostgreSQL up, I now had a working web app running on my server at port 8180. The last part is to mount the java application inside of apache. For that, I needed to install mod_jk:</p>
<pre style="padding-left: 30px;">$ cd /usr/ports/www/mod_jk
$ make install
</pre>
<p>Thats the easy part of installing mod_jk, the next parts are the worker.properties file, modifying httpd.conf, and then modifying my virtualhost configuration for the domain evil-genius-network.com. I also added a record for openid.evil-genius-network.com. So, in that order, this is what I did:</p>
<p><strong>/usr/local/etc/apache2/worker.properties:</strong></p>
<pre style="padding-left: 30px;">
workers.tomcat_home=/usr/local/apache-tomcat6.0
workers.java_home=/usr/local/jdk1.6.0
ps=/
worker.list=localhost
worker.tomcat.type=lb
#worker.tomcat.balanced_workers=localhost
#worker.loadbalancer.local_worker_only=0
worker.localhost.port=8009
worker.localhost.host=localhost
worker.localhost.type=ajp13
worker.localhost.lbfactor=1</pre>
<p><strong>/usr/local/etc/apache2/httpd.conf:</strong></p>
<pre style="padding-left: 30px;">LoadModule jk_module libexec/apache22/mod_jk.so
# mod_jk
JkWorkersFile /usr/local/etc/apache22/workers.properties
JkLogFile  /var/log/jk.log
JkShmFile  /var/log/jk-runtime-status
JkLogLevel error
</pre>
<p><strong>/usr/local/etc/apache2/virtualhosts/evil-genius-network.com (in the openid.evil-genius-network.com VirtualHost section):</strong></p>
<pre style="padding-left: 30px;">JkMount /* localhost</pre>
<p>Then, I restarted apache:</p>
<pre style="padding-left: 30px;">$ /usr/local/etc/rc.d/apache2 restart</pre>
<p>Now, have my own little OpenID server running at <a href="http://openid.evil-genius-network.com/">http://openid.evil-genius-network.com/</a></p>
<p>BTW, I had to re-edit EVERY pre section of this page about 6 times, that was the least-fun part of all of this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2009/02/setting-up-my-own-openid-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
