mod_wsgi on centos7 in own package management system

88 views
Skip to first unread message

Michael Graber

unread,
Nov 15, 2016, 7:27:55 AM11/15/16
to modwsgi


Hi!

In our rather astronomy collaboration we are using mod_wsgi to host some of our django-based webapplications.

Currently we are in the process of updating to the latest version (mod_wsgi 4.5.7, mod_wsgi 2.4.23.1). Here I encounter some problems:

For scientific integrity reasons we have our own package management system (eups) with our own distributed version of python (2.7.9). mod_wsgi (and mod_wsgi-httpd) has to be installed through this package management system and against this python version.
Our substrate os for webapplications (not all platforms need to be covered here) is typically CentOS7.

This actually worked fine for mod_wsgi 4.4.13 and mod_wsgi-httpd 2.4.12.6. I cannot get the latest version to work.


First, it would be helpful to get general advice if we do anything unreasonable overall. Here is how we proceed.

1. install python 2.7.9 through our package management system. setup the paths to use our versions.

2. i downloaded with 'pip download' the source code for the mod_wsgi and the mod_wsgi-httpd package. we distribute them through a fileserver.

3. we download these tars to the target machine (centos7).

4. we install mod_wsgi-httpd first, basically using python setup.py build and then install with our prefix

5. we set some according CFLAGS and then install mod_wsgi through python setup.py build and install (prepending configure (setting --with-apxs accordingly), make was not successful either)


Please find the build script below.


Does this make sense overall?


Now, this does not work. Even though apparently mod_wsgi-httpd builds correctly i suspect that we actually already there create a / the problem. Here is the build log:





Any hints are very much appreciated!
Thanks,
Michael







build script: 
---------------------------------------------------------------

#!/usr/bin/env bash

wget http://desbuild.cosmology.illinois.edu/eeups/webservice/resources/modWSGIhttpd/modWSGIhttpd-2.4.23.1.tar.gz
tar xzf modWSGIhttpd-2.4.23.1.tar.gz
cd modWSGIhttpd-2.4.23.1
python setup.py build

mkdir -p ${PRODUCT_DIR}/lib/python2.7/site-packages
export PYTHONPATH=$PRODUCT_DIR/lib/python2.7/site-packages:$PYTHONPATH
python setup.py install --prefix=$PRODUCT_DIR

cd ..

# now we take care of the modWSGI / mod_wsgi installation
wget $EXTERNAL/$PRODUCT/$PRODUCT-$VERSION.tar.gz
tar xzf $PRODUCT-$VERSION.tar.gz
cd $PRODUCT-$VERSION

export CFLAGS="-I${PRODUCT_DIR}/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/include"
export CFLAGS="$CFLAGS -I${PRODUCT_DIR}/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/include/apr-1"
export PATH=${PRODUCT_DIR}/bin:${PATH}
export PATH=${PRODUCT_DIR}/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin:${PATH}

#./configure --with-apxs=${PRODUCT_DIR}//lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin/apxs
#make

python setup.py build
python setup.py install --prefix=$PRODUCT_DIR

Graham Dumpleton

unread,
Nov 15, 2016, 3:42:38 PM11/15/16
to mod...@googlegroups.com
How are you eventually running mod_wsgi? Are you using mod_wsgi-express, or are you trying to integrate this with your existing system Apache installation?

Why aren’t you just using any existing system Apache installation when doing ‘pip install mod_wsgi’, rather than also installing the ‘mod_wsgi-httpd’ package?

Graham

--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Michael Graber

unread,
Nov 17, 2016, 11:23:02 AM11/17/16
to modwsgi


So far we've been using the pattern you presented on your series of blog posts (around http://blog.dscpl.com.au/search?q=runmodwsgi) for the deployment of django apps using mod_wsgi-express and the associated django command runmodwsgi.

This worked great and we would like to continue to do so. Are there any better options?

We are not doing pip install mod_wsgi but rather have to install mod_wsgi through our own package management system.
Apache does not come as a standard with our container platform that's why we wanted to install it through mod_wsgi-httpd ..

Would you rather recommend using a platform (CentOS7) provided apache version?

Thanks a lot for your tools and our help!
Michael

Graham Dumpleton

