#1684 Remove wsgi scripts from puppet
Closed: Fixed None Opened 13 years ago by toshio.

As we update web applications, we'll start pulling in the copies that do not have config information in them (configuration will be solely in the config file, not in the script). When that happens, we can get rid of the wsgi scripts that we push out via puppet.

== What to check ==
* bodhi
* fas
* elections
* fedoracommunity

(Note: smolt needs a wsgi script in puppet because there's no wsgi script in the smolt package so it's not in this list.)

== How to check ==
The wsgi script should have no lines like the following in them:
turbogears.config.update({'global': {'server.environment': 'production'}})

Note that this similar line is okay. This one reads in the config file; it does not set config variables in the script:
turbogears.update_config(configfile=c, modulename="mirrormanager.config")

== What to do ==
If you update a package and the wsgi script that's in the updated package does not have config.update() lines like above, then it's time to remove the wsgi script from puppet.

Here's an example of how fas will be removed::
cd puppet/modules/fas/files
git rm fas.wsgi
cd ../manifests

edit init.pp

Remove this:

file { "/usr/lib/python2.4/site-packages/fas/fas.wsgi":

owner => "root",

group => "root",

mode => 0755,

source => "puppet:///fas/fas.wsgi",

require => Package["fas"],

notify => Service["httpd"],


git commit -a
git push

Then note in this ticket which package you've fixed. Once all the packages are updated and the wsgi scripts removed from puppet we can close this ticket.

Note: mdomsch pointed out that autoreload of a server will break scripts running under mod_wsgi. So what would be best is if the upstream wsgi scripts first loads the config file and then forces autoreload.on to False like this:
turbogears.update_config(configfile=c, modulename="mirrormanager.config")
turbogears.config.update({'global': {'autoreload.on': False}})

This satisfies the following requirements:

  1. We don't need to have the wsgi scripts in puppet, just the config file.
  2. We can set all configuration in the config file to change how the server runs except:
  3. autoreload.on, which has to stay False (as set in the upstream wsgi script) to avoid breaking the server.

List of apps needing to be fixed is unchanged:
* bodhi
* elections
* fas
* fedoracommunity

fedoracommunity is fixed, and now uses it's own wsgi file.

Still to fix:

  • bodhi
  • fas
  • elections

Fas is done. Still to fix:

  • bodhi
  • elections

I will have a look at this ticket.

I think this should fix elections. But I can't find wsgi script for Bodhi. I'm not sure but I think Bodhi is OK and it doesn't need any fix.

I don't have commit privileges so someone else will have to commit this patch.

Note, you'll also have to change the /etc/httpd/conf.d/elections.conf file to use the wsgi script provided by the package. And also check that the elections.wsgi that was in puppet doesn't have things that need to be moved into the upstream elections.wsgi file.

No problem Toshio. I will definitely do that and try to fix things. Thank you for feedback and your help.

Toshio could you have a look at the latest attachment. This is not the final fix, more like a draft of final fix. And could you give me some feedback, what is OK, what is not, what needs to be removed, what needs to be added, etc.. You said that I might need to move some things from puppet wsgi script to upstream wsgi script. But I don't know how to do that, because I don't know how to add things to upstream elections.wsgi file? So I would need some guidelines.

Toshio I looked at fedora-elections at github but I quickly realised that wsgi script there has a completely different codebase. So I copied elections.wsgi from /usr/share/elections to my computer, made changes and then ran diff. Have a look at the uploaded patch under attachments and tell me if that is okey?

Patch for wsgi script under /usr/share/elections

I had a look at bodhi and I think bodhi doesn't need any fixes.

We discussed this in the infrastructure meeting today: http://meetbot.fedoraproject.org/teams/infrastructure/infrastructure.2015-07-30-18.00.html/

.. and we have new logic in the .wsgi files we're pushing out with ansible that is pretty useful. The number of wsgi processes/threads is used to also calculate what iptables ports should be open and how many fedmsg endpoints to declare, so, moving back to using the .wsgi files that come with the rpm packages is less desirable now. Closing as wontfix.

Login to comment on this ticket.