TUTORIAL: Developing Locally on WordPress with Remote Database Over SSH

Today, I went about setting up a local WordPress install for some development I am doing at work. The problem that existed is that I didn’t want to bring the database from the existing development server site into my local MySQL instance. It’s far too big. I figured this could be done via an SSH tunnel and so, I set abut trying to figure it out. The situation worked flawlessly and so, for your sake (and for myself for the future), I give you the steps.

Setting up the SSH Tunnel

I run a local MySQL server and that runs on the standard MySQL port 3306. So as these things go, I can’t bind anything else to port 3306 locally. I have to use an alternate port number. I chose 5555, but you can use whatever you want.

The command to run in a Terminal window is:

ssh -N -L 5555:127.0.0.1:3306 remoteuser@remotedomain.com -vv

A little bit about what this means.

the -N flag means that when connecting via SSH, we are not going to execute any commands. This is necessary for tunnelling as, we literally, will not execute any commands on the remote server. Therefore, we won’t get a command prompt.

the -L flag tells SSH that we are going to port forward. The following portion, 5555:127.0.0.1:3306 combined with the -L flag means, literally, forward all traffic on localhost (127.0.0.1) connecting on port 5555 to the remote server’s port 3306 (standard MySQL listening port).

The remote server and ssh connection is handled by remoteuser@remotedomain.com. This seems obvious, but just in case. You may be prompted to enter your SSH password.

The final part can be omitted, but I like to keep it there so I know what’s happening. The -vv flag tells the SSH daemon to be extra verbose about what is happening with the connection. It’s sort of a good way to debug if you need to, and to know that the port forwarding is actually taking place.

Configuring WordPress to use the Tunnel

Now that we have a successful SSH tunnel, you have to configure WordPress to use it. In the wp-config.php file, simply modify the DB_HOST constant to read:

1
define( 'DB_HOST', '127.0.0.1:5555' );

You need to add two more variables, though, to override WordPress’ existing siteurl and home options to allow you to work with the localhost domain, instead of redirecting to the remotedomain.com that is configured in WordPress.

1
2
3
define( 'WP_HOME', 'http://localhost' );

define( 'WP_SITEURL', 'http://localhost' );

BOOM!

With these configurations in place, loading up WordPress should now load in the database content from the remote host and you can get to work on local development. Word to the wise… don’t close the terminal window with the tunnel or the tunnel will be severed. If you have to minimize it so it’s not annoying you, go for it… just don’t close it.

Read More

New York Wins Because It Has More Girls (and other tidbits of insanity from the tech community)

tumblr_m585xyxrjm1r06u14Ladies and gentlemen, we don’t live in a fantasy world where we get to define truth and memorex. There are many areas of life that are grey areas. Then there’s right and wrong, correct and incorrect, proper and improper, truth and consequences.

I had a conversation recently with a third party developer that was maintaining some code for a client. It went something like this.

Me: Hey, we’re having some problems and I noticed in the logs this error that occurs anytime we encounter the problem. I’m not sure what’s going on here, but it seems to have to do with this code. Can you look?

Him: If you turn the error reporting down, then it won’t appear in the log.

Me: I don’t think you understand. I’m not complaining about the error in the log. The error helped me pinpoint the problem area. All turning error reporting down does is prevent us from seeing the error. It doesn’t make it go away. Please tell me how you want to fix this. Thanks.

This morning, I read an article in the Wall Street Journal. The article did your now-common comparison between east coast tech – more specifically, New York Tech – and Silicon Valley tech. That conversation is exhausted. I’ve already addressed regional fiefdoms. It doesn’t matter. Us? Them? Who’s got the biggest dick? It doesn’t matter. Let’s save that conversation for another time.

The article was mostly good, besides the cliché. Until the final three paragraphs.

Andrew Rasiej, chairman of NY Tech Meetup, was debating the merits of New York versus Silicon Valley’s nearest metropolis, San Francisco, at a recent conference when a young programmer chipped in: “New York will always win out,” Mr. Rasiej recalled of the exchange, “because it has more girls.”