unread,
Nov 17, 2016, 8:09:20 PM11/17/16
to mod...@googlegroups.com
The error you are getting indicates that the mod_wsgi-apxs program was not found in the PATH when a search was made when installing mod_wsgi. It therefore fell back to trying to use apxs/apr-1-config/apu-1-config and the latter were not present.

If you are sure that it is being installed correctly, try instead setting:

export APXS=${PRODUCT_DIR}/bin/mod_wsgi-apxs

prior to building mod_wsgi.

Graham

Michael Graber

unread,
Nov 28, 2016, 6:12:39 AM11/28/16
to modwsgi

Thanks Graham for your reply! .. and sorry for the late response.

So, first of all I get from our conversation so far, that in principle you think our approach should work in principle and not be too complicated, right?

How can we verify that mod_wsgi-httpd is installed correctly? What tests can we do?
.. we do not get any build errors.

Now I tried your suggestion:

export APXS=${PRODUCT_DIR}/bin/mod_wsgi-apxs


.. but again get the same error:



So maybe, indeed, the mod_wsgi-httpd installation is not working properly. Again, how can we verify this?

Thanks in advance,
Michael

Graham Dumpleton

unread,
Nov 28, 2016, 7:49:23 PM11/28/16
to mod...@googlegroups.com
Can you add debugging steps between installing mod_wsgi-httpd and installing mod_wsgi whereby you do:

    set -x

    ls -las ${PRODUCT_DIR}/bin

echo $PATH
echo $APXS

which apxs
which mod_wsgi-apxs

set +x

BTW. I don’t see in your script output where you are setting APXS. Are you sure it was set in the script which was run?

Graham

Michael Graber

unread,
Nov 29, 2016, 3:54:33 AM11/29/16
to modwsgi

I introduced the suggested debugging steps. This is its output:


+ ls -las /des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin total 0 0 drwxrwxrwx 2 buildbot desdm 512 Nov 29 02:47 . 0 drwxrwxrwx 4 buildbot desdm 512 Nov 29 02:47 .. 0 -rwxrwxrwx 1 buildbot desdm 399 Nov 29 02:47 mod_wsgi-apxs + echo /des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGIhttpd/2.4.23.1+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/tcl/8.5.17+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/tk/8.5.17+1/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/sqlite/3080002+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/python/2.7.9+1/bin:/usr/local/bin:/bin:/usr/bin:/des002/devel/eeups/eups_desbuild/1.2.30/bin /des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGIhttpd/2.4.23.1+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/tcl/8.5.17+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/tk/8.5.17+1/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/sqlite/3080002+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/python/2.7.9+1/bin:/usr/local/bin:/bin:/usr/bin:/des002/devel/eeups/eups_desbuild/1.2.30/bin + echo /des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin/mod_wsgi-apxs /des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin/mod_wsgi-apxs + which apxs /des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin/apxs + which mod_wsgi-apxs /des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin/mod_wsgi-apxs + set +x

.. to me it seems things look ok up the here, no?


the entire build log can be found here : 

http://desbuild.cosmology.illinois.edu/eeups/webservice/dashboard/products/modWSGI/4.5.7%2B0/desbuild/build/build.log


thanks,
michael

Graham Dumpleton

unread,
Nov 29, 2016, 11:49:20 PM11/29/16
to mod...@googlegroups.com
What does:

    ${PRODUCT_DIR}/bin/mod_wsgi-apxs

contain after mod_wsgi-httpd is installed?

What are the permissions on the file?

Graham

Michael Graber

unread,
Dec 1, 2016, 2:56:00 AM12/1/16
to modwsgi


${PRODUCTI_DIR} 

is

/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0


here is the requested info:


-bash-4.1$ pwd
/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin
-bash-4.1$ ls -la
total 8
drwxrwxrwx 2 buildbot desdm 512 Nov 29 02:47 .
drwxrwxrwx 4 buildbot desdm 512 Nov 29 02:47 ..
-rwxrwxrwx 1 buildbot desdm 399 Nov 29 02:47 mod_wsgi-apxs
-bash-4.1$ cat mod_wsgi-apxs
#!/des002/devel/eeups/ci_build_desbuild/Linux64/python/2.7.9+1/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'mod-wsgi-httpd==2.4.23.1','console_scripts','mod_wsgi-apxs'
__requires__ = 'mod-wsgi-httpd==2.4.23.1'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('mod-wsgi-httpd==2.4.23.1', 'console_scripts', 'mod_wsgi-apxs')()
    )


