Making the Dreamhost Nginx Install More Standard

Dreamhost maintains a custom Nginx package that is installed on all of its VPS servers.  The package contains a number of modifications that make it easier for Dreamhost to configure Nginx from a central location.  In addition, the Dreamhost package contains a significantly more recent version of Nginx (1.4 at the moment) compared to what is available in Ubuntu 12 LTS (1.1.4 at the moment).

You can easily modify the Dreamhost configuration files to make Nginx act more like a standard Nginx install.

Find the following line in the /dh/nginx/servers/<<server>>/nginx.conf

include /dh/nginx/etc/config.d/*;

Replace it with the following:

include /etc/nginx/config.d/*;
include /etc/nginx/sites-enabled/*;

You can then create a /etc/nginx/sites-available and /etc/nginx/sites-enabled directories.  Place your vhosts file in the sites-available directory and symlink them to sites-enabled when you want to turn them on.

For reference, this is Dreamhosts default vhost file:

# Vhosts:
 
server {
 listen &lt;&lt;server_ip&gt;&gt;:80;
 
 server_name &lt;&lt;domains_to_host&gt;&gt;;
 
 access_log /home/_domain_logs/&lt;&lt;username&gt;&gt;/&lt;&lt;domain&gt;&gt;/http/access.log combined;
 error_log /home/_domain_logs/&lt;&lt;username&gt;&gt;/&lt;&lt;domain&gt;&gt;/http/error.log error;
 
 root /home/&lt;&lt;username&gt;&gt;/&lt;&lt;domain&gt;&gt;;
 
 # Mitigation for CVE-2013-4547
 if ($request_uri ~ " ") {
 return 444;
 }
 
 index index.html index.htm index.php index.php5;
 include /home/&lt;&lt;username&gt;&gt;/nginx/&lt;&lt;domain&gt;&gt;/*;
 
 # No mirrors - using strict redirects
 if ($http_host != &lt;&lt;domain&gt;&gt;) {
 rewrite ^(.*)$ http://&lt;&lt;domain&gt;&gt;$1 permanent;
 }
 
 autoindex on;
 
 # Disallow access to config / VCS data
 location ~* /\.(ht|svn) {
 deny all;
 }
 
 # Statistics
 location /stats/ {
 alias /home/_domain_logs/&lt;&lt;username&gt;&gt;/&lt;&lt;domain&gt;&gt;/http/html/;
 auth_basic "Statistics Area";
 auth_basic_user_file /home/_domain_logs/&lt;&lt;username&gt;&gt;/&lt;&lt;domain&gt;&gt;/http/html/.htpa$
 }
 
 location /doc/analog/ {
 alias /usr/share/analog/;
 }
 
 # PHPMyAdmin
 rewrite ^/dh_phpmyadmin/([^/]*)/(.*)$ /dh_phpmyadmin/$2;
 
 location /dh_phpmyadmin/ {
 alias /dh/web/phpmyadmin/;
 }
 
 location ~ /dh_phpmyadmin/(.+)\.php {
 alias /dh/web/phpmyadmin/;
 fastcgi_param SERVER_PORT 80;
 fastcgi_split_path_info ^(.+\.php)(/.*)$;
 include /dh/nginx/etc/fastcgi_params;
 set $relpath "index.php";
 if ($uri ~ ^/dh_phpmyadmin/(.+)$) {
 set $relpath $1;
 }
 fastcgi_param SCRIPT_FILENAME /dh/web/phpmyadmin/$relpath;
 fastcgi_pass unix:/home/&lt;&lt;username&gt;&gt;/.php.sock;
 }
 
 # PHP
 location ~* \.(php|php5|php4)($|/) {
 fastcgi_param SERVER_PORT 80;
 fastcgi_split_path_info ^(.+\.(?:php|php5|php4))(/.*)$;
 if (!-e $document_root$fastcgi_script_name) {
 return 404;
 }
 include /dh/nginx/etc/fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_pass unix:/home/&lt;&lt;username&gt;&gt;/.php.sock;
 #pragma php_launch &lt;&lt;username&gt;&gt;
 }
 
}

 Starting PHP FastCGI

Dreamhost uses a custom script to instantiate the PHP-Fastcgi instances for each user.  If you do the above customizations, the Dreamhost method will no longer work.

To overcome this, you will need to install spawn-fcgi and follow the instructions here:

https://www.linode.com/docs/websites/nginx/nginx-and-phpfastcgi-on-ubuntu-12-04-lts-precise-pangolin

You will need to coordinate the PHP user and the Nginx web user so that they can read each other’s files.  Personally, I only want a single web server user www-data.  You will need to adjust the Nginx.conf accordingly.

Leave a comment

Disable Dreamhost Panel Management on VPS

A Dreamhost VPS is nearly indistinguishable from a dedicated server.  Dreamhost allows users full root access to the VPS servers, so you are free to manage them as you see fit.

However, certain configuration files related to users, and web servers, are completely overwritten whenever a Panel change is made.  Plus, there may be other instances in which Dreamhost will overwrite your changes.  As a result, if you want to manage these features on your server, you need to exclude Dreamhost from managing them.

Danger Lies Beyond This Point

It is self evident, but if you elect to exclude Dreamhost from managing your server, you are responsible for making sure things don’t break.

Get Root Access

To get root access find the following section in the panel:ssh menu

 

and add a new key.

Details on how to make or use SSH Keys are well covered on the internet.  If you don’t already know how to work with SSH Keys, you may want to consider if you are really prepared to handle the management of your server.

Once the SSH Key has been installed, log in as root to your VPS.  Once there run the following command:

mv /root/.ssh/authorized_keys2 /root/.ssh/authorized_keys2.disabled

Dreamhost will no longer be able to access your server.  You can still use the Dreamhost Panel to adjust the memory and disk space allotments for your VPS.  However, adding domains, user, one-click installs, and all other related items will no longer work.

Posted in Programming | Tagged , | Leave a comment

Dreamhost VPS Disable Jabber

Even with Jabber disabled in the VPS configuation, you will still see jabber processes running on your VPS.  They eat up about 30 MB of RAM, but very little processing power.

You can easily disable them by running the following either as root or through sudo:

/etc/init.d/ejabberd stop;
update-rc.d -f ejabberd remove;
Posted in Programming | Tagged , , | Leave a comment

Dreamhost Triples the Memory on VPS

So I missed the announcement somewhere, but somewhere in the past few days, Dreamhost significantly upgraded their VPS offering.  Previously you got 300 MB of RAM and unlimited disk space for $15/month.

A few Trade-offs

Now Dreamhost is advertising 1GB of RAM but only 30GB of storage.  It looks like they are continuing to move away from their “unlimited everything” from their younger days. Personally, I am will to sacrifice the unlimited storage as I am currently using about 3GB of storage.  The new machines also use Ubuntu 12, but that was a change almost a year ago.  This is a bigupgrade from my Debian 5 VPS.

You will lose your usernames

A bigger downside is that it looks like you will need to create a new VPS instance and move all of your stuff over and then delete your old instance.  The real bummer of this, is that Dreamhost doesn’t allow usernames to be reused again, EVER.    So you can’t move your username and you can’t delete and recreate them on the new machine.  (I do have a hack to get around this, but more on that another day)

A Long History

The other sad part is that I will be losing my comparatively low VPS number.  My original VPS had a 10,000 number, the new one is in the 380,000 range.

http://www.dreamhost.com/dreamscape/2014/11/13/managed-vps-now-all-ssd-and-more-awesome/

Posted in Miscellaneous | Tagged , | Leave a comment

Rigid R4510 Table Saw Impressions

Why I picked the RigidRigid R4510 Table Saw

I have been looking to buy my first table saw.  I am interested in getting started in hobby woodworking.  My plan is to start with smaller furniture projects and see how I do and how they turn out.  My first planned project is to build a night stand.

Since I am starting out, I decided to start with a cheaper table saw.  I realize it will not be professional quality, but there is no sense in spending thousands of dollars if I end up hating or being very bad at woodworking.  So my goal is to spend around $400-$600 on a saw.  I also have a smallish work space, about the size of a single car garage, so having a table saw that could be moved out of the way, might be helpful.

Two years ago I purchased this Dewalt Miter Saw.  I have used it mostly as a “chop saw” to handle repair and remodeling projects around the house.  But I was very pleased with the clean and accurate cuts that it produced.  I also own a Dewalt reciprocating saw that I like as well.  So I initially considered the Dewalt table saws.  My list of contenders was:

  1. Dewalt DW745 – Most popular table saw on Amazon.  Pros: The most inexpensive option at $299.  The Dewalt name.  Cons: No stand.  Very small (20 inch) rip capacity.  I am not sure Dados are supported.
  2. Dewalt DWE7480XA – Pros: Slightly wider rip (24 inches) and it includes a stand.  Cons: $399 ($100 more) for those two features.  Still a small rip capacity.  The stand lacks wheels.
  3. Dewalt DWE7491RS – Pros: Super wide rip (32 inches) and a rolling stand. Cons: nearly $600 for these features ($577).  At this price, there are lots of contenders.  The rolling stand requires manually folding up legs.
  4. Ridgid R4510 – Pros: While it lists for $679 on Amazon, $399 for a refurbished one, I found a brand new one at Home Depot for $399.  It has a rolling stand and decent rip at 25 inches advertised (closer to 26.5 in actual use).  Cons: Not a brand I am familiar with.

Needless to say, I went with the Rigid.  The price/feature ratio is what sold me.  I would have loved to have purchased the big Dewalt, but I couldn’t justify spending $200 more at this point.  If I really use this a lot, I am sure I will want a nice ($1000+) saw and not any of these.  So I consider this a starter saw.

My First Impressions

  1. The thing is freaking heavy (100+ lbs).  You will need help moving the box around.
  2. The assembly instructions for the stand are a joke.  It is a single diagram with a dozen bullet points.  Best I can tell, the first few bullet points come pre-assembled (maybe these instructions were provided with older different packaging?).  The rest of the bullet points are confusing as hell.  Get a six pack ready for when you finish.
  3. The stand is really convenient.  Given the weight, I thought raising and lowering the stand would be a pain, but it is remarkably simple.
  4. The saw arrived fully calibrated and aligned.  I checked the blade alignment and it was straight and true on all angles.  The fence is perfectly true, even out to the full 26.5 inch rip.  (For whatever reason, I seem to get about 1.5 inches more capacity than advertised.
  5. The table height is 35 inches.  This is just odd.  Nearly all table heights are 36, why this is one inch shorter is beyond me.  I plan to insert some wood spacers between the stand and the saw to raise it up to 36 inches.
  6. There is no soft start on this saw anymore.  But it turns out my 15 amp miter saw also lacks soft start.  It isn’t a problem in my shop, I have 20 amp breakers that seem to handle the load just fine.

Initial Conclusions

I like the saw.  After I spend more time I will write up some more detailed comments.

Best I can tell, the base Dewalt model is nearly identical to the high end Dewalt model in the sawing and motor components.  But unfortunately, they really charge you a hefty premium for simple features like additional capacity.

Initial impressions after unboxing and setting up the Rigid R4510 Table Saw.
Rigid R4510 Table Saw
Date Published: 10/03/2014
While heavy and difficult to assemble, the table saw seems sturdy, accurate, and feature-rich.
4.5 / 5 stars
Tagged , , | Leave a comment

The Perfect Single Meal Soylent Container

I was a one week supply backer and last week I received my first shipment. My personal use for Soylent is as a Breakfast replacement and so far it has been working well, but I will wait a few more days to post my initial reactions to the product.

Based on my usage, I went looking for a good single meal travel container for Soylent. I found the 20 ounce Blender Bottle to be the perfect size. It holds a tight seal, and when filled with a single meal there is about an inch or so of extra airspace to allow for shaking.

On a related note, the free pitcher that comes with the initial shipment of Soylent is just okay. In fact my initial reaction was that it was very cheap. The Soylent logo is provided as a sticker that you have to apply yourself and the plastic feels only slightly better than a disposable water bottle. After using it for a few days, impression has improved somewhat, the leak-proofness is very strong and the ease of opening and closing the spigot is nice but it still seems rather cheap.

My process has been to mix up the entire three meal quantity in the large pitcher and then transfer it to my small single use pitcher each morning. I assume mixed Soylent in the fridge will last three days?

Posted in Soylent | Leave a comment

Automatically Clear/Sync Hangouts Notifications Between Android and GChat

I have been plagued by this problems for months.  I frequently searched for a solution but found nothing until today.

The Problem

I am signed into hangouts on my Android phone and use Gchat (the chat client inside the web version of Gmail).  Throughout the day I use Gchat.  At the end of the day, when I look at my phone, there is a hangouts notification for the first message of each separate Gchat communication.  I have to manually clear the hangouts notifications on my phone, even though I have both seen and responded to the messages in Gchat.

The Solution

I can’t claim credit, but buried on this Google Groups page, I found the answer.  I have no idea why such an important solution is buried so deeply inside a groups post.

The solution in that post is hard to follow, what you want to do is “enable hangouts in gmail.”  Google does provide a nice instruction set for enabling hangouts in gmail.

The Results

It works!  When I get a new hangouts message, I get a notification on my phone and in Gmail.  If I click on or respond to that message in Gmail, the notification is cleared from my phone.

The only downside, is that the new interface for hangouts in Gmail is significantly different than the old Gchat interface.  It is too soon to say whether I think this is a good or bad thing.

Posted in Miscellaneous | Leave a comment

Surprise! CA Bar Doesn’t Takes Moral Character Applications Very Seriously

To be clear, I am being entirely sarcastic when I say “Surprise.”

I just received the Moral Character Questionnaire for a friend who is applying to take the California Bar Exam this summer.  By way of background, the Bar is required by statute to assess the moral fitness of Bar applicants.  They of course don’t want to admit any applicants that may further impugn the reputation of lawyers in California.

To that end, each applicant must submit an Application for Determination of Moral Character which costs a whopping $500.  The application asks the standard “have you ever been convicted of a felony” questions.  In addition each applicant is required to submit a handful of names of people who can attest to the applicant’s moral fitness.

Here comes the part where it becomes obvious that the Bar doesn’t put a whole lot of effort into this.  Below is a photo of the questionnaire I received along with the return envelope that was provided.

ca_bar_stamp

Note that the envelope requires postage.  Seriously?  Who has postage for snail mail anymore?  Beyond that, how many of these things does the Bar send out per applicant?  I can’t imagine that it exceeds ten.  Ten pre-paid envelopes would cost a whopping $5.00 or 1% of the application fee.  Given the lack of postage, I bet at least half of the people who receive these don’t even respond.

If that were not silly enough.  When I went to put the questionnaire into the provided envelope, I discovered another nugget of joy.  The damn questionnaire is too big for the provided envelope.

ca_bar_env

How many years have they been doing this?  Has the Bar not noticed the problem when they receive these envelopes returned back to them?  Maybe no questionnaires are ever returned, or maybe the Bar doesn’t read them.

The level of intellectual sophistication demonstrated by the Bar is mind blowing.  I sure hope they put more effort into their other endeavors.

Leave a comment

World Sunlight Map with Real Cloud Data and Accurate Seasons

earth For a long time I have used an image similar to this one as the background on my phone.  The image accurately represents the current cloud formations and sunlight regions on the planet.  I came up with the idea from the following page: http://www.die.net/earth/.  There is a good explanation on how to do this at http://www.die.net/earth/how.html, so I won’t repeat it here.

If you want to purchase an expensive wall hanging version of this map amazon will sell you one for $3000+, Boardroom Sunlight Map.  Although it seems to me that you could purchase a Flat Screen TV and a Raspberry Pi and save yourself $3000, but hey, that is just me.

For a few years, I have used a Tasker profile on my Android phone to download a copy of this image once an hour.  Tasker then updated the background on my phone.  I find the image to be both beautiful and at least marginally functional.  Plus I enjoy the nerdiness of it.

A few months back I switched to a Nexus 4 and discovered that the image available from die.net was lower resolution that my phone.  This gave my the impetus to “roll my own” customized version.

I doing so I discovered the beautiful series of Blue Marble images that NASA has made available.  The The Blue Marble: Land Surface, Ocean Color and Sea Ice image was by far my favorite, but I noticed that NASA has since added monthly images that more accurately represent the snow pack and foliage for each month of the year.  Unfortunately, these images seem darker, and less vibrant than my favorite image.  Specifically, the greens and browns of the land masses looked very dull.  Additionally, the ocean was much more black and devoid of any character.

Luckily NASA aligns the images very precisely.  I first downloaded each monthly image and tweaked it in darktable.  I increased the exposure value to make them brighter, and increased the color saturation of the greens, browns and oranges.  The resulting images were much more vibrant.  Then to fix the ocean, I simply placed my favorite image into Gimp and overlayed the new images with a mask for the ocean over them.  The results were spectacular.

Then I simply added 12 different config files for xplanet and made 12 different cron jobs depending on the month.  Now I have my own custom World Sunlight Map with more accurate seasonal representation of the land mass.

Posted in Programming | Leave a comment

A Temperature Controlled Whole House Fan with MisterHouse

MisterHouse Web Interface for a Temperature Controlled Whole House FanThe main feature of MisterHouse that sets it apart from other home automation systems is the ability to customize practically every aspect of the system.  The following example is a perfect demonstration of this.

I recently purchased a whole house fan, basically a giant fan that sucks hot air out from the highest point in my house. They are great if you live in a climate with cool nights.

The controls for my fan were very basic, an on/off switch and a two-speed setting.

With Misterhouse, I created an “auto” mode which will only turn on the fan if both the indoor temperature is above a defined threshold and the outdoor temperature is 5 degrees below the indoor temperature.

This is how I did it.

Starting Materials
– A Whole House Fan
– 2 IOLincs, (1 for on/off, 1 for fan speed)
– A MisterHouse enabled indoor temperature sensor (I used my Insteon Thermostat)
– A MisterHouse enabled outdoor temperature sensor (I used data from a neighbor’s weather station through weatherunderground)

I created the following items in my mht file:

GENERIC, house_fan, HVAC|WHF_Group
GENERIC, house_fan_temp, HVAC|WHF_Group
GENERIC, house_fan_setpoint, HVAC|WHF_Group
GENERIC, house_fan_ambient, HVAC|WHF_Group
INSTEON_IOLINC, DE.AD.BE:01, whf_main, HVAC
INSTEON_IOLINC, DE.AD.BE:01, whf_speed, HVAC

I also had the following items already setup:

$upstairs_thermo_temp #the temperature upstairs
$w_temp #the outside temperature

First, I set the available states for my generic objects:

$house_fan-&gt;set_states('on', 'off', 'auto');
$house_fan_speed-&gt;set_states('high', 'low');
$house_fan_temp-&gt;set_states('cooler', 'warmer');

Then I tied my generic items to my Insteon Devices:

$house_fan-&gt;tie_event('$whf_main-&gt;set("on")', "on");
$house_fan-&gt;tie_event('$whf_main-&gt;set("off")', "off");
$house_fan_speed-&gt;tie_event('$whf_speed-&gt;set("on")', "high");
$house_fan_speed-&gt;tie_event('$whf_speed-&gt;set("off")', "low");

Then I tied my Generic temp item to my Generic setpoint item, and inserted some custom code:

$house_fan_temp-&gt;tie_event('house_fan_temp_change($state)');
sub house_fan_temp_change {
	my ($state) = @_;
	if ($state eq "warmer"){
		$house_fan_setpoint-&gt;set(int($house_fan_setpoint-&gt;state) + 1);
	} elsif ($state eq "cooler") {
		$house_fan_setpoint-&gt;set(int($house_fan_setpoint-&gt;state) - 1);
	}
}

By doing this, I can have a nice cooler and warmer button in the web panel.

Finally, every minute I check to see if the device is in “auto” mode and whether or not it should turn on:

if ($New_Minute){ 
	if($house_fan-&gt;state eq 'auto') {
		if (int($upstairs_thermo_temp-&gt;state) &gt; int($house_fan_setpoint-&gt;state) &amp;&amp;
		(int($upstairs_thermo_temp-&gt;state) - 5) &gt; int($w_temp-&gt;state)) {
			if ($whf_main-&gt;state eq 'off') {
				::print_log("[a1housefan.pl] Auto: Turning on fan");
				$whf_main-&gt;set("on");
			}
		} else {
			if ($whf_main-&gt;state eq 'on'){
				::print_log("[a1housefan.pl] Auto: Turning off fan");
				$whf_main-&gt;set("off");
			}
		}
	}
}

The result, is a temperature controlled whole house fan.  The image above is a screen shot from my web interface.

Posted in Home Automation, Programming | Leave a comment