A table full of female models was recently enjoying a girls’ night out at Abe & Arthur’s, a steakhouse in the Meatpacking District, when a man sent one of the women a note on a cocktail napkin. It read: “iamrich@google.com.”

The women posted the napkin to Facebook and crowdsourced ways they might reject the overture. In a way, it brought together avatars of the new tech scene with icons of established fashion power. But it also marked, in Internet lingo, an epic fail.

Let’s also ignore the money status cliche and address the sexism issue described in this article. I’ve done it before and I’ll continue to do it until we stop pretending that the problem doesn’t exist by simply changing the log reporting.

The tech community really likes to turn down the error reporting in a big way. New York wins out because it has more girls. Is that so?

We work, breathe, live, spend our weekends in and around, date inside of the tech world. As entrepreneurs and techies, I know more people with zero social life because their idea of fun is sitting at home at 1am on a Saturday coding a Ruby app. Maybe we are just socially unaware. Maybe we’re malicious. Maybe we’re really misogynist.

I don’t care what the excuse is. We must do better. All of us.

Having a balanced number of women to men on tech-oriented panels and at conferences is a good start, but we must fix the problem. We have to get our heads out of our asses and realize that women engineers can probably teach us something about our own world. We don’t know better. We know enough to hang ourselves.

The casual things we say to each other online or in person. The jokes we make that, to us, are jokes… are not jokes.

This is not a cry for political correctness. This is a call for sensitivity and thoughtful intent. This is a sobering call for respect and equality.

I’m talking to myself as much as am talking to you. Every time I make comments about a woman being hot, I am not simply being a man. I am disqualifying her from the intellectual marketplace that I live in. Every time I go to a meetup drinkup and I gravitate toward the woman at the bar at the same event, I marginalize her abilities as a woman in tech.

Are we supposed to just become asexual beings? No. Of course not. But there’s a time, place and way to do it and making comments like “New York wins because we have more girls,” is gross negligence. If New York wins, it’s because it has the best apps, companies, entrepreneurs and ideas… and women are partners in that.

Let’s wake up and get real and stop simply turning down the error reporting so we don’t have to address the issue.

Read More

I Fired Myself

If we’re friends on Facebook or Twitter, you know about my new job in Baltimore. Technically, it’s not a new job yet, as I don’t start until February 4. However, it’s a new job and a return, for the first time since 2006, to a more corporate (if laid back) working environment. I’ve only worked for one company in that period of time, and I was a founder. That, of course, is the hugely successful WP Engine. However, I left that role in October of 2011. I still didn’t have the motivation to not work for myself.

A little about this new role, however, since I brought it up. I feel it’s necessary in proving the point I want to make.

Corporate Culture

Agora Financial, as a division of Agora, Inc. was named the 2nd best place to work in Baltimore in 2011 by the Baltimore Sun. As an adopted Austinite, that label carries a high standard. In Austin, “business casual” is cutoff jean shorts (“jorts”) and a tech swag tee shirt with sandals. In Austin, the chic commuter rides a scooter or bicycle. Maybe even walks. In Austin, drinking a beer is not something simply saved for off-hours. In fact, many companies keep a refrigerator stocked with beer because, hey, the workforce can be more relaxed, efficient and productive if given certain leeway. Thankfully, none of us are drunks… maybe.

At Agora, I found a company that matched this sort of comfort level I’ve come to expect. When I flew up for an interview (and job interviews have been something I’ve not really had to do seriously since 2002), I emailed Mark, the Art Director and my point of contact, and very politely suggested I wouldn’t be arriving at their headquarters in a tie. Manage expectations, and such. Mark’s response was simply, “That’s fine. Business casual works”.

Business casual can mean many things. It’s sort of a catch all phrase that means different things to different people based on different companies policy ideas. So I wore some decent dress pants, a button up shirt and a vest with no tie. The team had sandals, jeans with holes, and hoodies and plaid-pattern button up shirts. I felt like I was in Austin!

Ideology

But company culture was just one aspect. The work they do perfectly fits who I am practically and ideologically.