thx!
michael

Graham Dumpleton

unread,
Dec 1, 2016, 7:20:33 PM12/1/16
to mod...@googlegroups.com
Does this exist:

    /des002/devel/eeups/ci_build_desbuild/Linux64/python/2.7.9+1/bin/python

Graham

Michael Graber

unread,
Dec 2, 2016, 4:43:03 AM12/2/16
to modwsgi

yes it does:

-bash-4.1$ ls -la  /des002/devel/eeups/ci_build_desbuild/Linux64/python/2.7.9+1/bin
total 48
drwxr-xr-x 2 buildbot desdm   512 May 25  2016 .
drwxrwxrwx 6 buildbot desdm   512 May 25  2016 ..
-rwxrwxrwx 1 buildbot desdm   151 May 25  2016 2to3
-rwxrwxrwx 1 buildbot desdm   149 May 25  2016 idle
-rwxrwxrwx 1 buildbot desdm   134 May 25  2016 pydoc
lrwxrwxrwx 1 buildbot desdm     7 May 25  2016 python -> python2
lrwxrwxrwx 1 buildbot desdm    14 May 25  2016 python-config -> python2-config
lrwxrwxrwx 1 buildbot desdm     9 May 25  2016 python2 -> python2.7
lrwxrwxrwx 1 buildbot desdm    16 May 25  2016 python2-config -> python2.7-config
-rwxr-xr-x 1 buildbot desdm  9856 May 25  2016 python2.7
-rwxr-xr-x 1 buildbot desdm  1737 May 25  2016 python2.7-config
-rwxrwxrwx 1 buildbot desdm 18597 May 25  2016 smtpd.py
-bash-4.1$

mi

Graham Dumpleton

unread,
Dec 2, 2016, 4:50:03 AM12/2/16
to mod...@googlegroups.com
What does the following output:

mod_wsgi-apxs -q APR_CONFIG
mod_wsgi-apxs -q APU_CONFIG

Michael Graber

unread,
Dec 2, 2016, 5:22:51 AM12/2/16
to modwsgi

ok, i included the call for the two commands into the build file debug steps, in order to investigate in the adequate configuration.

here is the output:


+ ls -las /des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin
total 0
0 drwxrwxrwx 2 buildbot desdm 512 Dec  2 04:00 .
0 drwxrwxrwx 4 buildbot desdm 512 Dec  2 04:00 ..
0 -rwxrwxrwx 1 buildbot desdm 399 Dec  2 04:00 mod_wsgi-apxs
+ echo /des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGIhttpd/2.4.23.1+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/tcl/8.5.17+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/tk/8.5.17+1/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/sqlite/3080002+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/python/2.7.9+1/bin:/usr/local/bin:/bin:/usr/bin:/des002/devel/eeups/eups_desbuild/1.2.30/bin
/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGIhttpd/2.4.23.1+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/tcl/8.5.17+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/tk/8.5.17+1/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/sqlite/3080002+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/python/2.7.9+1/bin:/usr/local/bin:/bin:/usr/bin:/des002/devel/eeups/eups_desbuild/1.2.30/bin
+ echo /des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin/mod_wsgi-apxs
/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin/mod_wsgi-apxs
+ which apxs
/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin/apxs
+ which mod_wsgi-apxs
/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin/mod_wsgi-apxs
+ mod_wsgi-apxs -q APR_CONFIG
/des002/devel/eeups/ci_build_desbuild/EupsBuildDir/Linux64/modWSGI-4.5.7+0/modWSGIhttpd-2.4.23.1/build/httpd/bin/apr-1-config
+ mod_wsgi-apxs -q APU_CONFIG
/des002/devel/eeups/ci_build_desbuild/EupsBuildDir/Linux64/modWSGI-4.5.7+0/modWSGIhttpd-2.4.23.1/build/httpd/bin/apu-1-config
+ set +x


so it appears as if the location of these two outputs would rather be on the build path of mod_wsgi-httpd than the install path .. is this a problem?




the entire build log can again be found at: http://desbuild.cosmology.illinois.edu/eeups/webservice/dashboard/products/modWSGI/4.5.7%2B0/desbuild/build/build.log

Michael Graber

