Categories
Technology Weblogging

Web Server 101 for Ghost

update

I disabled the Ghost weblog because I don’t want to maintain two different weblogging software applications, and Drupal is my primary weblogging software.

The configuration listed here was sound and reliable for well over six months.

—-

Recently I installed Ghost on my server. Ghost is a Node.js weblogging tool that you can host yourself or have another organization host for you.

It’s not a complicated application to install. There’s even a How to Install Ghost web site, with handy instructions for installing Ghost in various environments.

Take my environment, which is Ubuntu Linux hosted on a Linode VPS. You could order a brand new VPS, but chances are your server is already set up, and you’re just looking to install Ghost.

You have to install Node.js first, of course. Then you download the Ghost source code, and install the application, using the following steps:

mkdir -p /var/www/
cd /var/www/
wget -O ghost.zip https://ghost.org/zip/ghost-latest.zip
unzip -d ghost ghost.zip
cd ghost
npm install --production
cp config.example.js config.js

Next you edit the configuration file, changing the default IP and port values to ones that allow people to access your new Ghost weblog:

host: '[your Linode public IP]',
port: '80'

Lastly, start that puppy up:

npm start --production

 

Now, you’re all set, good to go, blasting full ahead on all cylinders…

…right for that wall that is about to hit you, hard, in the face.

A reality check on that environment

Let’s back this sweet scenario up to, oh, step 1: your environment.

True, you could be installing Ghost in a brand new environment with nothing else installed. Chances are, though, you’re installing Ghost in an existing system that is already running a web server. Chances are also good the web server you’re running is Apache, which is running on port 80, the same as your new Ghost installation.

So what happens when you try to run Ghost on the same port you’re using with Apache?

If you try to start the application withnpm, you’ll get an almost immediate error response signaling that an unhandled error event has occurred, and to contact the Ghost author. If you try to start the Ghost application via another tool, such asforever, you may not see an immediate problem at the command line, but if you access the Ghost site via a browser, you’ll get a 503 “Service Temporarily Unavailable Error”.

You’re getting an error because you can’t run both web services at the same port. You then have two options to run your Ghost weblog. Option 1 is to shut down Apache or install Ghost on a machine where Apache is not installed, and then you can run Ghost at port 80. The second option is to find a way to get Apache (or other web server) and Ghost to co-exist.

Let’s take a look at that first option: running Ghost in a stand alone environment at port 80.

Running Ghost in a Stand Alone Environment

If you don’t have Apache installed, or no other web service running at port 80, you could follow the steps I gave earlier, and you might expect Ghost to start. You might, but you could be in for a surprise.

If you try to start Ghost with a line such as the following:

npm start --production

You’ll most likely get an error. If you try to start Ghost up directly, using Node, you’ll find that the error is EACCES, “permission denied”. The reason why is that port numbers below 1024 are what is known as privileged ports, requiring root permission. When you tried to start up Ghost as a normal user, you lacked the permissions to start the service.

You might be tempted to use sudo to start the Ghost application:

sudo npm start --production

And yes, Ghost should be alive and well and running on port 80. But this command just triggered a visceral response from security minded web developers, because now Ghost (which is currently in beta development and unlikely to be hardened) is now running with root privileges. Not even Apache, hardy veteran of the web wars that it is, responds to web requests with processes running with root privileges.

Behind the scenes, when you start Apache as root, it spawns a worker thread that handles a web request. This worker thread runs with the privileges of a non-root user, typicallywww-data. If you’re running a Linux server, you can issue the following command and see that one Apache process is running as root, while other child processes are running as the Apache user (www-data).

ps -ef | grep apache

Other web servers, such as Nginx, operate under the same principle.

So, what do you do if you want to run Ghost at port 80?

Well, you can start Ghost up on port 2368 (the default port) and then go where most folks don’t dare to go by tweaking iptables to redirect port 80 to port 2368, or something similar. Bottom line, though, is you just don’t run Ghost as a stand alone web server/application, period.

In an issue thread at github the architects behind Ghost have stated that they see Ghost as an application, not web server. As such, they don’t recommend that people run it directly, as a web server. Instead, they recommend using Ngnix or Apache as the web server, and then reverse proxy to Ghost. Both Nginx and Apache are hardened from a security perspective, and both do a better job providing other services the Ghost folks won’t be providing.

