Re: Looking for documention on deploying roundup with mod_wsgi

Thomas Arendsen Hein <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hi John!

* 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 :)

> 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)

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.

> I assume this allows apache to directly serve up static files like css
> etc rather than going through the wsgi roundup instance?
> 
> >            Alias /foo/@@file/ /srv/roundup/foo/html/

Yes, correct.

> Remap /foo to /foo/ I assume?
> 
> >            RedirectMatch permanent ^/(foo)$ /$1/

Yes, correct.

> >            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.

> >(https can be configured here, too, but we do this elsewhere)
> 
> Do you have an example stanza to enable https?

<VirtualHost *:443>
        SSLEngine on
        SSLCertificateFile      /path/to/cert.pem
        SSLCertificateKeyFile   /path/to/key.pem
        SSLCertificateChainFile /path/to/cacert.pem
        ...other things like in the http section...
</VirtualHost>

And on Debian you can use "a2enmod ssl" to enable ssl support.

Optionally put this in your http section to enforce https:

        Redirect / https://roundup.example.com/

But often distributions already contain en example configuration for
https, which already includes suitable paths and other things.

> >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 :)

> >/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.

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....

:)

Regards,

Thomas

-- 
Thomas Arendsen Hein <[email protected]>
OpenPGP key: https://intevation.de/~thomas/thomas_pgp.asc (0xD45DE28FF3A2250C)
Intevation GmbH, Neuer Graben 17, 49074 Osnabrueck - AG Osnabrueck, HR B 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
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.