arrows

Git + MAMP + SiteGround

For too long now I have put off the chore of getting my local development environment set up in a way that would allow me to use Git to push my code directly to SiteGround. I had tried in the past but always ended up hitting a stumbling block somewhere along the way. There is a great tutorial on the process by my friends at 9seeds, that I used as a starting point. But, as I’m a big fan of doing, I wanted to blog about my specific process so that I could refer back to it when I need to do it again.

Here are the pieces of the puzzle I’m trying to put together:

  1. Local environment using MAMP
  2. Web hosting at SiteGround
  3. 3rd party code storage at BitBucket
  4. Use Git to keep all 3 of the above in sync

To follow is the step-by-step process I used to reach Git + MAMP + SiteGround glory.

Not So Fast!

Let me start by telling you how I took one of my sites offline for over an hour. Think of this as what NOT to do…

The Git repo that SiteGround creates for you is going to contain all of the WordPress core files and everything from the wp-content folder on your server. This means all of your uploaded media at the time you create the repo.

My previously existing local repo doesn’t include the WordPress core files or any of the uploads to the media directory. When I force-pushed MY Git repo from localhost to SiteGround, it deleted all the WordPress files along with the uploads directory. (remember how all the tutorials tell you to backup your files and database first? This is exactly why!) I had a backup and after a short freak out, I had my site back online.

Now that you know how NOT to do it, let’s move on to the proper way.

SSH Keys

In order to connect to the server, you’re going to need to add your SSH key to your SiteGround account. To do this, start by opening the Terminal app on your Mac. On the command line, type the following:

pbcopy < ~/.ssh/id_rsa.pub

This will copy your public SSH key to your clipboard.

Next, in Cpanel, click the SSH/Shell Access link and add your SSH key here:

add-ssh-key

Once that’s saved, return to the Cpanel main page as we’ll be using it again in a few minutes.

MAMP

I’m using MAMP Pro 4.x in this demo. If you using the free version of MAMP, your screens may look a little different.

In MAMP, start by adding a new hosting entry. When it comes time to set the document root, create a new folder inside your htdocs folder and select the new folder you just created.

new-mamp-site

Side note, if your live site is using SSL, I STRONGLY suggest that you set up a self-signed cert on the SSL tab. Read this tutorial if you need help with that step.

When you save the settings for your new local dev site, MAMP will restart. As it does, it will create two files in your new folder. You need to delete those files before the next step.

SiteGround Git Repo

Next, you will need to create a Git repo on SiteGround. In Cpanel, click the SG-Git link and you’ll see a list similar to this:

siteground-website-list

Click the Create Git Repository button next to the appropriate domain name. It will take a minute for the repo to be created. When it’s done you’ll see a screen that looks something like this:

sggit-repo-created

You will want to copy the Git Clone command to the clipboard. We’ll use that in the next step.

Clone Repo to Local

Open the Terminal app on your Mac. Change directories to get into the htdocs folder in MAMP. Paste the command you have in the clipboard onto the command line in Terminal and then add the name of the folder you created during the MAMP setup step. It should look something like this:

git clone ssh:[email protected]:18765/home/xxxxxx/public_html/vegasgeek.com mysite

Depending on the size of the site, this step can take some time to complete. When it’s done, the terminal window will look something like this:

git-clone-results

At this point, you now have a complete copy of all your site files in a brand new folder. Time to start setting up WordPress.

Setup a Database

In a browser window, navigate to http://127.0.0.1/phpMyAdmin to access the databases on your local machine. Create a new database for your site.

create-database

Update wp-config.php

The Git repo created by SiteGround contains a copy of wp-config.php. Since it is set up to connect to the database on the live server, you’re going to need to modify it in order to make it work on your local system. I did this by creating a simple if/else statement to point to the proper database depending on the environment. It looks like this:

database-switch

Once that’s saved, rename the file to something like wp-config.php-hold. We’ll get put it back in place later, we just need it out of our way for a few minutes.

Run WordPress Setup

In a browser, navigate to your newly created local site. In my case, http://mysite.dev/. You should be presented with the very familiar WordPress setup screen.

wp-setup

It doesn’t matter what you name the site, or what username/password you use during this step. You’ll be replacing the database with your live database in the next step. But before you move on, go ahead and delete the newly created wp-config.php file, and rename the one you edited in the previous step back to wp-config.php

Migrate the Database