The Ghost folk recommend using Ngnix,and you can use Ngnix as reverse proxy for both Apache and Ghost if you’re hosting Apache applications. For myself, I don’t need the extra level of complexity or the performance boost that Ngnix can provide for static files, so I decided to go with Apache as reverse proxy. I’ll cover the steps I took, but first, let’s return to that running instance of Ghost.

Running Ghost Forever

My Ghost weblog is currently running at Shelley’s Toy Box. Shelley’s Toy Box is my hack and trash domain where I’ll try new things. I thought about getting a separate VPS for it, but can’t really afford it at this time, so I’m making do with a virtual host for now.

Ghost is running at port 2368, the default. Yes, this means you could also access the Ghost weblog at http://burningbird.net:2368, and completely bypass Apache doing so, but we’ll get to that in a little bit. For now, I have started Ghost usingforever:

forever start  -l forever.log -o out.log -e err.log index.js

If Ghost crashes and burns,forevershould start it back up. However, if the server, itself, gets re-booted, Ghost isn’t restarted. Luckily, since I’m running Ubuntu, I can use Ubuntu’s Upstart to re-start Ghost withforever.

I created a simple file named ghost.conf in /etc/init, with the following text:

# /etc/init/ghost.conf
description "Ghost"

start on (local-filesystems)
stop on shutdown

setuid your-userid
setgid your-grpid

script
    export HOME="path-to-ghost"
    cd path-to-ghost
    exec /usr/local/bin/forever -a -l path-to-logfiles/forever.log --sourceDir path-to-ghost index.js

end script

Now when my system re-boots, the Ghost weblog restarts. And it restarts as my non-privileged user thanks to thesetuidandsetgid.

Using Apache as reverse proxy

Apache has a good description of forward and reverse proxies, but simply stated, a reverse proxy allows web users to access both Apache and Ghost in our servers, seemingly on the same port 80.

I’ve not used Apache as a reverse proxy before, so this is new territory for me. After going through variations that left my server crawling on its knees, I found a routine that seems to work well, or at least, not work badly.

First, I had to enable bothmod_proxyandmod_proxy_http:

sudo a2enmod proxy
sudo a2enmod proxy_http

I’m not turning on forward proxying, so didn’t uncomment any of the lines within the proxy.conf file in Apache’s mods-available subdirectory.

I already have several virtual hosts configured, so it was a simple matter of creating another for Shelley’s Toy Box. In the settings, I turnProxyRequestsoff, just because I’m paranoid (it shouldn’t be on), and then add myProxyPassandProxyPassReversesettings:

<VirtualHost ipaddress:80>
    ServerAdmin shelleyp@burningbird.net
    ServerName shelleystoybox.com

    ErrorLog path-to-logs/error.log
    CustomLog path-to-logs/access.log combined

    ProxyRequests off

    <Location />
            ProxyPass http://ipaddress:2368/
            ProxyPassReverse http://ipaddress:2368/
    </Location>
</VirtualHost>

I specify my ip address for the virtual host, because I have used two IP addresses in the same server in the past, and may again in the future.

Once I enable the site and reload Apache, I’m good to go.

a2ensite shelleystoybox.com
service apache2 reload

