Posts – Page 4

Serving uWSGI Apps on a Sub-directory with Nginx

Serving up uWSGI application using Nginx is super-simple and is configured effectively like a standard reverse proxy_pass. However, the documentation isn’t entirely clear exactly how one can correctly serve an application against a sub-directory — and have the application know its correct path such that it can create correct URLs.

Coming from a background of using the Cherokee webserver, uWSGI operated slightly differently within its configuration. This behaviour, as best I know, must have modified the given uWSGI parameters to correctly handle the sub-directory path. I haven’t looked into it, but it probably just does the same thing that …

New Blog, Goodbye Wordpress

Yes, I’m a little ashamed that I did used to run Wordpress as my blog and my website. Being a Python developer that I am, it’s not exactly good form, nor is it good for one’s sanity to have to keep updating something every few days with security updates. Maybe I’m giving PHP applications and Wordpress a hard time given their prevalence out in the wild, but the fact remains that it just wasn’t working for me. It might also have a little to do with the fact that my existing web host has decided …

Configuring GTK/Gnome toolbar icon sizes and labels (Ubuntu 12.10+ and more)

One major annoyance (first-world, clearly) for me having upgraded to Ubuntu 12.10 is that my GTK toolbar icons are very large (32x32 pixels) and have labels on them. This takes up a decent amount of screen real estate in applications like gedit, Rhythmbox, and many others — effectively anything that’s using GTK. What’s worse, it looks like the latest Ubuntu (Quantal Quetzal) now is adding visual padding/spacing around the buttons. I don’t like this at all and prefer my buttons to be tiny and without labels.

As per the post at http://ubuntuforums.org/showthread.php …

Virtualenv being ignored by setuptools/Distribute/easy_install

This one couldn’t be simpler, but it’s worth noting all the same.  I’ve just experienced a situation where a virtualenv  was being completely ignored by all tools even though it was absolutely activated via source bin/activate.

The answer was to blow away the lib directory within the virtualenv and blow away the local Python interpreter at bin/python and re-create the virtualenv. After deactivating and re-activating, everything works correctly again.

I guess something in the environment (or env variables) got messed up. Who knows; it works now.

Restart/reset USB in Ubuntu 12.04 without rebooting

Either my Dell Optiplex 990 computer or my Linux install has an issue: occasionally, when I re-plug a USB device into the system, it’ll cause a fault in the USB module in the kernel and USB goes dark. I’m unsure as to whether this is a hardware or software issue, but I’d simply like to restart my USB subsystem and continue working. When searching the web for ‘restart USB in Linux’ and ‘reload USB kernel module’, you get a plethora of results and none of which will work (seemingly due to how the Ubuntu standard kernel is …

Members can’t add folders to Plone via WebDAV (401 Unauthorized)

This is a mirror of the (excellent) documentation at http://plone.org/documentation/error/unable-to-create-a-folder-through-webdav/, but just a short editorial to also highlight that this is still very applicable to Plone 4.x. Effectively, the symptom is that users will report seeing a “401 Unauthorized” error when trying to create folders within areas they have access to as an Owner.  Without further ado, the documentation:

Using a WebDAV client on a Plone site, site users are unable to create newfolders directories where they have Owner role.

Problem:

The WebDAV “make folder” method, MKCOL, requires the “Add Folders” permission. This is …

Jenkins CI and GitHub post-receive hooks ceasing to work (+ potential solution)

All projects fail

Recently our Jenkins CI system began having issues with failing to correctly accept post-receive hook POST requests from GitHub, even though it was working fine. Without thorough testing, I can only really see that the issue was related to upgrading Jenkins and/or the relevant Git and GitHub plugins. Thankfully, with even newer versions of the above, it has started working again. So, to those with issues, I offer this KGS (Known Good Set) of versions for your help:

  • Jenkins 1.470
  • Jenkins GIT plugin 1.1.19
  • github-api 1.28
  • GitHub plugin 1.4

Some projects …

Serving TileStache (or another app) using uWSGI against a web sub-directory

uWSGI is extremely promising as an application server given its huge range of options and supported platforms.  For me, however, just getting something seemingly simple up and running successfully was relatively confusing. I’d like to contribute to the documentation when I can, but thought a dedicated page about TileStache as a specific application (and associated configuration) was warranted. It does make more sense now, thankfully.

I want to serve my TileStache application at http://mydomain.com/tiles (taking careful note of the sub-directory present). I’ve chosen an INI-style configuration for my instance and here’s what the …

mr.scripty - my new best friend

If you’re working with Buildout, then check out mr.scripty, a fantastic Buildout recipe that allows you to use Python code in functions within its options.  This means that - in the few instances I’ve used it so far - have conditional statements regarding effectively anything.

In the two examples I added to the source documentation, I go and configure download links based upon architecture and separately, configure some (Java) environment variables based upon which directories exist (eg to handle different Linux distributions that might be running). This is only the start, but it’s a fantastic one.

Amazing I …

Java HTTP request fails with “javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated”

Searching the above-mentioned stack trace reveals lots and lots of results, unsurprisingly.  Most results are workarounds where you modify the code, but what about if an application (like Jenkins/Hudson CI, in my case) throws this error at you? The reason the error is occurring is because the SSL certificate of the target you’re connecting to isn’t considered valid by your Java instance’s keystore. This may be because the certificate itself is invalid, or, in my case, the CA chain couldn’t be validated (my OS is RHEL (Red Hat) 5.7, with OpenJDK 1.6).  For …