jvandal / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

Add a download so users running cPanel software can install wsgi without having to break their apache conf #214

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I built an EasyApache addon for cPanel that install mod_wsgi version 3.3.1 I 
figured you guy might want to offer this to your users. For a user to install 
the addon which is attached they need to run the following command and mod_wsgi 
will be available in the EasyApache script

tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf ModWSGI.tar.gz

Original issue reported on code.google.com by challgren on 17 Nov 2010 at 11:25

Attachments:

GoogleCodeExporter commented 8 years ago
Of if you do not have python26 installed this will not work. If your a CentOS 
user you can add http://fedoraproject.org/wiki/EPEL to your yum repos and run 
"yum install python26-devel"

Original comment by challgren on 18 Nov 2010 at 12:06

GoogleCodeExporter commented 8 years ago
You shoudl post this on cPanel developer forums as well: 
http://forums.cpanel.net/developer-discussions.html

Original comment by annihili...@gmail.com on 18 Nov 2010 at 5:44

GoogleCodeExporter commented 8 years ago
Yep its at http://forums.cpanel.net/f5/mod_wsgi-easyapache-module-173501.html 
but the file is attached here.

Original comment by challgren on 18 Nov 2010 at 5:59

GoogleCodeExporter commented 8 years ago
Greetings,

One of our EasyApache developers recommended that instead of leaving a note 
that the module is not enabled for Apache 1.x, it should be made a "skip mod."  
Here's the diff he sent me:

  if ( $easy->get_ns_value_from_profile('Cpanel::Easy::Apache::1', $profile_hr) eq '1' ) {
-            $self_hr->{'note'}      = 'mod_wsgi is not enabled for Apache 1.X. 
You should really consider upgrading to Apache 2.x';
+          $self_hr->{'skip'} = 1; 
       }

If you have any questions, let me know.
- David Grega
Technical Product Specialist, cPanel

Original comment by cPanelDa...@gmail.com on 22 Nov 2010 at 7:35

GoogleCodeExporter commented 8 years ago
To clarify,

Setting skip to 1 means this module is always skipped when someone tries to 
compile this module into Apache 1.x.  That way this opt mod won't erroneously 
kill the entire build.

Original comment by cPanelDa...@gmail.com on 22 Nov 2010 at 9:14

GoogleCodeExporter commented 8 years ago
Thanks, yeah this was my first ever build for EasyApache so I'm learning. 
Attached is the newer build that skips on Apache 1.x

Original comment by challgren on 27 Nov 2010 at 12:41

Attachments:

GoogleCodeExporter commented 8 years ago
Challgren, this looks like nice work, thanks. However, I'm not clear on some 
things, maybe you (or someone else) can explain them to me. First, you mention 
that Python 2.6 (devel) needs to be installed - but one of the big problems 
I've been having with CentOS (from HostGator), is that they use Python 2.4 as 
the main install for everything, and I'm not supposed to break that :)

Question 1: How do you have Python 2.6 installed on your system?

Question 2: Is it possible to modify your ModWSGI.pm script to skip 
compilation, and just install my mod_wsgi.so module?

Question 3: Is this .pm file format documented anywhere? 

I actually am using virtualenv to maintain a stand-alone environment for using 
2.6 with various other packages - but as far as I can tell, if I ran your 
install script, it would use the *system default* Python, 2.4