unread,
Dec 7, 2016, 3:57:55 AM12/7/16
to modwsgi

May I kindly ask again regarding the interpretation of the requested outputs?

Thanks,
Michael

Graham Dumpleton

unread,
Dec 7, 2016, 4:20:25 AM12/7/16
to mod...@googlegroups.com
The general approach that you use works for me on MacOS X, so I am not sure what you are doing different that is problem and I don’t think should be different for Linux.

Instead of using:

	python setup.py build
	mkdir -p ${PRODUCT_DIR}/lib/python2.7/site-packages
	export PYTHONPATH=$PRODUCT_DIR/lib/python2.7/site-packages:$PYTHONPATH
	python setup.py install --prefix=$PRODUCT_DIR
Use a pip style install instead.

      pip install —prefix=$PRODUCT_DIR modWSGIhttpd-2.4.23.1.tar.gz

Graham

Michael Graber

unread,
Dec 7, 2016, 4:42:01 AM12/7/16
to modwsgi

Thanks, it's good to know, that we are not doing anything unreasonable ..

We do not have pip in our package management system. So before going along the path of adding it:

mod_wsgi-apxs -q APR_CONFIG

returns a path in the build directory:
+ mod_wsgi-apxs -q APR_CONFIG
/des002/devel/eeups/ci_build_desbuild/EupsBuildDir/Linux64/modWSGI-4.5.7+0/modWSGIhttpd-2.4.23.1/build/httpd/bin/apr-1-config
+ mod_wsgi-apxs -q APU_CONFIG
/des002/devel/eeups/ci_build_desbuild/EupsBuildDir/Linux64/modWSGI-4.5.7+0/modWSGIhttpd-2.4.23.1/build/httpd/bin/apu-1-config
Can you explain why this is the case?

This could be problematic, right?

Thanks!
Michael

Graham Dumpleton

unread,
Dec 7, 2016, 5:10:29 AM12/7/16
to mod...@googlegroups.com
One thing that is wrong is that you should not be setting:

	export PATH=${PRODUCT_DIR}/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin:${PATH}
I don’t know if that could be confusing things.

Graham Dumpleton

unread,
Dec 7, 2016, 5:14:31 AM12/7/16
to mod...@googlegroups.com
These should also not be required:

	export CFLAGS="-I${PRODUCT_DIR}/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/include"
	export CFLAGS="$CFLAGS -I${PRODUCT_DIR}/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/include/apr-1"

Graham

Graham Dumpleton

unread,
Dec 7, 2016, 5:23:42 AM12/7/16
to mod...@googlegroups.com
What is the contents of:

${PRODUCT_DIR}/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/build/config_vars.mk

Graham Dumpleton

unread,
Dec 7, 2016, 5:40:34 AM12/7/16
to mod...@googlegroups.com
On 7 Dec 2016, at 9:23 PM, Graham Dumpleton <graham.d...@gmail.com> wrote:

What is the contents of:

${PRODUCT_DIR}/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/build/config_vars.mk
Here is my guess of what is going wrong.

That file should have entries of the form:

APR_CONFIG = ${mod_wsgi_httpd_prefix}/bin/apr-1-config
APU_BINDIR = ${mod_wsgi_httpd_prefix}/bin

This has substitution variables in it for replacing the actual prefix. These are created when the package is installed using:

    with open('build/httpd/build/config_vars.mk') as fpin:
        config_vars = fpin.readlines()

    with open('build/httpd/build/config_vars.mk', 'w') as fpout:
        prefix = os.path.join(os.getcwd(), 'build/httpd')
        for line in config_vars:
            line = re.sub(prefix, '${mod_wsgi_httpd_prefix}', line)
            print(line, end='', file=fpout)

My guess is that your filesystem directory mounting is using NFS mounting of some strange setup, such that when you cd to a directory, what then gets reported by os.getcwd() is different to what directory path was in config_vars.mk before substitution. The result is that the substitution variables are not set up correctly as it didn’t match the filesystem prefixes in the file.

What do you get for:

echo $PRODUCT_DIR
cd $PRODUCT_DIR
cwd
python -c ‘import os; os.getcwd()'

Graham

Graham Dumpleton

unread,
Dec 7, 2016, 5:49:03 AM12/7/16
to mod...@googlegroups.com
Better guess.