The only issue left is the fact that people can also access the Ghost weblog directly using other domains and the 2368 port (i.e. http://burningbird.net:2368). Since I’m running Ubuntu and am using iptables, I add the following rule:

iptables -A input -i eth0 -p tcp --dport 2368 -j DROP

This prevents direct access of port 2368, while still allowing Apache to proxy requests to the port. I maintain it between boots using iptables-persistent. However, it is modifying iptables, so you have to balance modifying iptables against people accessing the site via another site domain and direct access of the port.

Ghost as Weblog

Ghost is an important addition to the Node.js community because weblogging software appeals to a broad range of interests and experience levels. That latter is particularly important because we’re now seeing with Ghost the issues people face when running a Node.js web application, particularly in a world where Apache is so ubiquitous. Ghost is a learning experience, and not just for the Ghost developers or users.

Having said that, at this time I don’t recommend Ghost for people who are only looking for a weblogging tool. Ghost is still in the early stages of development and lacks much of the basic functionality we’ve come to associate with weblogging software. However, if you’re interested in Node.js development and are looking to get in on the ground floor of a weblogging application (before all the complex bells and whistles are added), Ghost can be a fun and educational alternative to Drupal or WordPress.

Whatever you do, though, don’t run Ghost with root privileges. It’s no fun to get your butt bitten off.

Categories
Documents Legal, Laws, and Regs

Don’t Mess with one of the E-Discovery Triumvirate

I dabble more than a little in the legal world, but that’s OK, because the legal world dabbles quite heavily in the world of technology. Nowadays, metadata is the smoking gun in court, and e-discovery is the ballistics test that uncovers it.

The concept of e-discovery, or electronic discovery is simple: it is the discovery, identification, and production of electronically stored information (ESI). However, the execution can be involved, complex, and frequently contentious.

Take for example something seemingly simple and benign: the keyword search. If you and I want to find out about something online, we open up Google or Bing and type in some words, such as “e-discovery keyword search”. We typically get back a ton of links, in order of relevancy. We pick and choose from among the links to find what we need. Rarely do we have to go beyond the first few pages to get the information or resources we’re looking for.

In a legal case, though, what keywords are used can trigger a conference between parties, and even hearings with the judge. If there’s too much material produced, both parties may want to refine the keywords; too little material produced, and the parties may question what keywords were used, or whether the use of keywords is even useful.

In a white paper titled Where Angels Fear to Tread: The Problems of Keyword Search in E-Discovery (pdf), the author notes:

The heavy reliance on keyword search in e-discovery places an enormous burden on today’s legal teams. Inconsistencies in language, inefficiencies in search techniques and software user interfaces, which conceal more than reveal, place the attorney in a difficult position: determining what is relevant in a compressed timeline using obsolete tools and tactics. These outdated tools are a key factor behind the spiraling costs and risks associated with e-discovery.

There’s an entire science devoted to keyword searches within the legal community. As for other metadata, oh my goodness, let’s not even get started.

The use of e-discovery was an important component of the Ringling Brothers/animal welfare group Endangered Species Act case (now titled “AWI et al v. Feld Entertainment”). It has continued as an important component of the fees allocation process for this same case.

In a decision that is both unusual and controversial, the judge in the case, Judge Emmet Sullivan, decided that the animal welfare groups should pay attorney fees to Feld Entertainment for the 9+ year court case. After many months, Feld’s lawyers submitted their fee request in a set of filings spanning thousands of pages. (See my copy of the case history, starting with docket number 635.) Not only is the $25 million dollar (and change) fee request large, it’s also been provided in a not useful format: PDF documents with manual redactions, and color coding (example).

The animal welfare groups asked for something a little more useful:

The Fee Petition, which spans at least four-and-a-half four-inch binders, includes nearly two thousand pages of time records and invoices as well as numerous other Excel spreadsheets and tables. The time records and invoices, accounting tens of thousands of attorney and staff hours, are so voluminous that FEI’s paid experts were unwilling to review them. Plaintiffs, unfortunately, do not have the luxury of limiting their review of the time records and invoices to a determination that the “time entries provide level of detail . . . that is typical of appropriate block billing practice,” as Mr. Millian did, see D.I. 664 at 18, or to review only a supposedly “representative sample of litigation activities” limited to three brief periods of time, as Mr. Cohen did, see D.I. 663 at 11-12.5 Rather, Plaintiffs and their experts must scrutinize all of the hours that Feld now seeks to pass on to them.

As Feld’s experts make clear, and as Plaintiffs’ counsel explained to counsel for Feld, this is not a task that can be accomplished by reading the PDF versions of spreadsheets and invoices that Feld included in the Fee petition. It can only be accomplished via computer assisted analysis of the underlying time records using a program such as Microsoft Excel, which will allow Plaintiffs’ counsel and/or experts to (i) sort the data, (ii) perform complex searches within the data, and (iii) mathematically compare time entries across (for example) timekeepers, law firms, and parties to the litigation.

There is no commercially available computer program that can take a PDF of an Excel spreadsheet, much less a PDF of actual invoices, and generate a functioning spreadsheet containing the underlying data. Accordingly, the only way Plaintiffs could independently recreate the time records of Feld’s counsel would be to manually reenter tens of thousands of rows of numbers and text, a process that would take even highly-experienced data entry personnel hundreds to thousands of hours. It would be patently unfair to require Plaintiffs to undertake such an effort to recreate data that Feld’s counsel already have at their fingertips. Moreover, because an analysis of Feld’s billed time is one of the first steps needed to craft Plaintiffs’ response to the Fee Petition, requiring Plaintiffs to replicate Feld’s time records would inject months of needless delay into the fee application process, in addition to creating needless, and substantial, additional expense.

Feld’s lawyer’s response begins with:

Plaintiffs’ second request is for FEI to re-create all of the time entries for Fulbright (JS Ex. 31 and 32), Covington (EG Ex. 1), and Troutman Sanders (“Troutman”) (CA Ex. 2) in
sortable Excel spreadsheets because Plaintiffs say they want to “sort the data” and “perform complex searches.” Mot. at 6-8. These requests should be denied because: (1) the documents do not exist in sortable Excel format, (2) Excel format would not protect FEI’s privilege redactions that Plaintiffs cannot and do not challenge; (3) Excel format would not reflect the color-coding of the exhibits; and (4) FEI is not obligated to undertake the time, effort, and expense of creating new documents, to Plaintiffs’ specifications. It is not necessary for Plaintiffs’ response to the Fee Petition, and if they want to have such charts, they can create them themselves. JS Ex. 32, EG Ex. 1, and CA Ex. 2. These exhibits contain the time entries that were sent as part of invoices to FEI, and were produced to Plaintiffs in .pdf files, which is the same format in which they were sent to the client (or in some cases, the invoices were sent to the client in paper, in which case FEI provided a .pdf to Plaintiffs). The invoices do not, nor have they ever, existed in a sortable Excel format – a fact that FEI’s counsel represented to Plaintiffs. While the .pdf files are not sortable, however, they are word-searchable, as any Adobe document is. But as Plaintiffs themselves argue, there “is no commercially available computer program that can take …. a PDF of actual invoices, and generate a functioning spreadsheet containing the underlying data.” Mot. at 7. So Plaintiffs demand the creation of a document that does not exist, which is a requirement that is non-existent even within normal Rule 26 discovery on the merits of a case, let alone once the case has concluded and is in the final phase of assessing legal fees for frivolous and vexatious litigation.

The legal document goes on for several more pages, with the lawyers expressing increasing umbrage at the animal welfare groups’ request.

If the sheer volume of words and the level of outrage were any influence, a judge might be moved to side with Feld’s lawyer, John Simpson, from Norton Rose Fulbright. But the judge handling the fee allocation, Magistrate Judge John Facciola, isn’t just any judge. He’s one of three judges respectfully known as the e-discovery triumvirate—three men known far and wide for their expertise related to e-discovery.

And Judge Facciola was just a tad skeptical about Feld’s lawyers lamentations:

To that end, I will hold a one day evidentiary hearing, at which I expect knowledgeable representatives, such as billing database managers, from 1) Fulbright, 2) Covington, and 3) Troutman Sanders to be prepared to demonstrate the billing software used during their representation of FEI in the instant action. I also expect the representatives to be prepared to testify to the following issues:

1. Explain and demonstrate live (e.g. not in a PowerPoint presentation but in the actual database) how, within their particular software program(s), an individual timekeeper
makes an entry; what is recorded in that entry; how that entry is saved; who reviews that entry; how that entry is edited or altered for privileges or in an exercise of billing discretion; how that altered entry is saved; and finally, in what format the final bill is sent to the client.

2. Explain why that data saved within their particular software program(s) is NOT, through the use of commercially available software, capable of being converted into a sortable Excel-compatible delimited value spreadsheet format such as comma-separated value (CSV).

3. Explain why, if there exists data that was only saved in a .PDF format, it is NOT, through the use of commercially available software, capable of being converted into a sortable Excel-compatible delimited value spreadsheet format such as comma-separated value (CSV).

A noticeably subdued response indicated that the entries in Excel spreadsheet format would be forthcoming.

Categories
Books JavaScript

JavaScript, not a ‘real language’

Simon St. Laurent and I have been discussing that exciting upcoming conference, DHTMLConf.

Party like golden sparkles following the mouse cursor is cool again!

If you’re going to JSFest, how can you not go to DHTMLConf? This is a conference celebrating a time when all of the technologies we take so seriously now, were fun!

Simon is going, and is taking along a copy of his old Dynamic HTML book he managed to find. That made me dig around online for anything on my old books, including my Dynamic HTML book (1998), as well as my earlier (1996) JavaScript How-To.