Moving the database can be a bit tricky if you go the route of doing an export and import using phpMyAdmin. This is because you’d need to do a second step of doing a search and replace in the database to change all your .com domains to .dev in order for the site to work locally. A much easier way to move the database is to use Migrate DB Pro.

You will need to install and activate the plugin on both the live site and the local site. Once you do, on the live site you’ll need set up the site to allow a pull request and then copy the migration URL found here:

migrate-live

Then, on your local install, initiate the pull on the migration tab like so:

migrate-local

As you can see at the bottom of that screenshot, the find and replace is done for you automatically during the migration process.

Depending on the size of your site, this process can take some time. Once it’s done, you will be logged out of your local install and you can now log in with the same username/password you use on your live site. You can also go visit the local website and it should look like an exact copy of your live site!

Managing Git Repos

Git can be completely managed via the command line. I, however, choose to use an app called Tower that has a nice interface to manage my repos.

In Tower, choose the option to Add Local Repository. This will bring up a finder window where you will need to select the folder where your local website is saved. For example, mine is in /Applications/MAMP/htdocs/mysite/. Once you select it, click Add Repository to continue.

Once added, double click the repo name to open it and you should see something like this:

local-repo

There are a couple things I’ll point out:

On the left, in the section called Remotes, you’ll see the folder called origin. This is the Site Ground repo. I typically rename that to SiteGround by right-clicking on it, just to avoid confusion later.

On the right, you’ll see a couple of local changes. The first are the updates to the config file you made. The second is the Migrate DB Pro plugin you added. Go ahead and commit both of those changes and push it up to SiteGround so both are in sync.

We’ll come back here in a minute to add BitBucket to Tower. But first…

Create a BitBucket Repo

Technically speaking, you could use BitBucket or GitHub or any other 3rd party Git repo service you like. I’m a fan of BitBucket because of their pricing model. It suits my needs the best.

In BitBucket, click the Create Repository button. Give it a name and be sure to make it a private repo.

bitbucket-create

On the resulting page, click the I’m starting from scratch link which will display a box that looks like this:

bitbucket-repourl

You will want to highlight and copy to the clipboard only the section that I’ve highlighted above. Once you do that, we’ll jump back into Tower.

Add a Remote

In Tower, right-click on Remotes in the left column to bring up the Add a Remote dialog box. Add a name (BitBucket) and then paste the info from above into the Repository URL field. This will drop down a few additional fields. When done, your screen should look like this:

tower-add-remote

 

Once you click Add Remote, you will now have two remotes listed in Tower; SiteGround and BitBucket.

Moving forward, when you make changes to your code, push your code to BitBucket frequently. Then, when you’re ready for your new code to go live, push the code to SiteGround.

Done!

Well, that’s it. I know it sounds like a lot of steps, but in practice, it’s not so bad, really. And the end result of being able to push code using Git as compared to having to FTP files to the server makes this TOTALLY worth the effort!

 

twitbird

Taking back Twitter

Back in February or 2009 I wrote a post called “I’m done with auto-follow on Twitter“. But, apparently I didn’t learn my lesson.

Once I started running 9seeds and was actively using social media to help ‘build our brand’, I started doing 2 things on Twitter that I ended up regretting. First, I turned auto-follow back on so that I could receive DMs from anybody was following. The second thing I did was for every conference I went to, I would follow the hash tag and then follow as many of the people I saw tweeting from the event. These both seemed like great ways of connecting with more people. Amazingly, it had almost the exact opposite effect.

The tipping point came about 3 months ago. I checked my Twitter account and noticed that I was following more than 6,000 people. But, that doesn’t mean I was reading all their tweets. There were so many tweets coming in that it was basically white noise. I had created a list of friends, family and community members I wanted to follow. Those were the tweets I was reading and interacting with. So, I decided to clean it up. I used Manage Flitter to unfollow about 3000 accounts. Most of those were people who had followed me, got me to auto-follow them back and then stopped following me. I was surprised at how many brands do that. It didn’t really help the white noise, unfortunately. The stream was still too much to deal with and I was stuck reading only my list.

In September I read this post by Chris Brogan where he talks about unfollowing the 131,000 people he was following in order to stop the crazy amount of DM spam he was getting on a daily basis. He took a fair amount of grief from people who were hurt by the fact that he unfollowed them. It’s funny how people can take something as meaningless as a twitter follow so personally.