The problem is because you have ‘+’ character in the directory path names.

That is going to cause a problem for:

    line = re.sub(prefix, '${mod_wsgi_httpd_prefix}', line)

as am not escaping the value of ‘prefix’ so that special characters aren’t interpreted as part of the regular expression pattern.

Should be using:

   line = re.sub(re.escape(prefix), '${mod_wsgi_httpd_prefix}', line)

This is in the setup.py file of the mod_wsgi-httpd package.

I can probably test this theory easily enough.

Graham

Michael Graber

unread,
Dec 7, 2016, 5:50:12 AM12/7/16
to modwsgi

Thanks for digging into this with me!

You suggested a couple of things.

I removed the CFLAGS and and PATH appending.

Now the build crashes because it does not find apxs anymore. From the build log:

+ which apxs
which: no apxs in (/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGI/4.5.7+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/modWSGIhttpd/2.4.23.1+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/tcl/8.5.17+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/tk/8.5.17+1/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/sqlite/3080002+0/bin:/des002/devel/eeups/ci_build_desbuild/Linux64/python/2.7.9+1/bin:/usr/local/bin:/bin:/usr/bin:/des002/devel/eeups/eups_desbuild/1.2.30/bin)



digging further ..

Graham Dumpleton

unread,
Dec 7, 2016, 5:52:31 AM12/7/16
to mod...@googlegroups.com
That doesn’t matter. It doesn’t need ‘apxs’. That was debugging line to make sure you didn’t have an ‘apxs’ from Apache from somewhere else on your system. Take out ‘which apxs’.

Anyway, catch up with my other emails first and will see am closer possible issue. :-)

Graham

Michael Graber

unread,
Dec 7, 2016, 5:58:18 AM12/7/16
to mod...@googlegroups.com
ok, I’m running now builds with the which-commands removed ..

I understand you suspect the ‘+’ in the path to be a source of problems.

Would you like me to try this out by changing the setup.py file?
You received this message because you are subscribed to a topic in the Google Groups "modwsgi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/modwsgi/9VpIbN6kNi8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to modwsgi+u...@googlegroups.com.

Graham Dumpleton

unread,
Dec 7, 2016, 6:03:55 AM12/7/16
to mod...@googlegroups.com
On 7 Dec 2016, at 9:58 PM, Michael Graber <michi...@gmail.com> wrote:

ok, I’m running now builds with the which-commands removed ..

I understand you suspect the ‘+’ in the path to be a source of problems.

Would you like me to try this out by changing the setup.py file?

Yes please, if you can.

I have already confirmed that the ‘+’ in the path is the cause of the issues and making the change to setup.py fixes it.

I have now:

    with open('build/httpd/build/config_vars.mk') as fpin:
        config_vars = fpin.readlines()

    with open('build/httpd/build/config_vars.mk', 'w') as fpout:
        prefix = os.path.join(os.getcwd(), 'build/httpd')
        for line in config_vars:
            line = re.sub(re.escape(prefix), '${mod_wsgi_httpd_prefix}', line)
            print(line, end='', file=fpout)

With the re.escape(prefix) in there.

I will release an updated package tomorrow. Is getting late here now,

Graham

Michael Graber

unread,
Dec 7, 2016, 6:06:21 AM12/7/16
to mod...@googlegroups.com


ok, thanks Graham for staying up!

I’ll see how far I can get and I’ll keep you posted ..

Thanks again,
Michael




------------------------------------------------------------------------
Michael Graber, PhD

Michael Graber

unread,
Dec 7, 2016, 9:08:24 AM12/7/16
to mod...@googlegroups.com

ok, i added the re.escape(prefix) command into the setup.py of mod_wsgi-httpd.

now it compiles! great! thanks for your support Graham!


.. however, if I now use our package management system to install mod_wsgi including mod_wsgi-httpd inside a docker container (centos7 base image) everything installs properly, BUT if i test the installation with

$ mod_wsgi-express start-server

i still get an error:

