The Battle for Milkquarious

That I had missed this from 2009, the thought of it tears at my loins.  My life’s path would have undoubtedly altered in one of many in an array of seemingly grand time lines in which I would have drank even more milk.  Of course, the thrill and rush in each timeline would have eventually come to a screeching end in which I would awake in a gutter, hopped up on the white nectar; some of which dripping from my face on which it had become scattered from a frantic race to funnel it into my mouth-hole.  So on second though, I guess I’m glad I didn’t discover this in 2009.

 

The Music of Drive

So I finally watched the movie “Drive”. While my expectations were certainly low, it blew me away. Film making styles from just about every generation are present in the film. Then there’s the music. I love it. I even went ahead and bought the soundtrack. My only complaint is that the order of the songs on the soundtrack needed to be intermingled a bit more. The songs are all lumped at the beginning and the scores are all at the end which I believe polarize the listening experience.

Bug: MySQL Workbench “fetching…”

While using MySQL Workbench’s SQL Editor, it would only display “fetching…” for the Database Tables, Views, and Routines on one specific server. After doing a search, I discovered others reported this “bug”. It turns out it is due to a incorrectly upgraded MySQL server (d’oh).

The Fix:
From the linux Shell:

$ mysql_upgrade -u<username> -p

Where username is your administrative username. The “p” argument tells it you will be supplying a password. You could supply the password on the command line, but I prefer the masked prompt it displays when not done from the command line.

Basically I think this was a problem with the privilege tables after upgrading.

Multiple Apache Daemons Running on One Machine

The Scenario

Once set in the configuration, the user name in Apache httpd cannot be set for different virtual servers.  To set up a server that hosts virtual servers under one username and others under another, you have two options: multiple apache configurations running as seperate daemons or virtualization.  While virtualization would be more ideal, and may be something to consider in the future, running additional daemons is a bit more accessible for the time being.

Let’s say you have a website, example.com, and a few user web sites that individual users have access to on their own domains or subdomains of a shared domain (for example: user1.websites.com).  Under no circumstances would you want these users to run scripts under the same user name, or have access to the same files as example.com.  suEXEC and suPHP can come into play, but I want a little more separation.

The idea is to have one daemon configured to listen on the usual ports, 80 and 443, serve example.com, and redirect all other requests to an additional daemon listening on ports 8080 and 4443.  The requests can be forwarded using mod_proxy.

The Implimentation

The following steps are for a CentOS 5 and an Apache 2.2.3 setup.

Create a new sysconfig httpd config file, and a new config directory by copying the original httpd files.

$ cp /etc/sysconfig/httpd /etc/sysconfig/httpd-shared
$ cp /etc/httpd /etc/httpd-shared -rf

Now we need an init.d file just like the current httpd file with all instances of /etc/sysconfig/httpd replaced with /etc/sysconfig/httpd-shared. There should only be two instances right next to each other near the head of the script. Below I’ll use sed to replace all instances and export the stream to a new file.

$ sed -e "s/\/etc\/sysconfig\/httpd/\/etc\/sysconfig\/httpd-shared/" /etc/init.d/httpd > /etc/init.d/httpd-shared
$ chown root:root /etc/init.d/httpd-shared; chmod 755 /etc/init.d/httpd-shared

Edit the sysconfig httpd-shared file

$ nano /etc/sysconfig/httpd-shared

Add the following lines:

PIDFILE=/var/run/httpd-shared.pid
LOCKFILE=/var/lock/subsys/httpd-shared
CONFFILE=/etc/httpd-shared/conf/httpd.conf

Edit the httpd-shared httpd.conf file

$ nano /etc/httpd-shared/conf/httpd.conf

Change the listening port and replace the PidFile with the new one. You may also change the username and anything else.

REPLACE:
PidFile run/httpd.pid

WITH:
PidFile run/httpd-shared.pid
REPLACE:
Listen 80

WITH:
Listen 8080

You may want to also add the following for any domains you do not want proxied.

NoProxy .example.com

Now somewhere in the original httpd configuration, you will want to set up example.com like normal. However, you will also have to configure the domains you want served under the “shared” httpd to be properly forwarded with mod_proxy.

In your original httpd configuration file ( I’ll be using /etc/httpd/conf.d/zz02_users.conf ), you’ll want to add the following lines.

<VirtualHost *:80>
  ServerName user1.websites.com
  ProxyPass / http://user1.websites.com:8080/
  ProxyPassReverse / http://user1.websites.com:8080/
</VirtualHost>

ProxyPass forwards all requests for the root URI to the specified domain name (and protocol!). ProxyPassReverse will change the Location, Content-Location and URI headers on HTTP redirect responses.

Now all you have to do is set up the VirtualHosts in the “shared” httpd configuration.

Must Have Desktop Apps

Text Editor

  • Notepad++ – Preferred as of now.  Function List plugin recommended to browse functions.
  • PSPad – recently has been giving me problems with undo/copy/paste

SVN Client

  • RapidSVN – Small, lightweight, agile.  Not as robust as others, but gets the job done and it’s quickness far outweighs any shortcomings.  WinMerge recommended for browsing differences.

SSH/SFTP/SCP

  • PuTTY – The best SSH client.  Recommend the Windows installer.
  • WinSCP – Easily copy files between the preferred SFTP protocol.  Open, edit, and save changes on the fly.

MySQL

  • MySQL Workbench – Good for a simple query, but powerful enough to manage entire databases.  Grant user permissions, view statistics, and more.  Somewhat sluggish.

VNC/Remote Administration

  • UltraVNC – Robust VNC and a great “helpdesk” package creator to distribute to family and friends.  They call the helpdesk creator “Single Click” (signle click documentation, creator).
  • TightVNC – Secure, frequently updated VNC client and server.

Miscellaneous Hacky Stuff

  • ResEdit – Resource editor and extractor.