But, the final straw for me was this post by Aaron Hockley where he writes about what he’d do differently if we here to start over on Twitter. While none of the past was Earth shattering or necessarily groundbreaking, two things he mentioned gave me that AHA moment I needed.

  • I would start a list for each of my top three areas of interest.
  • When I attend an event, I’d start a list for people I met at that event or those who were actively tweeting about the event. During the event, I’d monitor said list closely. After the event, I’d move relevant folks to another list and delete the event list.

Sometimes you need somebody else to point out what is right in front of you.

Over the past 3 days I’ve unfollowed roughly 3000 more accounts and am now down to roughly 350 that I still follow. And since I’m using a sledgehammer rather than a scalpel to do the unfollowing, there have been a few (a few dozen?) accounts that got unfollowed that I will end up following back. I’m still monitoring my list and plan to create a handful of other lists that will let me dive in to specific groups of people more easily. I will also be following Aaron’s lead and creating lists before heading off to my next conference so that I can easily add attendees to the list to see which I want to follow long term or possibly move them to a separate list.

If I unfollowed you, I promise it was nothing personal. We likely didn’t connect much on Twitter to begin with and unless you use some tool to let you know who unfollows you (insecure much?), you probably won’t even notice.

2 Jing features I’d love to have

I have been a big fan of the screen cap software Jing for a while now. I first wrote about it back in 2007 and have been a pretty loyal user ever since. But recently I have been using the software even more than usual. I’ve been using it to make quick walk-through videos for clients when they need to see how a process works. It probably saves me about 2 hours of typing a week.

As I’ve been using it more frequently lately, I’ve realized that there are 2 features that I’d like to see added that would make Jing even that much more powerful.

Feature request #1 – Select a folder for upload

Since I’m using the software to upload shots for clients, I would love to create a folder for each client. Then, as I’m saving my video and ready to share it, I want to be able to select the folder to push it to. The end result being that I could mark the client’s folder as ‘public’ and then they could browse through the list of all of their specific videos and screen captures.

Feature request #2 – Post to WordPress
This would be another time saver. At the point where I’m ready to share my video, if I could select from a list of WordPress websites that I’ve already authorized, when I click share, Jing could automatically upload the image or video directly in to the media library.

Hopefully somebody over at TechSmith.com will run across this and, with any luck, these can be added to their list of features to add in… (fingers crossed)

zappos_tony_bunny

Blog World Expo 2008 – Day 1 Recap

It’s hard to believe that it’s been a year since the last Blog World Expo. I have been looking forward to this event for quite a while and I’m glad to say that at the end of day 1, I was not disappointed.

The day started off with the “State of the Blogosphere Adress” & Opening Keynote. Richard Jalichandra from Technorati started out by giving some really interesting numbers related to blogging and how blogs are changing the face of media. For example:
– 4 of the top 10 entertainment sites are blogs (OMG, TMZ, Asylum, Perez Hilton)
– 7.4 million blogs posted in the last 120 days
– 1.5 million in the last 30 days
– 2/3 of bloggers are male
– 50% of bloggers are 18/34
– 70% have college degrees
– 72% of blogs publish in English

There is a bunch more and Technorati is set to release the results of a huge study they’ve been doing. Be sure to check out their site on Monday for the full update.

After Richard, Chris Aldren and Anil Dash from Six Apart took the stage. They spoke about the power of blogs and where blogging is headed and they asked the question what should blogging 2.0 be? They spent a lot of time talking about the products available from Six Apart (Movable Type, Type Pad, Vox, Blogs.com, BlogIt, etc.) which didn’t go over really well with the people I was sitting near (myself included.) Though, I will say that I’m quite interested in checking out BlogIt which is a tool for managing your blog from your iPhone. If it works better than the WordPress iPhone app, I’ll definitely switch to using it until the WP app catches up.