[eyoups@18fd7fd781bf tmp]$ mod_wsgi-express start-server
Server URL         : http://localhost:8000/
Server Root        : /tmp/mod_wsgi-localhost:8000:1000
Server Conf        : /tmp/mod_wsgi-localhost:8000:1000/httpd.conf
Error Log File     : /tmp/mod_wsgi-localhost:8000:1000/error_log (warn)
Request Capacity   : 5 (1 process * 5 threads)
Request Timeout    : 60 (seconds)
Startup Timeout    : 15 (seconds)
Queue Backlog      : 100 (connections)
Queue Timeout      : 45 (seconds)
Server Capacity    : 20 (event/worker), 20 (prefork)
Server Backlog     : 500 (connections)
Locale Setting     : en_US.UTF-8
httpd (mod_wsgi-express)  : Syntax error on line 50 of /tmp/mod_wsgi-localhost:8000:1000/httpd.conf: Cannot load /eeups/eups/packages/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/modules/mod_mpm_event.so into server: /eeups/eups/packages/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/modules/mod_mpm_event.so: undefined symbol: apr_skiplist_insert


sorry, to keep bothering you, but I feel like we’re very close to a working system .. and this is still a bit too cryptic for me.

Thanks,
Michael

Graham Dumpleton

unread,
Dec 7, 2016, 6:20:51 PM12/7/16
to mod...@googlegroups.com
Are you changing the location of where it gets installed when inside of the docker container?

What do you get for:

    ldd /eeups/eups/packages/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin/httpd

Graham

Michael Graber

unread,
Dec 8, 2016, 2:27:24 AM12/8/16
to mod...@googlegroups.com

I installed mod_wsgi inside a docker container. Do do so I used our package management system, like any other user in our collaboration could do, directly on his/her machine.

The path where the packages go is configurable by the user. In the case of the docker container we chose it to be /eeups/eups/packages/ ..

Here is what you asked me to figure out:


[eyoups@18fd7fd781bf ~]$ ldd /eeups/eups/packages/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/bin/httpd
linux-vdso.so.1 =>  (0x00007ffdaa2fc000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fa1ab212000)
libaprutil-1.so.0 => /lib64/libaprutil-1.so.0 (0x00007fa1aafe8000)
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007fa1aadbe000)
libapr-1.so.0 => /lib64/libapr-1.so.0 (0x00007fa1aab8f000)
librt.so.1 => /lib64/librt.so.1 (0x00007fa1aa986000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fa1aa74f000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa1aa533000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fa1aa32e000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa1a9f6c000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fa1a9d67000)
libdb-5.3.so => /lib64/libdb-5.3.so (0x00007fa1a99a8000)
/lib64/ld-linux-x86-64.so.2 (0x00005570756a1000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007fa1a97a5000)


Thanks,
Michael

Graham Dumpleton

unread,
Dec 8, 2016, 2:31:25 AM12/8/16
to mod...@googlegroups.com
Two issues.

By installing it at a different directory, finding of shared libraries for Apache will be broken as can’t rely on the path embedded in the executables.

You have the system packages for APR and PCRE installed on the system, so those are being found instead of the desired ones.

You would likely need to set LD_LIBRARY_PATH environment variable to:

    LD_LIBRARY_PATH=/eeups/eups/packages/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/lib

That way will look in directory where the shared libraries for the custom Apache are located.

Graham

Michael Graber

unread,
Dec 8, 2016, 2:40:07 AM12/8/16
to Graham Dumpleton, mod...@googlegroups.com

By installing I mean running the entire build script from scratch. There are no ‘precompiled' files moved.

Does the LD_LIBRARY_PATH need to be set in the build instructions, before installing mod_wsgi, after the mod_wsgi-httpd installation has been completed?

Graham Dumpleton

unread,
Dec 8, 2016, 2:45:15 AM12/8/16
to Michael Graber, mod...@googlegroups.com
If you aren’t moving stuff after being installed, then it shouldn’t be needed. It should go to that directory anyway.

That you have those libraries in system lib still may be confusing things though.

As a first test, create a file called ‘envvars’. Add to it:

    LD_LIBRARY_PATH=/eeups/eups/packages/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/lib
    export LD_LIBRARY_PATH

Make sure that directories does have the libraries in it and I haven’t got it wrong.

Then run mod_wsgi-express as:

    mod_wsgi-express start-server --envars-script envvars

See if that works.

Graham

Michael Graber

unread,
Dec 12, 2016, 10:03:08 AM12/12/16
to modwsgi, michi...@gmail.com

ok, great! like this it now seems to work properly:



[eyoups@18fd7fd781bf ~]$ cat envvars