I had to laugh when I saw the marketing blurb attached to the JavaScript How-To book at Amazon:

JavaScript is the ultimate in web eye-candy. It is not a real programming language such as Java, and it isn’t really essential for web site development, but it sure is a lot of fun for tinkerers.

Categories
Legal, Laws, and Regs

Koster’s Missouri Egg Challenge

Update: On March 20th, the plaintiffs in one of the cases (Rocky Mountain Farmers Union et al v Corey et al) referenced in this work, have petitioned the Supreme Court to hear its appeal.

Update: On March 5, Iowa, Oklahoma, Kentucky, Alabama, and Nebraska joined with Missouri in an Amended Complaint. The arguments are the same, the primary difference is the addition of other states. My arguments remain the same with a caveat that multiple states being involved does not add weight to the complaint. Well, other than the tax payers of these states should also express their curiosity as to why tax payer money is funding a legal fight benefiting one select industry.

Earlier: On February 3rd, 2014, the Attorney General for the state of Missouri, Chris Koster, filed suit in the Eastern District of California’s District Court challenging one of California’s egg laws. Some of the news stories about the lawsuit stated that Koster is challenging California’s well known Proposition 2, which ensures better living conditions for egg-laying hens. However, the Missouri AG is really challenging AB 1437, which was passed by the California legislature in 2010 in order to ensure that all shell eggs sold in California, regardless of origination, meet minimum living standards for the hens that lay them.

According to the Missouri complaint, AB 1437 violates the “dormant” Commerce Clause, by enacting a state law that discriminates against interstate or foreign commerce. But rather than go against the general context of the text, the complaint is targeting the alleged reasoning behind passing AB 1437 (to ensure all shell egg producers follow the same minimum requirements), as well as the timing (in-state producers received 2,249 days to come into compliance, while out of state producers received 1,640 days). The implication is that the law is “protectionist”, protecting California producers to the detriment of Missouri producers.

The complaint makes much of a report from the California Department of Food and Agriculture, which warned about a possible Commerce Clause challenge to AB 1437. In the report, the CDFA stated that the state might need to prove its allegations about food safety and cage size in order to avoid a constitutional challenge.

Pre-law warning aside, the case is going to be a difficult battle for the Missouri AG. The plaintiffs have to show that the law is deliberately discriminatory, or, failing this, that the out-of state producers’ pain outweighs the in-state benefits. In 2012, an in-state egg producer sued California because of Proposition 2, stating that the law was both unconstitutionally vague and in violation of the Commerce Clause. The lawsuit, William Cramer v. Edmund G. Brown, et alwas dismissed with prejudice by Judge John Walter who, in his decision, quoted from another case, Pacific Northwest Venison Producers v. Smitch:

If the regulations discriminate in favor of in-state interests, the state has the burden of establishing that a legitimate state interest unrelated to economic protectionism is served by the regulations that could not be served as well by less discriminatory alternatives…In contrast, if the regulations apply evenhandedly to in-state and out-of state interests, the party challenging the regulations must establish that the incidental burdens on interstate and foreign commerce are clearly excessive in relation to the putative local benefits.

The Cramer v. Brown lawsuit was about Proposition 2, which focuses on the animal welfare aspect of the regulations:

The purpose of this act is to prohibit the cruel confinement of farm animals in a manner that does not allow them to turn around freely, lie down, stand up, and fully extend their limbs.

Though the stated basis for both California egg laws differs, they are complementary, with an end result that’s the same: a minimum set of standards governing the environment for hens whose eggs are intended for human consumption within California. .

