Re: Looking for documention on deploying roundup with mod_wsgi

"John P. Rouillard" <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hi Thomas:

In message <[email protected]>,
Thomas Arendsen Hein writes:
>* John P. Rouillard <[email protected]> [20191008 02:55]:
>> In message <[email protected]>,
>> Thomas Arendsen Hein writes:
>> >Not with so much detail, but here are some snippets that might be
>> >useful:
>> 
>> I am using your wsgi as the example wsgi script for the WSGI Handler
>> section since it seems the script that was there was broken. I like
>> the ability to shut off the script for maintenance.
>
>I have a similar mechanism for the mail gateway, but did not want to
>complicate this topic. Feel free to ask me after the wsgi stuff is
>finihed :)

Will do.

>> Listen at port 80
>> 
>> >    <VirtualHost *:80>
>> >            CustomLog /var/log/apache2/access.log vhost_combined
>> >
>> >            Alias /doc/ /home/roundup/install/share/doc/roundup/html/
>
>This directive does not make Apache listen on port 80, but it will
>make it react if a request it receives on port 80 matches the host
>name (which is "*" here, so matches anything)

Yeah, should have said "This is the config when a connection arrives
on port 80". Just out of curiosity, I assume you actually have this in
a :443 stanza and your :80 stanza just redirects to https?

>On Debian systems there is a /etc/apache2/ports.conf with the
>corresponding "Listen" configuration. On CentOS this is in
>/etc/httpd/conf/httpd.conf and/or /etc/httpd/conf.d/ssl.conf, other
>systems have again different locations, so I think this should not
>be discussed in the Roundup docs.

Agreed.

>
>> > WSGIDaemonProcess roundup-foo display-name=roundup-foo user=roundup-foo group=roundup-foo threads=25
>> 
>> This makes /foo run the wsgi script and pass remaining url path
>> to the wsgi as path info and query args?
>> 
>> >            WSGIScriptAlias /foo /srv/roundup/foo/roundup.wsgi
>> >            <Location /foo>
>> >                    WSGIProcessGroup roundup-foo
>> >            </Location>
>> >    </VirtualHost>
>
>Yes, correct. The WSGIScriptAlias does the mapping to a script,
>the other lines are important to e.g. change the user from www-data
>to roundup-foo.

The roundup-foo on the WSGIDaemonProcess line is the key that
allows the wsgi script to be started in ~roundup-foo. So for another
roundup tracker you can use a diferent user.

>Optionally put this in your http section to enforce https:
>
>        Redirect / https://roundup.example.com/
>
>But often distributions already contain an example configuration for
>https, which already includes suitable paths and other things.

This would go in the :80 stanza. Got it.

>> >Use "a2ensite roundup" and "a2dissite default" to enable only the
>> >roundup configuration.
>> 
>> What happens if you don't turn off default?
>
>Then the config from the default site is still active. Maybe it
>serves something below /, maybe it conflicts and Apache complains,
>don't try this at home :)

Ok, just for safety.

>> >/srv/roundup/foo/ contains the Roundup instance and the file
>> >roundup.wsgi:
>> >
>> >    import sys, os
>> >    sys.stdout = sys.stderr
>> >
>> >    enabled = True
>> >
>> >    if enabled:
>> >        sys.path.insert(0, '/home/roundup/install/lib/python')
>> >        # obtain the WSGI request dispatcher
>> >        from roundup.cgi.wsgi_handler import RequestDispatcher
>> >        tracker_home = os.path.join(os.getcwd(), 'instance')
>> 
>> This line I don't get. Does apache or mod_wsgi automatically cd to
>> /home/roundup-foo and how does it know to start there?
>
>The user account is roundup-foo (due to the WSGIDaemonProcess
>setting above), so it automatically changes to the home directory of
>this user.

That was the piece I was missing and I was too lazy to look up the
docs 8-).

>You could alternatively use:
>
>    tracker_home = os.path.expanduser('~/instance')
>
>Or if you want to avoid using the symlink in $HOME and maybe avoid
>having the username used as a path component, you can set it
>directly:
>
>    tracker_home = '/srv/roundup/roundup-foo'
>
>(but I wanted an identical wsgi script for multiple trackers)
>
>> >        application = RequestDispatcher(tracker_home)
>> 
>> and magic happens....

I hope to have a test doc checked in later tonight.

Thanks and have a great day.

--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.