1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
|
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LamsonProject: Deploying Lamson Level 1</title>
<link rel="stylesheet" href="/styles/global.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="/css/code.css" type="text/css" charset="utf-8" />
<!--[if IE 7]>
<style type="text/css" media="screen">
div#column_left ul.sidebar_menu li div.color{
display: none;
}
</style>
<![endif]-->
<link href="/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/prettify.js"></script>
</head>
<body onload="prettyPrint()">
<div id="content_centered">
<div id="header">
<h1><img id="logo" src="/images/lamson.png" alt="Lamson Project(TM) - Pipes and aliases are so 1970." /></h1>
<ul id="header_menu">
<li><a href="/">Home</a></li>
<li><a href="/blog/">News</a></li>
<li><a href="/feed.xml">Feed</a></li>
<li><a href="/download.html">Download</a></li>
<li><a href="/docs/">Documentation</a></li>
<li><a href="/docs/api/">API</a></li>
</ul>
</div>
<div id="main_content">
<h1>Deploying Lamson Level 1</h1>
<p>These instructions will teach you how to setup a completely clean Python 2.6
installation, a virtualenv with lamson, and all the gear needed to run the
<a href="http://oneshotblog.com/">oneshotblog.com</a> software on your machine.</p>
<p>You can then <a href="/docs/deploying_oneshotblog.html">read how to install oneshotblog</a>
for yourself.</p>
<p>Most of these instructions could be easily turned into an automated script,
which may happen in the future. For now it is meant to teach you about the
typically dirty details involved in setting up a system for the first time. It
also tries to avoid various problems with different operating systems, so let
me know how it works for you.</p>
<h2>A Warning</h2>
<p>Deploying server software is a notoriously nasty process, especially the first
10 or 20 times. Most operating systems do their best to enforce completely
arbitrary restrictions on your file layouts and configurations, and every
system has different arbitrary restrictions.</p>
<p>When you go through these instructions, make sure you stay awake and be ready
to delve into why a particular step might not work on your system. There’s a
good chance you missed something or that there’s something just slightly
different about your system that makes the step not work.</p>
<p>For example, in the parts of this document where I setup
<a href="http://oneshotblog.com/">oneshotblog.com</a> I ran into a problem with
<a href="http://spambayes.sourceforge.net/">SpamBayes</a> dying because it couldn’t iterate
a bsddb. Problem is this works just fine in the exact same setup on a CentOS
machine and was only dying on a MacOSX machine that I later tested. For
whatever reason, the exact same setup can’t run SpamBayes on <span class="caps">OSX</span>, even though
it can run with the stock Python 2.5 in <span class="caps">OSX</span>.</p>
<p>To solve the problem I just had to show you how to disable SpamBayes in the
oneshotblog.com code so you could test it. That’s just how deployment goes.
You get on a machine and start setting things up and then 2/3 of the way
through the configuration you find out that something doesn’t work.</p>
<p>Only choices are to work around the problem (like I did) or try to figure out
why your machine is different and fix it.</p>
<h2>Step 0: Setup A Workplace</h2>
<p>You’ll want a directory to do this in so that you don’t screw up your machine.
Here’s what I did:</p>
<pre class="code">
$ mkdir deploy
$ cd deploy
$ export DEPLOY=$PWD
</pre>
<p>That last bit is so you can refer to this deployment directory with $<span class="caps">DEPLOY</span>
(which I’ll be using in the instructions from now on).</p>
<h2>Step 1: Get Python</h2>
<p>Many operating systems have old versions of Python, and even though Lamson
works with 2.6 or 2.5, you’ll probably want to get 2.6 for your deployment. If
your OS has 2.6 available then go ahead and install it.</p>
<p>If it doesn’t have the right Python version, then here’s how you can install it
from source and use it as your default Python. To do this, just punch in these
commands:</p>
<pre class="code">
$ mkdir source
$ cd source
$ wget http://www.python.org/ftp/python/2.6.2/Python-2.6.2.tgz
$ tar -xvf Python-2.6.2.tgz
$ cd Python-2.6.2
$ ./configure --prefix=$DEPLOY
$ make
$ make install
</pre>
<p>After this you will have a bunch of new directories in $DEPLOY:</p>
<pre class="code">
$ ls $DEPLOY
bin include lib share source
</pre>
<p>Finally, you just have to put this new bin directory into your $PATH:</p>
<pre class="code">
$ export PATH=$DEPLOY/bin:$PATH
</pre>
<p>... then you just try it out to make sure that you have the right one:</p>
<pre class="code">
Python-2.6.2 $ which python
$DEPLOY/deploy/bin/python
Python-2.6.2 $ python
Python 2.6.2 (r262:71600, Jun 8 2009, 00:44:56)
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
</pre>
<p>That’s it, you’ll now be able to use this Python when you need to run your
Lamson server, and setup a virtualenv (coming next) so that you’re walled off
from the rest of the system.</p>
<blockquote>
<p> Operating system fanatics will scoff at putting the python install in this
directory, so if you want you can just install it to the default /usr/local on
your system and deal with all the various clashes and conflicts you’ll have,
especially if you are on an MacOSX machine.</p>
</blockquote>
<h2>Step 2: Install VirtualEnv</h2>
<p>Now we need to create a “virtual environment” to install all your software. To
do this we’ll need easy_install installed to your $<span class="caps">DEPLOY</span> directory:</p>
<pre class="code">
$ cd $DEPLOY/source
$ wget http://peak.telecommunity.com/dist/ez_setup.py
$ python ez_setup.py
$ which easy_install
$DEPLOY/bin/easy_install
</pre>
<p>As you can see, you now have a clean install of easy_install in your fresh
$DEPLOY/bin directory for you to use. Now you need to install <code>virtualenv</code>:</p>
<pre class="code">
$ easy_install --prefix $DEPLOY virtualenv
$ which virtualenv
$DEPLOY/bin/virtualenv
</pre>
<blockquote>
<p>Make sure you use <code>--prefix $DEPLOY</code> above or you’ll install things into
the default system setup even though easy_install is clearly and obviously
running from a Python in a totally different location so easy_install should
know that.</p>
</blockquote>
<h2>Step 3: Create Your VirtualEnv</h2>
<p>With that you are ready to setup your virtual environment which will house your
Lamson setup and fill it with the gear you need.</p>
<p>First up is getting your virtualenv created and activated:</p>
<pre class="code">
$ cd $DEPLOY
$ virtualenv LAMSON
New python executable in LAMSON/bin/python
Installing setuptools............done.
$ cd LAMSON
$ . bin/activate
</pre>
<p>That’s pretty simple, and it tells you clearly that you are using the <span class="caps">LAMSON</span>
virtualenv. It prepends that to your currently prompt, so your prompt may look
different.</p>
<p>After that we can use easy_install to install our packages to this <span class="caps">LAMSON</span>
virtual env. Keep in mind that these packages will be in $DEPLOY/<span class="caps">LAMSON</span>, so
they won’t infect your regular $<span class="caps">DEPLOY</span> setup.</p>
<pre class="code">
$ cd $DEPLOY/LAMSON
$ easy_install lamson
</pre>
<p>After that, you have lamson installed and ready to go, and you can install
anything you want, but there is one catch:</p>
<blockquote>
<p>You <strong>MUST</strong> be in the $DEPLOY/<span class="caps">LAMSON</span> directory or easy_install barfs
complaining that the package is not there.</p>
</blockquote>
<h2>Step 4: Making Sure It Works</h2>
<p>All of this setup is pointless if you can’t get back to it later, so exit your
terminal completely and start a new one so you can do this:</p>
<pre class="code">
$ cd projects/lamson/deploy/
$ export DEPLOY=$PWD
$ export PATH=$DEPLOY/bin:$PATH
$ cd $DEPLOY/LAMSON
$ . bin/activate
(LAMSON) $ which python
$DEPLOY/deploy/LAMSON/bin/python
(LAMSON) $ which easy_install
$DEPLOY/deploy/LAMSON/bin/easy_install
(LAMSON) $ which lamson
$DEPLOY/deploy/LAMSON/bin/lamson
(LAMSON) $ cd $DEPLOY
(LAMSON) $ lamson help
</pre>
<p>If you can do all that, then you know you’ve got the setup going, now you just
need a little shell script to kick this all into gear automatically:</p>
<pre class="code prettyprint">
#!/bin/sh
export DEPLOY=$PWD
export PATH=$DEPLOY/bin:$PATH
cd $1
source bin/activate
cd $DEPLOY
</pre>
<p>To use this script, you just do this:</p>
<pre class="code">
$ cd projects/lamson/deploy
$ . activate LAMSON
</pre>
<p>With that you have a fully ready to go setup that’s not using your normal
system’s Python at all, has Python 2.6 installed, a fully virtualenv, and the
start of your lamson setup.</p>
<h2>Conclusion</h2>
<p>Your next step is to try and setup <a href="http://oneshotblog.com/">oneshotblog</a> using
the <a href="/docs/deploying_oneshotblog.html">instructions I’ve written</a> to follow
these instructions.</p>
<p>This document is very fresh, so send me feedback on your experience with
running through it. Make sure you tell me what system you are on and that you
ran each command exactly when you do.</p>
</div>
<div id="column_left">
<ul class="sidebar_menu">
<li>
<div class="item">
<div class="color" style="background-color: #ff0000;"> </div>
<a href="/blog/">Latest News</a>
</div>
</li>
<li>
<div class="item">
<div class="color" style="background-color: #ff9900;"> </div>
<a href="/download.html">Download the Gear</a>
</div>
</li>
<li>
<div class="item">
<div class="color" style="background-color: #99cc00;"> </div>
<a href="/docs/getting_started.html">Getting Started</a>
</div>
</li>
<li>
<div class="item">
<div class="color" style="background-color: #3399ff;"> </div>
<a href="/docs/">Documentation</a>
</div>
</li>
<li>
<div class="item">
<div class="color" style="background-color: #ff3399;"> </div>
<a href="/docs/faq.html">Frequently Asked Questions</a>
</div>
</li>
<li>
<div class="item">
<div class="color" style="background-color: #006699;"> </div>
<a href="/about.html">About Lamson</a>
</div>
</li>
<li>
<div class="item">
<div class="color" style="background-color: #0099cc;"> </div>
<a href="/contact.html">Getting Help with Lamson</a>
</div>
</li>
</ul>
<div class="sidebar_item">
<h3>Quick Start</h3>
<p>See the download instructions for information on getting lamson, and read the getting started instructions to start your own application in less than 10 minutes.</p>
</div>
<br/>
<div class="sidebar_item">
<h3>Mailing Lists</h3>
<p>Lamson hosts its own <a href="/lists/">mailing lists</a> as well as provides a free open mailing list
service for anyone who needs one. Simply send an email to the list you want @librelist.com and it will
get you started.</p>
</div>
</div>
<div id="footer">
<div class="footer_content">
Lamson Project(TM) and all material on this site Copyright © 2009 <a href="http://zedshaw.com/" title="Zed Shaw's blog">Zed Shaw</a> unless otherwise stated.<br/>
Website Designed by <a href="http://kenkeiter.com/">Kenneth Keitner</a> and donated to the LamsonProject.
</div>
</div>
<!-- end:centered_content -->
</div>
</body>
</html>
|