You see, Agora is a publishing company first and foremost. I’m a publisher. I’ve written a book and worked with traditional book publishers. My first startup was a publishing company with, at our peak, 350 blogs. Agora’s model is different than those models, but they’re publishing. They are creating content that, hopefully, long outlives us.

They are a policy research publishing company. Those who know me know that I love policy, I hate politics. When I engage in politics, it’s usually from the lens of policy. Agora provides research analysis and white papers based on their policy research in a subscription format. So there’s also a revenue model. And they’ve been highly successful at doing this, historically through newsletters, for years. It’s a proven model, and they are a proven company.

In addition, their policy analysis generally comes from a libertarian (small “l”) perspective. As a left-leaning small-l libertarian, I enjoy this aspect of what they do (even though I suspect most of my colleagues and most libertarians as a whole are right-leaning small-l libertarians, I suspect that we all agree on a framework of responsibility and limited government in individuals life, and diverge on other less-important minutiae).

I was hungry for this job. It was a dream job for me. Join a company doing things I loved, in areas I loved, with tools (WordPress) I loved, with a style of corporate culture that I loved. When they made me an offer, I didn’t hesitate to accept and fire myself from my own company.

I fired myself!

Having the Balls to Fire Myself

Most people aspire to stop working for the man, and start working for themselves. There are entire classes at universities and colleges about entrepreneurship, and to be sure, entrepreneurship is the mode of decade.

The other night, I had the opportunity to guest lecture for an capstone course on digital entrepreneurship for American University. It was online and you can hear my story and lecture here. This course is a culmination of all the classwork done in this program and is largely a practicum of everything learned to that point. The lectures are a series of lectures from guests that give the students inspiration and motivation about their futures while they work on their individual projects.

During this talk, I spoke specifically about the time I left corporate America and went out on a limb. It was 2006. I had been working on a side-project basis for over a year building up a WordPress-powered content network and when we finally took funding, I was employee #1 or #2, depending on who you ask. I couldn’t wait to leave my computer-fixing job and go do something I really, really wanted to do instead and get paid for.

I’ve heard stories like that from hundreds of entrepreneurs. Most never look back with any regret, despite the struggles and sometime-economic instability.

I have a view that whatever I do, I do it because I want to. It’s very easy to look and say that running a startup, building a product, starting a company or, in general, working for yourself is, in fact, the holy grail.

From Happiness to Happiness

My view is that the holy grail should be happiness and motivation derived from what you do. Sometimes that means taking a more unorthodox step and saying, you know what… being an entrepreneur is awesome, but it’s a vehicle to happiness, not happiness itself.

So effective February 4, 2013, Aaron Brazell has been terminated by Aaron Brazell.

I don’t know if I would have fired myself to go be a developer in some developer-happy company that segregates the developer from the product line. In other words, a lot of developer-oriented companies have developers as a means to an end. Product managers go talk to customers, develop goals, milestones, wireframes or storyboards, make decisions on initiatives with corporate executives and the developers exist to make that shit happen.

Some people like that. Some people don’t want to be a part of the politics and roadmapping. They work better with a framework that defines what their role and deliverables are. For them, that’s happiness.

For me, happiness is seeing the vision, talking about what it means – the pros, cons, feedback – iterating, being a part of the process of both scoping and building and then allowing the idea to flourish. It means building something toward an end. In the idea of a startup, it means building a product and moving it toward acquisition, IPO or even failure.

As a consultant, there was no viable end. Unless I’m committed to building out a team (I’m not), increasing a production pipeline (without a team, I can’t), or other such motivations, a consultancy looks exactly the way it does in 10 years as it did on day 1 – find clients, build something for them, collect money, wash, rinse, repeat. There’s no glorious ending. To me, that makes for an unhappy Aaron.

Agora provides an exciting platform, an an innate sense of entrepreneurship internally, that makes me happy. If I have an idea, I can try it. If I think something could really work well, I’ve got a green light to work on it. All within a good developer situation where I also have deliverables, and things to look at and solve. The combination of such makes Aaron a very happy person.

Read More