Throughout the Koster complaint, much is made of ancillary reports and publications related to AB 1437 and the fact that the law levels the playing field for California egg producers. This actually forms the basis for the legal challenge: that the bill only impacts on producers external to the state (since Proposition 2 impacts on producers internal to the state), and therefore places an undue burden on these out-of state producers.

The legislative history of AB 1437 suggests that bill’s true purpose was not to protect public health but rather to protect California farmers from the market effects of Prop 2 by “leveling the playing field” for out-of-state egg producers.

However, Koster’s legal challenge doesn’t demonstrate how out-of state producers are economically disadvantaged in relation to in state producers, other than the in state producers had longer to implement changes. Even then, the complaint text is breathtakingly disingenuous when it claims, “If Missouri farmers want to continue selling eggs in the California market on January 1, 2015…those farmers need to begin making the necessary capital improvements to their farms now…”

Well, yes, but then Missouri farmers have been aware of the 2015 deadline since July of 2010 in order to make those changes. That Koster didn’t decide to file the lawsuit until now is more a measure of *Missouri politics than logistical impossibilities.

What the complaint does mention is that Missouri egg producers had an advantage over California egg producers after Proposition 2 was passed, and it was the loss of this advantage that led to violation of the Commerce Clause:

63. AB1437 and 3 CA ADC § 1350(d)(1) violate the Commerce Clause because they are protectionist measures intended to benefit California egg producers at the expense of Missouri egg producers by eliminating the competitive advantage Missouri producers would enjoy once Prop 2 becomes effective.

Must states protect other state producers’ advantage? To understand whether this is a viable claim, we need to take a closer look at the Commerce Clause.

The Commerce Clause grants Congress the power to regulate commerce between states. The “dormant” Commerce Congress is an implied negative converse: states are prohibited from passing legislation that adversely or improperly impacts on interstate commerce. Interpretation of the law has been refined over time. Now, the courts first determine whether the state law discriminates against out of state interests in deference to the states own producers, either deliberately or incidentally. If the legislation is deliberate and protectionist, then the state is out of luck. However, if the discrimination is a side effect of the act then it’s up to the state to provide arguments why the ends it needs to achieve can’t be achieved any other way.

So how does AB 1437 fit into this? Interestingly, so.

If you sell shell eggs in California, you have to follow the same requirements regardless of your location. Proposition 2 started this process by requiring minimum standards for egg hens within the state, but if we took away Proposition 2, the same requirements would still exist because of AB 1437. Technically, AB 1437 seemingly does “discriminate” against out-of state producers more than in-state producers, since its focus is on the eggs sold in the state, rather than the hens within the state. However, the text of AB 1437 doesn’t differentiate based on location or producer, and neither does California statute 3 CA ADC § 1350(d)(1):

Commencing January 1, 2015, no egg handler or producer may sell or contract to sell a shelled egg for human consumption in California if it is the product of an egg laying hen that was confined in an enclosure that fails to comply with the following **standards.

Now the question becomes: does the fact that Missouri no longer has an advantage over California producers constitute “discrimination”? There is one Supreme Court case, Hunt v. Washington State Apple Advertising Commission, which seems to imply so.

North Carolina passed a law that apples had to have a USDA label. Washington State apple producers didn’t want to use the USDA label because Washington state standards actually exceed USDA standards—a fact that gives Washington apple growers an advantage over North Carolina apple growers. Washington state growers challenged the law, stating that it violated the Commerce Clause because the law degraded the Washington state growers’ advantage.

The Supreme Court agreed, which does seem to corroborate the notion that removing an out-of state producer’s advantage is discriminatory. However, there’s some subtlety to the ruling. According to the Oyez entry:

The Court voted unanimously that the North Carolina regulation was an unconstitutional exercise of the state’s power over interstate commerce. Although the regulation was facially neutral, it had a discriminatory impact on the Washington growers while shielding the local growers from the same burden. The regulation removed the competitive advantage gained by the Washington apples from stricter inspection standards. The regulation produced a leveling effect that works to the local advantage by “downgrading” apples from other states unjustly. Therefore, the regulation places an unreasonable burden on interstate commerce.