I actually compiled mod_wsgi.so for Python 2.6, then discovered that just 
putting the module into EasyApache's custom_mods directory doesn't actually 
*do* anything :(

Thanks for any help. 

John C>

Original comment by cyclops@speakeasy.net on 27 May 2011 at 3:03

GoogleCodeExporter commented 8 years ago
I've been meaning to try this for a while and finally had a new server to test 
on. Unfortunately, I did not see any mention of mod_wsgi in the easy_apache 
setup screens (not sure whether I was supposed to). easy_apache ran to 
completion, but there was no mod_wsgi.so in my modules directory, and grepping 
the easy_apache log for mod_wsgi turned up nothing. It seems not to have seen 
the module at all. 

I've got python2.7 installed in /usr/local/bin - not sure whether that could be 
related. Any more hints or documentation you can offer? Would really like to 
get this going. Thanks.

Original comment by shacker....@gmail.com on 11 Aug 2011 at 12:36

GoogleCodeExporter commented 8 years ago
The option to enable WSGI is in Step 5 under Short Options List. I've attached 
a screen shot for easy reference 

Original comment by challgren on 11 Aug 2011 at 12:46

Attachments:

GoogleCodeExporter commented 8 years ago
Hmm, nope - it's definitely not present for me in step 5. Fiddling... OK I see  
- the instructions above say 

tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf ModWSGI.tar.gz

so I had grabbed the ModWSGI.tar.gz out of the download and put in place. The 
instruction should say:

tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf 
custom_opt_mod-mod_wsgi.tar.gz

which is the full package.  It does show up in easy_apache now, great. 
Unfortunately, the compilation failed with the following error. Any ideas? 
Thanks.

-- Begin opt 'Mod WSGI (Custom Opt Mod)' --

    -- Begin step 'Configuring mod_wsgi' --
checking Apache version... 2.2.19
checking for python... /usr/local/bin/python
configure: creating ./config.status
config.status: creating Makefile
    -- End step 'Configuring mod_wsgi' --

    -- Begin step 'Making mod_wsgi' --
/usr/local/apache/bin/apxs -c -I/usr/local/include/python2.7 -DNDEBUG  
-Wc,-fPIC  mod_wsgi.c -L/usr/local/lib -L/usr/local/lib/python2.7/config  
-lpython2.7 -lpthread -ldl  -lutil -lm
/usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic -m64 
-fPIC -DPIC  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -m64 -fPIC -DPIC -pthread 
-I/opt/pcre/include -I/usr/local/apache/include  -I/usr/local/apache/include   
-I/usr/local/apache/include  -fPIC -I/usr/local/include/python2.7 -DNDEBUG  -c 
-o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
/usr/local/apache/build/libtool --silent --mode=link gcc -o mod_wsgi.la  -rpath 
/usr/local/apache/modules -module -avoid-version    mod_wsgi.lo 
-L/usr/local/lib -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl 
-lutil -lm
/usr/bin/ld: /usr/local/lib/libpython2.7.a(node.o): relocation R_X86_64_32 
against `a local symbol' can not be used when making a shared object; recompile 
with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1
!! 'make' failed with exit code '512' !!
!! Restoring original working apache !!

Original comment by shacker....@gmail.com on 11 Aug 2011 at 1:03

GoogleCodeExporter commented 8 years ago
Ahh sorry about that I forgot I renamed the file. Looks from the build output 
its something with Python 2.7, I've only tested and been able to compile 
successfully with Python 2.6. Sorry I haven't really had the time to test or 
play around with Python 2.7

Original comment by challgren on 11 Aug 2011 at 1:09

GoogleCodeExporter commented 8 years ago
I'll try some experiments. Just tried recompiling python with the -fPIC flag 
based on some forum talk elsewhere, but that didn't fix it unfortunately. Will 
update if I figure it out.

Original comment by shacker....@gmail.com on 11 Aug 2011 at 1:25

GoogleCodeExporter commented 8 years ago
You mean rebuild Python with --enable-shared rather that -fPIC don't you. You 
can't just force Python directly to use -fPIC but need the option to configure. 
See:

http://code.google.com/p/modwsgi/wiki/InstallationIssues#Mixing_32_Bit_And_64_Bi
t_Packages

Original comment by Graham.Dumpleton@gmail.com on 11 Aug 2011 at 2:28

GoogleCodeExporter commented 8 years ago
Ah - OK, recompiled Python with --enable-shared and that gave me a set of libs 
in /usr/local/lib. Per suggestions on the wiki, have tried moving those to 
/lib, /usr/lib, and /usr/local/apache/lib (which is where cPanel systems keep 
their shared libs, as far as I can tell). In each case, easy_apache fails with 
the dreaded "/usr/local/bin/python: error while loading shared libraries: 
libpython2.7.so.1.0: cannot open shared object file: No such file or directory" 

Not sure where else I can try putting the libs to get easy_apache to find them. 
Thoughts? Thanks much.

Original comment by shacker....@gmail.com on 11 Aug 2011 at 7:24

GoogleCodeExporter commented 8 years ago
Success! Used the ld.so configuration file trick suggested on the wiki page and 
it worked - apache was able to find the python shared libs during compile. I've 
written up a blog post explaining the whole process - hopefully someone will 
find it useful in the future:

http://birdhouse.org/blog/2011/08/11/building-mod_wsgi-through-easyapache-for-wh
mcpanel-systems/

Thanks much chall and Graham Dumpleton!

Original comment by shacker....@gmail.com on 11 Aug 2011 at 8:18

GoogleCodeExporter commented 8 years ago
I actually go by challgren but google likes to munge my name

Original comment by challgren on 11 Aug 2011 at 8:24

GoogleCodeExporter commented 8 years ago
Fixed your name :) Thanks again for this excellent module.

Original comment by shacker....@gmail.com on 11 Aug 2011 at 8:27

GoogleCodeExporter commented 8 years ago
No problem, I've also written a subversion module for Easy Apache

Original comment by challgren on 11 Aug 2011 at 8:28

GoogleCodeExporter commented 8 years ago
Instead of put libpython2.7.so in system lib directories or usind ld.so, you 
could have done:

  LD_RUN_PATH=/usr/local/lib make 

when building mod_wsgi and it would have embedded /usr/local/lib as place to 
look in mod_wsgi.so file itself.

Original comment by Graham.Dumpleton@gmail.com on 11 Aug 2011 at 11:12

GoogleCodeExporter commented 8 years ago
'challgren', where can we download that subversion module for Easy Apache?

Original comment by i...@webhs.pt on 31 Aug 2011 at 11:14

GoogleCodeExporter commented 8 years ago
your mod_wsgi works with python 2.4.3?

Original comment by i...@webhs.pt on 31 Aug 2011 at 11:18

GoogleCodeExporter commented 8 years ago
Thanks for this.  Seems to have worked for me.

Original comment by Erik.E.E...@gmail.com on 19 Mar 2012 at 12:27

GoogleCodeExporter commented 8 years ago
I'll see what I can do about putting out a subversion release

Original comment by challgren on 26 Apr 2012 at 8:53

GoogleCodeExporter commented 8 years ago
This was a most excellent help. Took it from probably taking a couple hours to 
about 20 minutes for me to get my Mozilla Sync setup.

Original comment by wired...@gmail.com on 31 Jul 2012 at 9:23

GoogleCodeExporter commented 8 years ago
I changed the files for use with last actual version of mod_wsgi (3.4) ;)

Original comment by ralsalam...@gmail.com on 6 Oct 2012 at 11:28

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you! Sadly my need for WSGI has disappeared so I won't be updating it 
often.

Original comment by challgren on 6 Oct 2012 at 11:32

GoogleCodeExporter commented 8 years ago
I just ran into something weird - after an easy_apache  mod_wsgi rebuild, Djano 
sites could no longer find MySQLdb. I replaced the newly built mod_wsgi with 
one from a backup, and it worked. But I didn't think mod_wsgi had any awareness 
of mysql libs at all. Any theories about what might be going on here?

Original comment by scotfhac...@gmail.com on 25 Feb 2013 at 8:44

GoogleCodeExporter commented 8 years ago
mod_wsgi would have been compiled for a specific Python version. You sure the 
new one isn't using a different Python version which doesn't have MySQLdb 
client module installed.

Original comment by Graham.Dumpleton@gmail.com on 25 Feb 2013 at 10:42

GoogleCodeExporter commented 8 years ago
Graham, that turns out to be exactly what happened, but we can't figure out 
why. The easy_apache module has compiled against the correct python version for 
a couple of years now, and all of a sudden stopped. According to the post I 
wrote about this back then 
(http://birdhouse.org/blog/2011/08/11/building-mod_wsgi-easyapache-for-whmcpanel
/), easy_apache will find the correct path to python via:

/etc/ld.so.conf.d/python27.conf, which contains 

/usr/local/lib/libpython2.7.so

and that .so does exist. So the question is, what changed? It's as if 
WHM/cPanel no longer looks at that conf to figure out which python path to use 
when compiling. 

Thanks for any suggestions.

Original comment by scotfhac...@gmail.com on 26 Feb 2013 at 7:06

GoogleCodeExporter commented 8 years ago
Does this still require python 2.7 or can it be done on 2.4.3? My host gave me 
a vps template with CentOS 5 that still has Python 2.4.3 and I'd like to try 
this.

Original comment by halfpast...@gmail.com on 28 Feb 2013 at 11:23