LD_LIBRARY_PATH=/eeups/eups/packages/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/lib

export LD_LIBRARY_PATH

[eyoups@18fd7fd781bf ~]$ mod_wsgi-express start-server --envvars-script envvars

Server URL         : http://localhost:8000/

Server Root        : /tmp/mod_wsgi-localhost:8000:1000

Server Conf        : /tmp/mod_wsgi-localhost:8000:1000/httpd.conf

Error Log File     : /tmp/mod_wsgi-localhost:8000:1000/error_log (warn)

Environ Variables  : /home/eyoups/envvars

Request Capacity   : 5 (1 process * 5 threads)

Request Timeout    : 60 (seconds)

Startup Timeout    : 15 (seconds)

Queue Backlog      : 100 (connections)

Queue Timeout      : 45 (seconds)

Server Capacity    : 20 (event/worker), 20 (prefork)

Server Backlog     : 500 (connections)

Locale Setting     : en_US.UTF-8


[eyoups@18fd7fd781bf ~]$ ls -la /tmp/mod_wsgi-localhost\:8000\:1000/

total 60

drwxr-xr-x 4 eyoups users  4096 Dec  8 07:51 .

drwxrwxrwt 9 root   root   4096 Dec  7 14:02 ..

-rwxr-xr-x 1 eyoups users  2898 Dec  8 07:51 apachectl

-rw-r--r-- 1 eyoups users  1007 Dec  8 07:51 default.wsgi

-rw-r--r-- 1 eyoups users    24 Dec  8 07:51 envvars

-rw-r--r-- 1 eyoups users   210 Dec  8 07:51 error_log

-rw-r--r-- 1 eyoups users  2973 Dec  8 07:51 handler.wsgi

drwxr-xr-x 2 eyoups users  4096 Dec  7 14:02 htdocs

-rw-r--r-- 1 eyoups users 17321 Dec  8 07:51 httpd.conf

drwxr-xr-x 2 eyoups users  4096 Dec  7 14:02 python-eggs

-rw-r--r-- 1 eyoups users   180 Dec  8 07:51 resource.wsgi

-rw-r--r-- 1 eyoups users     0 Dec  7 14:02 rewrite.conf



how can I now set LD_LIBRARY_PATH by default?


thanks!

michael

${PRODUCT_DIR}/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/build/config_vars.mk

On 7 Dec 2016, at 9:10 PM, Graham Dumpleton <graham.d...@<a href="http://gmail

Graham Dumpleton

unread,
Dec 12, 2016, 6:05:21 PM12/12/16
to mod...@googlegroups.com, michi...@gmail.com
You can try setting it as environment variable on the Docker image itself.

    ENV LD_LIBRARY_PATH=/eeups/eups/packages/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/lib

On a Mac with the equivalent of DYLD_LIBRARY_PATH that will not work though as for Mac at least it will not pass DYLD_LIBRARY_PATH through to scripts properly. Only option on Mac in this situation is to use envvars file. Am not sure what will happen on Linux.

It still shouldn’t be required if you are relocating packages as the path should be encoded into the binaries. You could also try setting:

    export LD_RUN_PATH=/eeups/eups/packages/Linux64/modWSGI/4.5.7+0/lib/python2.7/site-packages/mod_wsgi_httpd-2.4.23.1-py2.7-linux-x86_64.egg/mod_wsgi_packages/httpd/lib

when building/installing the packages. The setup.,py script should already do that for your, to at least for path where it believes things are installed to.

Graham


Michael Graber

unread,
Dec 15, 2016, 11:11:28 AM12/15/16
to modwsgi, michi...@gmail.com

Thanks Graham! All worked out fine now!
Michael
<div style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-weight: normal; letter-s

Graham Dumpleton

unread,
Dec 15, 2016, 2:28:58 PM12/15/16
to mod...@googlegroups.com, michi...@gmail.com
Which of the two approaches did you use?

Graham

Michael Graber

unread,
Dec 15, 2016, 4:52:36 PM12/15/16
to mod...@googlegroups.com

Our package management system allows appending to path variables when packages are being set up.
I used this functionality to set LD_LIBRARY_PATH.

Thanks again for your help! It’s much appreciated!
Michael




------------------------------------------------------------------------
Michael Graber, PhD

Reply all
Reply to author
Forward
0 new messages