And therein lies the catch: the North Carolina apple producers were already using the USDA labels, so the new law had no impact on them. Unlike the North Carolina apple producers, the California egg producers have to follow a new law beginning in 2015—the same law that out-of state producers have to follow. Unlike the North Carolina apple producers, no one is “advantaged” on January 1, 2015 with the California laws. Or, in the egg producers’ perspective: all parties are disadvantaged, equally.

If the law isn’t deliberately discriminating, then the judge applies what is known as the “Pike balancing test” from the case, Pike v. Bruce Church, Inc..

Where the statute regulates even-handedly to effectuate a legitimate local public interest, and its effects on interstate commerce are only incidental, it will be upheld unless the burden imposed on such commerce is clearly excessive in relation to the putative local benefits.

The judge has to balance the benefits of the law against the burden imposed on out-of state producers.

Does California have a right to pass laws that support its citizens animal welfare and food safety interests? Judge Walter in Cramer v. Brown believes so.

As Plaintiff admits, the prevention of animal cruelty is a legitimate state interest. See United States v. Stevens, __ U.S. __, 130 S. Ct. 1577, 1585 (2010) (“[T]he prohibition of animal cruelty itself has a long history in American law, starting with the early settlement of the Colonies.”). In order to outweigh this legitimate state interest, Plaintiff must allege facts that demonstrate that the incidental burdens on interstate commerce are clearly excessive in relation to the local benefit and that these burdens are substantial. See National Ass’n of Optometrists & Opticians v. Harris, 682 F.3d 1144, 1148 (9th Cir. 2012) (“A critical requirement for proving a violation of the dormant Commerce Clause is that there must be a substantial burden on interstate commerce.”). Instead, Plaintiff alleges purely hypothetical and entirely speculative burdens on interstate commerce. Moreover, those hypothetical and speculative burdens, even if they are realized, are not clearly excessive in relation to the legitimate state interest in preventing cruelty to animals.

Another California court decision corroborates Judge Walter’s decision. Recently the Ninth Circuit Court of Appeals affirmed a judicial decision to deny a preliminary injunction against one of California’s foie gras ban laws. This lawsuit also contends that the law is a violation of the dormant Commerce Clause. The judges disagreed:

Plaintiffs contend that § 25982 targets wholly extraterritorial activity because it is “aimed in only one direction: at out-of-state producers.” Plaintiffs reason that § 25982 is “apparently directed at farmers who feed their ducks and geese outside [California],” because § 25981 already prohibits businesses in California from force feeding birds.

Plaintiffs misinterpret the interplay between the statutory provisions. Plaintiffs assume that § 25981 and § 25982 are functionally equivalent, with § 25981 targeting California entities and § 25982 targeting out-of-state entities. In truth, § 25981 serves an entirely different purpose than § 25982. Section 25981 prohibits entities from force feeding birds in California. But for § 25981, a California producer could force feed ducks in California, and then sell foie gras outside of California. Section 25981, however, does not prohibit the sale of products produced by force feeding birds. That is where § 25982 comes in. Section 25982 applies to both California entities and out-of-state entities and precludes sales within California of products produced by force feeding birds regardless of where the force feeding occurred. Otherwise, California entities could obtain foie gras produced out-ofstate and sell it in California. Thus, Plaintiffs’ assertion that § 25982 is directed solely at out-of-state producers is incorrect.

The case is still ongoing, but if the decision is any indication, has little chance for success.

Returning to AB 1437, contrary to the assertions in the complaint that the new regulations, “serve no legitimate state purpose because they do not protect the welfare of any animals within the State of California, and their stated purpose—to prevent salmonella contamination—is pretextual”, the new regulation does serve the legitimate interests of the citizens of the state as to the safety of the food they eat. The text of AB 1437 references both the Pew Commission on Industrial Farm Production and the World Health Organization in their findings of proportionally higher level of salmonella contamination associated with stress, and that the hen’s stress level is directly related to the environment in which it is kept. A quick Google search brings up several other studies and reports that also make a connection between environment and hen health, and hence egg safety.

The Missouri AG disagrees. The complaint, in effect, places the court in the position of having to determine the credibility of scientific findings it has neither the skill nor background to judge.