The first breakout session I went to was Making Money Online with a Blog. This panel contained John Chow, Brian Clark, Zac Johnson, Darren Rowse and Jeremy Schoemaker and was moderated by Jim Kukral. In this session they talked about which forms of advertising made them the most money (direct ad sales being #1, affiliate links being #2 and google adwords being #3, except in the case of CopyBlogger where he makes his money by selling information products and subscriptions), they talked about tools they use for selling ads automatically and the biggest point they tried to drive home is that you need to be passionate about what you blog about. If not, it’s going to show in your content and you’ll likely never make any real money.

During the session they had people come up to the mic and tell them their URL. They would pull it up on the screen and they’d take turns telling the person ways to improve their site in order to make money. Even though I didn’t go to the mic, I was still able to apply the things being said to my own site. There are changes coming soon.

After lunch I went to the Power Widgets to Amp Your Blog session. As a breakout session, I’m on the fence about it still. But, that being said, I got a fantastic look at Lijit and am glad I got to see it. Sure, I could have gone for a demo on the show floor, but I’m stubborn and thought I already knew what Lijit had to offer. The other presenters were WidgetBox, OutBrain and PicApp. All of which had something cool to offer. Widgetbox has 135,000 widgets for you to use on your site. They can also create a widget of your blog content that can then be added to other sites. I especially liked the idea of creating a content mashup widget. I’ll have to research that a bit more this week. OutBrain is a widget that creates a “you might like:” section at the bottom of each of your posts and links to other posts that have similar content. You can have it pull in content from the web, from a selection of sites you provide, or you can lock it down to just your own blog. And finally PicApp. This app gives bloggers access to photos from sites like Getty Images without having to purchase them. Instead, they add a box underneath each image that they monetize for the photographer who took the shot. The nice part is, you can have access to high quality images without running the risk of getting sued for using unlicensed content.

The final session of the day for me was Creating Customer Loyalty with Social Media. This was, by far, the best attended session. Every seat was filled and there were people standing along the back and both side walls. The panel consisted of Toby Bloomberg, Tony Hsieh, Brian Solis and Frank Eliason and moderated by Becky Carroll. The main point being that people build relationships with people, not with companies. Companies that try to control all the messaging that is put out by the company are doing there customers, and themselves a great disservice by acting in this way. Comcast’s policy for web content is this:
– disclose that you work for comcast
– if you have access to private information, don’t make it public
– use your best judgement

Tony from Zappos expanded on that by saying that your company culture has to revolve around proving good customer service. By not letting your employees have an online voice, you’re basically saying that you don’t trust your employees. (I’m also happy to say that after seeing this post about Tony giving Bunny Ears to people like Bill Gates, Serena Williams and Penn Jillett, I now have my very own bunny ears shot with Tony!)

Aside from the sessions, I made several great connections with people who I’ve been looking forward to meeting in person. I think I may have secured another couple of speakers for WordCamp:Las Vegas in January and have laid the ground work with a few companies who may sponsor a portion of the event as well. More on that in the coming weeks.

Tomorrow I’ll write about my experience in the expo hall and a recap of day 2. Stay tuned.

One month with Akismet

Last month while attending BlogWorld I had the opportunity to hang out with Matt Mullenweg, the founding developer of WordPress, at the WordPress Meet-Up. One of the topics we spoke about was Akismet, the spam blocking plugin. I had used Akismet a few years back, but had run in to some issues with it. At that time I found Spam Karma and started using it exclusively. A few drinks, a little dinner and some great conversations later, I headed home to give Akismet another shot.

I downloaded and installed the latest copy of Akismet on 2 blogs; geeeek.com and austinsink.com. While this blog has been around for several years, austinsink.com is relatively new and I was curious how it would handle the two. Would I seed any differences between a blog that receives a TON of spam and a blog that receives hardly any.

geeeek.com results
Total Comments: 10,724
Real Comments: 33 (0.30 %)
Spam Comments: 10,691 (99.7 %)
False Positives: 0
Uncaught Spam: 0
Uncaught Spam Pingback: 1

austinsink.com results
Total Comments: 73
Real Comments: 14 (23.72 %)
Spam Comments: 59 (76.28 %)
False Positives: 0
Uncaught Spam: 0
Uncaught Spam Pingback: 1

Overall I have to say I’m really pleased with Akismet. In the 2 months leading up to the switch, Spam Karma had been doing a great job of keeping the spam out of my blog and had zero false positives, but I was receiving a hefty amount of spam pingbacks that were all going uncaught.

I did have a bit of “user error” the first few days I was running Akismet. In the Options -> Discussion settings on WordPress, I had left the following box checked:

WordPress Settings 

This setting was being overruled by Spam Karma. When I switched to Akismet, all comments needed to be approved prior to showing up on the blog. I was under the impression that all my comments were being held up as spam and I was counting these as false positives. I unchecked the box and the comments were flowing freely to the blog without my intervention. All is right in the world again, yeah.

So for now, I’m going to stick with Akismet. It seems to be doing the job fantastically.

Video Blog: 11/27/07

This is my first shot at video blogging. Leave me a comment and tell me if you love it or hate it.

Here’s some companion links from the video blog:

  • utterz.com
  • Follow me on Utterz
  • scratchback.com
  • Sites using ScratchBack