On 3/7/07, Christoph Haas <[EMAIL PROTECTED]> wrote:
> Hi, list...
>
> This thread is connected to the "Deploying Pylons applications as Debian
> packages just that I would like to suspend discussing whether the Debian
> package management system or easy_install is better for the moment. :) I'm
> trying to provide an easy way to deploy Pylons projects as Debian packages
> and thus have written a little Python program to add a debian/ directory
> to an existing Pylons project that allows the project to be built into a
> Debian package. That raises a few questions which - as I just learned on
> IRC - are not only Debian-specific but touch the deployment process
> altogether. So I decided to take it to the list again.
>
> First of all: the script is located at http://workaround.org/pylons. I'm
> looking forward to your comments.
>
> To build the actual Debian package I run these steps:
>
> python${PYVER} setup.py install \
> --root debian/${PACKAGE} \
> --single-version-externally-managed
>
> mv
> debian/${PACKAGE}/usr/lib/python${PYVER}/site-packages/${EGG}-${DEB_UPSTREAM_VERSION}-py${PYVER}.egg-info
> \
> debian/${PACKAGE}/usr/lib/python${PYVER}/site-packages/${EGG}-${DEB_UPSTREAM_VERSION}.egg-info
>
> And it looks like the application is well contained within the resulting
> Debian package. All that's missing is the "production.ini". I wondered
> where it comes from. David (Smith) told me that the template for ini files
> is located under "dnsdhcp.egg-info/paste_deploy_config.ini_tmpl" which is
> true. But that file is only created when building an egg - but not when
> running just "python2.4 setup.py install".
>
> Whose job is it to create the ini file? David said that usually Pylons
> applications are just eggs and that the web server administrator sets up
> the paster and the production.ini file referring to all the Pylons
> applications he/she desires to run. Currently (and also because I'm scared
> by Paste because I don't have a complete picture of what it is or does) I
> would want the Debian package to provide an example production.ini file
> for a Pylons application and provide init.d scripts that launch "paster
> serve" from that ini file.
>
> I just tried "paster make-config --no-install helloworld production.ini"
> but that got an exception "Some #directives are missing their corresponding
> #end ___ tag: cache". I think the template is broken somehow.
>
> David also scared me a bit on IRC when he said that the setuptools
> deployment is not perfect. Are there arguments against the above way to
> distribute Pylons projects? After all I'd like my project to run well on a
> server without playing around. Copying the files and launching the "paster
> serve" server from the shell is not really an option. I'm eager to hear
> your opinions about it. There has to be a common way to deploy Pylons
> applications. Somewhere...
>
> I'm really willing to follow a cryptic procedure. Or even help document it.
> But currently I'm just anxious to run Pylons for production applications.
> It doesn't "feel" like I have a proper way to run them in
> production. "paster serve --reload ..." is nice on my workstation. But
> that's just for development. I can't seriously tell that to the web admin.
>
> Christoph
>
> P.S.: /me wonders if TurboGears has better/clearer deployment mechanisms.
Very briefly:
The .ini file is site-specific. Just like Debian admins have to
modify Apache configs, they also have to create and modify .ini's.
As far as running a daemon, I use "runit".
I'm not sure this is helpful to you, but here is a log of my
activities on my most recent server build:
easy_install "pylons==0.9.3":
Pylons-0.9.3-py2.4.egg
easy_install genshi:
Genshi-0.3.6-py2.4.egg
easy_install nose:
nose-0.9.1-py2.4.egg
easy_install my_own_application_eggs...
Setup explorer (the name of my app):
mkdir /home/explorer
mkdir /var/tmp/explorer
chown www-data:www-data /var/tmp/explorer
cd /home/explorer
paster make-config explorer explorer-production.ini
vi explorer-production.ini # Setup parameters.
# host: 127.0.0.1
# I'm proxying to Apache, which I'm not covering here.
paster setup-app explorer-production.ini
Setup runit:
cd /var/service
mkdir explorer
cp ~jj/work/foxmarks/src/foxmarks/apps/common/lookandfeel/run-pylons-app.sh \
/home/explorer/
ln -s /home/explorer/run-pylons-app.sh explorer/run
Restart the apps as necessary:
sv restart explorer
Setup logging:
mkdir explorer/log
cat > explorer/log/run << __END__
#!/bin/sh
exec 2>&1
exec chpst -u nobody:nogroup svlogd logs
__END__
chmod +x explorer/log/run
killall runsv # Per Dave, using "sv restart" is not enough.
easy_install -U pylons:
+Pylons-0.9.4.1-py2.4.egg
+Beaker-0.6.2-py2.4.egg
+Routes-1.6.2-py2.4.egg
When upgrading explorer, remember to:
easy_install "the eggs"
cd /home/explorer
paster setup-app explorer-production.ini
sv restart explorer
Here's the script run-pylons-app.sh mentioned above:
#!/bin/sh
#
# This script is called by runit.
#
# WARNING: All the Pylons applications should use this same script, each
# creating a symlink to it from /var/service/$APP/run.
#
# Start up the Pylons application named $APP per the directory name above. Run
# as "www-data" from within the application's directory in /home/$APP.
#
exec 2>&1
APP=`basename $PWD`
cd /home/$APP
exec paster serve --user www-data --group www-data $APP-production.ini
I'm not pronouncing this as *the way* to run Pylons applications on
Debian. I'm just telling you how I do it. I'm sure someone else has
probably written up better instructions somewhere else.
Happy Hacking!
-jj
--
http://jjinux.blogspot.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---