It is just this difficulty that has led the Roberts Court to cast a jaundiced eye against the Pike Balancing Test, and, indirectly, against the dormant Commerce Clause, itself. And in our court system, interpretation of law flows down hill.

The Koster complaint doesn’t rely solely on the Commerce Clause in its arguments. The complaint also claims that the Federal Egg Products Inspection Act (FEPA) implicitly preempts the California laws, and they are therefore null and void under the Constitution’s Supremacy Clause. It’s an odd argument, considering Missouri’s own frequent attempts to explicitly nullify federal law.

Regardless of the unintended irony of the claim, the FEPA focuses specifically on egg processing and processing facilities, and not on the environment housing egg hens. At most, the state and federal laws complement each other. I have to assume this argument in the complaint is the legal equivalent of throwing everything at the wall and hoping somethingsticks.

Before he filed, Koster stated the following in an interview with the Kansas City Star:

“This is not an agriculture case, and it’s not just about egg production,” Koster said. “It’s about the tendency by California to press the boundaries of intrusion into an area protected by the Commerce Clause of the U.S. Constitution.”

In another case currently under way in the California federal courts, Rocky Mountain Farmers Union v. Corey, several out-of state fuel suppliers sued the state of California regarding its Low Carbon Fuel Standard (LCFS). The groups claimed that the standard placed an undue burden on producers outside of California, and hence the regulations were in violation of the dormant Commerce Clause. A federal judge initially agreed, but the decision was overturned by the Ninth Circuit Appeals court. What stood out for me in the court’s decision, other than it being a victory for cleaner air, is the following:

Our conclusion is reinforced by the grave need in this context for state experimentation. Congress of course can act at any time to displace state laws that seek to regulate the carbon intensity of fuels, but Congress has expressly empowered California to take a leadership role as to air quality. If GHG emissions continue to increase, California may see its coastline crumble under rising seas, its labor force imperiled by rising temperatures, and its farms devastated by severe droughts. To be effective, California’s effort to combat these harms must not be so complicated and costly as to be unworkable. California’s regulatory experiment seeking to decrease GHG emissions and create a market that recognizes the harmful costs of products with a high carbon intensity does not facially discriminate against out-of-state ethanol.

While Congress hasn’t specifically anointed California to take on food safety or animal welfare issues, our country has long encouraged states to be the vanguard when it comes to change. Right now, states are taking the initiative with gay marriage and marijuana use, to mention two that are frequently in the news. These states become, in effect, laboratories where change is tested, and laws are refined. Such refinement can then be used to better craft laws that apply to all states.

In addition, changes at the state level can lead to acceptance of federal laws in today’s political environment where anything new coming from the US government is treated as suspect. An attempt to incorporate minimum requirements for egg hens at a national level has not been successful, even though it is supported by both egg producers and animal welfare groups, because there hasn’t been enough impetus for the change at the state level yet. Come January 1, 2015, the impetus will increase.

In my opinion, Chris Koster is wrong in his conclusions about the California laws, and it’s highly unlikely that his suit will prevail in court. Stories about the court case have stated that Koster expects the case to cost the state of Missouri only about $10,000 in legal fees. Legal battles of this nature are very expensive, so I have to assume Koster expects the case to be dismissed relatively quickly, and rightfully so.

Then Missouri Attorney General Chris Koster will have to explain to the citizens of the state of Missouri why he’s using tax payer money for a lawsuit that should have been filed by the egg producers, themselves, as is usual with court cases of this nature.

Since Chris Koster is planning on a run for Governor, and since the Missouri Farm Bureau has inordinate influence in Missouri elections, I’ll leave it up to the reader to speculate as to the exact nature of the Missouri politics.

** What standards? An enclosure with 9 or more hens must provide 116 square inches of floor space per bird; less than nine, a formula is used (322 + [(n – 1) x 87.3] / n, where “n” is number of birds). Oh, and birds must have access to food and water. This is a space about 11 inches square, with access to food and water. This is not the bird equivalent of Four Seasons. It’s not even a bird equivalent of Motel 6. That egg producers consider this burdensome should give everyone pause.