Hosting Separate Websites from the Same Container on Pantheon

I know I've mentioned that I've moved all my sites over to Pantheon running on Drupal 8. I have a number of sites (blog, photography, professional, an about page, and a number of other private sites). Now I don't get a ton of traffic I wanted to find a way to host all my sites out of the same pantheon continuer. This is both to reduce costs and time I spend doing core / contrib updates. I want each site to have it's own look and feel (a separate theme) and live under its own domain.

It occured to me that I could easily organize my content by path (/blog/* for the blog content, /professional/* for the web development content, etc). This can be driven taxonomically using Pahtauto to handle the paths.

As far as having a separate theme for each site is concerned I could use the switch page theme module.  This feels like a replacement for the themekey module from Drupal 7.

Next I thought about how to handle the page redirection.  I looked at my options:

  1. Pantheon doesn't support multisite drupal. Even if they did, I'd still have to perform updates on each site individually.
  2. Domain Access could do this, but feels like overkill. It hasn't always been the most stable of modules and it's a lot of a little.
  3. I could write a custom module to do redirect to the proper domain.

So as I thought about writing a module, I realized that it would be inefficient for Drupal to do a full bootstrap just to redirect and having to start the process again.  So I decided to add the redirects to settings.php.

<?php
$request_uri 
explode('/',$_SERVER['REQUEST_URI']);
        
    if  (isset(
$_ENV['PANTHEON_ENVIRONMENT']) && ($_ENV['PANTHEON_ENVIRONMENT'] == 'live') && ($_SERVER["PATH_TRANSLATED"] <> "/opt/pantheon/drush8/drush.php")){
    
        if ((
$request_uri[1] == "") && ($_SERVER['HTTP_HOST'] == "freelancedrupal.com" ) ){
            
header('HTTP/1.0 301 Moved Permanently');
            
header('Location: https://freelancedrupal.com/professional');
            exit ();    
        }
        
        elseif ((
$request_uri[1] == "professional") && ($_SERVER['HTTP_HOST'] <> "freelancedrupal.com" ) ){
            
header('HTTP/1.0 301 Moved Permanently');
            
header('Location: https://freelancedrupal.com'.$_SERVER['REQUEST_URI']);
            exit ();
        }
        
        elseif ((
$request_uri[1] == "") && ($_SERVER['HTTP_HOST'] == "bowtiesare.cool" ) ){
            
header('HTTP/1.0 301 Moved Permanently');
            
header('Location: https://bowtiesare.cool/blog');
            exit ();
        }
        
        elseif ((
$request_uri[1] == "blog") && ($_SERVER['HTTP_HOST'] <> "bowtiesare.cool" ) ){
            
header('HTTP/1.0 301 Moved Permanently');
            
header('Location: https://bowtiesare.cool'.$_SERVER['REQUEST_URI']);
            exit ();
        }
        
        elseif ((
$request_uri[1] == "") && ($_SERVER['HTTP_HOST'] == "seanreiser.com" ) ){
            
header('HTTP/1.0 301 Moved Permanently');
            
header('Location: https://bowtiesare.cool/sean-reiser');
            exit ();
        }
        
        elseif ((
$request_uri[1] == "sean-reiser") && ($_SERVER['HTTP_HOST'] <> "seanreiser.com" ) ){
            
header('HTTP/1.0 301 Moved Permanently');
            
header('Location: https://seanreiser.com'.$_SERVER['REQUEST_URI']);
            exit ();
        }

}
?>

The code is rather simple. There's a pair of if's for each domain, one to redirect the root of the domain to the right path, the other to redirect to the proper domain. The bit about drush is rather important if you're on pantheon. If you're useing terminus to run drush (or their interface to clear cache), the redirect will screw things up.

The only downside to this approach is that you wind up with the subdirectory in the URL after the redirect, but I willing to accept that to get things working.

  Posted 4 days Ago

Thinking About Ensuring Content Longevity

Just listened to Dave Winer's podcast about building a For The Record Blogging System. As he rightly points out that the problem with such a system isn't the actual technology to create / build the post, but ensuring that the post lives on forever. We have lost so much of the history of the web as as companies who hosted our content have gone out of business or changed their focus.    People use Medium for this today, what guarantee do we have that they will be up and running tomorrow / next month / next year?

My initial thought about this was "people should host their own content on their own domain".... and then I thought about it.  If I were to die tomorrow, everything I host would slowly fade away:

  1. When my credit cards are cancelled my host will discontinue service and *poof* my content will be stricken from the web. Same goes for my domains, eventually they'll expire and then "Bye Bye"
  2. If I make arrangements to make sure hosting and domain renewal aren't a problem; eventually they'll be a problem somewhere on the server. Maybe a security update will be released that won't get applied and the server is hacked. Maybe a drive failure. Maybe DB corruption. At some point the lack of a sysadmin will become a problem.
  3. If I make it through this hurdle eventually things will slowly slip away via entropy. HTML, CSS and Javascript features will be deprecated and removed. File formats will die out of favor with new and shiny things replacing them (think flash). 
  4. Eventually my estate will run out of money and #1 will happen.

Perhaps by random coincidence the next podcast that popped up on my player was Jason Scott's.  For those not in the know, Jason works at the Internet Archive, a non-profit founder by Brewster Kahle which is attempting to archive ... well ... everything.  You may know the archive from the wayback machine or collection of older games.  Those are only a small part, they are truly trying to be a modern day Library of Alexandria.  If it can be digitized and archived the IA is trying to archive it. 

Now, the wayback machine, isn't the direct solution to this problem but the fact these things popped up back to back got me thinking about the problem.

  Posted 1 week Ago

Thoughts About the LIRR Class Action Lawsuit

For the last few months I've been living in the same horrible conditions on the LIRR as many of my friends and I understand the frustration and wanting to get something out of the MTA to punish them for the poor conditions, delays and constant late trains. I've lost time, money and credibility due to the constant unpredictability of the LIRR. I have clients that won't hire people from Long Island and NJ because they're tired of it. I understand. I'm mad.

The only thing that will make me madder is this lawsuit. Let's think about it:

First off, from what I've seen in live class action lawsuits only enrich lawyers. Think about it... the plaintiffs get a small credit for services, the lawyers make millions. Looking at last couple of class action suits in which I received an award, I expect the settlement will be a free zone 1 city ticket,

The MTA isn't a profit making company. It gets money in one of 2 ways: through fares and taxes. Both of which you and I pay. I'm willing to bet anyone "folding money" that any benefit I get will cost me more in the long run in fare and tax increases.

All this feels like a quick way to transfer tax dollars to lawyers.

I'm not saying that the MTA shouldn't be held responsible, perhaps through the ballet box, but suing them will cost us more then we benefit.

  Posted 1 year Ago

I don't understand the inconsistency in people.

I have friends who were very pro Bill Clinton in spite of his sexual scandals. Defended the former President's actions, shot down and belittled his accusers. Twenty years later they are anti-Trump because of sexual scandals.

OTOH, I have friends who are very pro Trump in spite of his treatment of women. They defend him, and attack his accusers. Twenty years ago, all they could talk about was Bill Clinton's morals and character.

I can only conclude that either:

1) Many of my friends' attitudes towards woman and sexual assault have flipped 180 degrees in the past 20 years.

or

2) We are so consumed in #teamred vs #teamblue that nothing else matters.

20 Years ago I was anti Bill Clinton because of his treatment of women. Today I am anti Donald Trump because of his treatment of women. I am neither #teamred nor #teamblue. I believe that the person who leads this county's morals and character matter.

Do not take this as an endorsement of Hillary. I am just amazed by the hypocrisy of a number of my friends on this matter.

  Posted 1 year Ago

Drinking at Work

The Comment I made on the link below:

Thanks for sharing, Sarah. I understand and have been there. Here's my story.

"Mimosa or Bloody Mary?" were the last words I expected to hear out of the director's mouth on my first morning of work. When you start a new gig you normally hear, "Go talk to Jane in HR about your paperwork" or "Roger handles our internal IT, talk to him about getting yourself setup".

"Are we celebrating?", I asked. I wondered if we just closed some account, shipped a product or if this was some way of welcoming me to the team.

"No, this is life every day, welcome aboard! We do things differently here", he said, He was proud of this, you could tell. He had a rebellious look that said, "we're not doing things the way our parents did, we're creatives!".

You see, I had spend the majority of the last 20 years slinging code for financial firms. An environment where a simple mistake, a laps of judgement could cost something hundreds of thousands of dollars. In that kind of environment, you don't do things the can hinder your ability to think. Drinking while working was probably number one on the list of things you didn't do. I know I crossed the rubicon from button down world of Wall Street to the free flowing world of a creative agency in a Chinatown Loft. For some reason I didn't feel comfortable making this leap.

"I'll just have a coffee, on this side of 40 I need caffeine to get the synapses flowing". Little did I know that I wouldn't need them to fire for the next 7 hours.

I get settled, took out my laptop and waited for access to the code repo and development servers. As I sat at my new desk I observed what people were doing. As coders and engineers wandered in for the day, they would stop by the Kitchen / Bar, get a drink and head for the conference room. I headed over to find the entire staff just playing video games and drinking. I realized that the staff were all under 25 and this was just Frat House Life 2.0.

By now I had access to the code repos so I was reviewing what they had, getting familiar with their style and trying to learn their product. Around 2PM people were leaving the conference room and started heading out for lunch. When they returned from lunch it was siesta and people slept off a little of their buzz at their desks or on the couch.

4PM, now it's time to start working! They worked. They worked hard and long, into the wee hours of the morning. People were starting to leave around 2AM. Proud of the "long day they just put in". I heard one engineer referring to the 17 hour day he just "worked". I shook my head and went home.

The next day I came in, grabbed some coffee and watched the some thing happen again. As people were sobering up, I headed to the director's office. "Sorry, I don't think this is going to work out", I said, "you don't need to pay me for these days".

He seemed puzzled, "The Long days? I was hoping with you could help us streamline things"

"Oh, I could fix it but you don't want to hear it".

"How?"

"Simple", I said,"people aren't allowed to drink or play video games until their work is done. Yesterday, although we were here until 2AM, everyone really worked a 10 hour day, from 4PM to 2AM. 9 to 4 was drinking, playing and recovery time. It's 3:30 not and no one has stared working yet. I don't mind long days, I don't mind working hard. But when I work I want to work, when I play I want to play. When I was 8 my mother told me 'you can't go out and play until you finish your homework'. That's what you need here. You can't drink and play games until your code is checked in and your tickets are closed".

He looked at me. With a little bit of pity. "Sean, I worried about hiring you. You've been with 'them' too long. You've forgotten what it's like to have fun".

"Nope", I said, "I know how to have fun, it's what I look to do when I'm not at work. I didn't take this job to make friends, recapture my youth. I work to be productive to society and to be able to provide for myself."

"Sean, you're not going to work out here".

"Yeah I know, that's why I'm leaving. Let's shake hands, admit we're not a fit and move in"

"No Sean, you're fired"

"Good enough, have a great day!"

  Posted 2 years Ago

Airport Security Lines

 

Someone asked what I thought about the lines at the TSA, here was my answer:

"I think the largest liability in airline security is the line. Terrorist can get in line waits til he's in the middle where there's a lot of people around and *boom*. Just like in Brussels. If the police, bomb sniffing dogs, TSA, etc begin to approach you while you are in line *boom*. But I spend 1/2 my life think of and finding vulnerabilities in websites, so I look at these things differently."

Many of my friends will tell you that for years I've felt the bottleneck in the security was the weak point. The attack in Brussels on the insecure side of the airport validated that thought.

  Posted 2 years Ago

A note for Zach Snyder

Just saw Batman v Superman: Dawn of Justice. Really didn't like it. There's something I have to get off my chest. Spoilers below.

Batman Does Not Use Guns

It's a key part of his character in modern times. Thomas and Martha Wayne were killed by guns, for this simple reason he won't use one. There are no guns built into the Batmobile, there are no guns in the Batwing. Even if he takes it off his enemy, he doesn't use a gun.

Yes, someone will point out that in the Golden Age of Comics Batman used guns regularly but that was the 1930's and 1940's. Any modern telling of Batman involves an aversion to guns that is somewhere between an oath never to use guns to a downright phobia of guns.

More then the killing, more then the poor characterizations, Batman using a gun really bothered me.

  Posted 2 years Ago

Andrew Basiago for President!

Like some of you I've been rather underwhelmed with the candidates this election cycle. But finally, I have found my candidate!

Andrew Basiago is former "chrononaut" and running for President. Since Basiago has taveled both backward and forward in time, I guess that means he's destined to be president. I mean would you run for President knowing that you'd lose?

How could not vote for a man who:

  • Was at the Gettysburg Address.
  • Has traveled to the year 2045.
  • Met President Obama, years before he was elected President.... ON MARS! Finally a rational explanation of the Birth Certificate! Obama is a Martian. I wonder if he knows Ray Walston.
  • Speaking of Mars, this man has served as Earth's Ambassador to Mars, how many other candidates have served as Earth's Ambassador to any planet?

I am glad to see a pro-Sasquatch candidate. I'd hate to see Big Foot go extinct.

  Posted 2 years Ago

Why Is There a Version Number on My Site?

Someone asked me today why I have a version number on the site. Was I trying to be fancy or seem important? Do I increment the version every time new content is added? Actually no, in reality, this site has become slightly more complex then your standard blog. For example I don't use the standard user interface to enter content. Here's a breakdown of how the content gets into this site:

Links - are entered on Dave Winer's Radio 3. I use his bookmarklet to share tweets to my twitter and facebook feeds. This also creates an RSS feed of the links which I import into this site.

Articles - are written in a normal text and stored in Dropbox. The site polls that folder every 15 mins and automagically creates a Drupal node of the article. (That's how I'm writing this right now). I can edit the file and drupal will update the post.

Photos - at this moment I'm posting photos to a folder on Dropbox where, again, the get uploaded here. In the near future I intend on wiring it to either Flickr or 500px.

With any piece of software there are bugs and new features that happen. Version numbers help me keep track of what's live, what's in test and what's still in development.

  Posted 2 years Ago

My Favorite Part of the Day

When you're taking the LIRR or out of Manhattan there's a 10 minute part of the ride between Penn Station and the tunnel in Long Island City where you have no cell service. THere's no internet connection, no email, no facebook. It's just me and my thoughts. I can reflect, and relax. It is the only part of the day that I don't feel that I have to be prepared for a conversation at any moment.

When I was growing up, it was common for someone to be unavailable for hours at a time. A person would just leave their house and just not be available. If someone called and asked for you, the answer would be that you're "out" and a message would be taken and you're return the call when you got home.

In today's hyperconnected world if someone can't find you at home (assuming you have a home number) they just call your cell. When they get in touch they ask the most annoying question. Not "How are you?" or "Can you do x?". The first question you're asked is "Where are you?". Let me get this straight, I carry a device in my pocket which allows you to get in touch with me at a moment's notice and the first thing you want to know is where I am. Perhaps you'd like to know the traffic and weather as well.

You might say "well just don't answer your cell". Good question, do you know what happens then? The first question becomes, "Why didn't you answer your cell when I called". Which is really a coded way of saying "what was more important then me". You really don't want to know the answer. "I was sitting in a park, staring at a tree and contemplating my life".

I have long dreamed of having one room which is a faraday cage, my own personal zero room. Inside the room there are pictures of nature, the sound of waterfall is playing. In my fantasy the door can only be opened from the inside. I could enter knowing that I can't be disturbed until I decide to leave. I probably wouldn't use it for more then 20 mins a day but it would get used.

"But Sean", you're saying, "you're a technologist. You like technology. How could you feel this way". That's simple. I like technology. I like to control technology. I want technology to make my life easier.

I don't want technology to control me.

  Posted 2 years Ago