Brilliant Corners

Simple bash aliases for Jekyll

As I get a little more comfortable with how Jekyll works, I've found a few Bash aliases that have been helping out. Below are four aliases I have set up to make blogging with Jekyll easier (with a little explanation for each).

# let's write an entry (cd to path and open up TextMate)
alias timetoblog="cd ~/code/blog && mate ."

# start up Jekyll for local preview of blog
alias serveblog="cd ~/code/blog && jekyll --server --auto"

# delete the existing built site and rebuild
alias buildblog="cd ~/code/blog && rm -rf _site/ && jekyll"

# use rsync to push the weblog to my host
alias deployblog="cd ~/code/blog && rsync -rtz --delete _site/ username@host.com:~/path/to/weblog/root/"

Each of these assume a little on how you have Jekyll configured, so you will have to adjust each for your own setup. You can see my own configuration options on Github.

Some of these tips originally came from the Jekyll wiki and various weblog posts.

2010-09-20 11:01PM — #jekyll #bashComments

Trying out Jekyll

I'll keep this short: I've yet again relaunched the weblog using yet other kind of weblog software. There are several not-so-well thought out reasons for changing everything again, but the main ones are:

  1. Since I didn't write this software, I won't be too tempted to rewrite it
  2. I have other ideas I'd rather be working on instead of rewriting weblog software (which I seem to have a problem with)
  3. Jekyll generates static files, which should lessen the load on my VPS

This one should hold me over for long enough. At least long enough to write another post.

2010-09-09 12:30AM — #ruby #github #jekyll #site newsComments

Installing MongoDB on Ubuntu

EDIT: Please take a look at some updated instructions. The information here is a bit out of date, and makes things a lot harder than it needs to be.

There are already a few installation tutorials for getting MongoDB up and running on an Ubuntu server, but each either left a step or two out, or their suggested setup wasn't what I was looking for, so I'm sharing my own tips. But, a few notes first:

  1. These instructions are how I installed MongoDB on Ubuntu 8.10 (Intrepid Ibex)
  2. Many of the tutorials out there recommend putting MongoDB in /opt/mongodb, but I chose /usr/local instead
  3. These instructions worked for me, and they probably will for you, but I can't guarantee a thing

Initial user and directory setup

Before installing anything, I'm going to prepare some necessary directories and create the mongodb user:

sudo adduser mongodb
# for the mongodb data files:
sudo mkdir /var/lib/mongodb
# for the log files:
sudo mkdir /var/log/mongodb
sudo chown mongodb /var/lib/mongodb/

Install dependencies

Install the needed dependencies for building MongoDB from source:

sudo apt-get install curl tcsh scons g++ xulrunner-1.9-dev libpcre++-dev libboost-dev libmozjs-dev

Now, the Mozilla JavaScript libary. I normally install from my own temp directory (~/tmp), but download and compile from wherever you're comfortable:

curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
tar zxvf js-1.7.0.tar.gz
cd js/src
export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"
make -f Makefile.ref
sudo JS_DIST=/usr make -f Makefile.ref export

Build MongoDB

We'll use git to clone the source from their GitHub repository. I'm also going to compile the 1.2.2 release instead of the current HEAD. Again, get the source and build from whichever temp directory you're comfortable with.

git clone git://github.com/mongodb/mongo.git
cd mongo
# checkout the 1.2.2 release for building
git checkout -b build r1.2.2
# build:
scons all
# install:
sudo scons --prefix=/usr/local install

Now, create the init.d script file to have MongoDB start up on a reboot.

sudo vi /etc/init.d/MongoDB
# my version of this script is here: http://gist.github.com/291349
# make init script executable:
sudo chmod +x /etc/init.d/MongoDB
# set up runtime links:
sudo update-rc.d MongoDB defaults

And to get it up and running, just run the init script:

sudo /etc/init.d/MongoDB start

If all the steps above went without any problems, then MongoDB should now be up and running on your Ubuntu server.

Here are some references that helped a lot in getting my own setup working:

Now, what I'm using MongoDB for will have to wait a day or so. :)

2010-01-31 08:34PM — #mongodb #ubuntuComments

A simple Ruby script for backing up files to Amazon S3

After reading about the troubles Jeff Atwood had with his host going down, I figured it was time I get a real backup process in place for my own data. Since my hosting is self-managed (at Slicehost) without any sort of attached official backup plan, I'm definitely vulnerable to any sort of server failure. I've had a near miss a couple of times with personal computers--which I now back up often--but I've yet to set up anything recurring for my hosted files.

So, I took some time over the weekend and wrote a simple backup script with Ruby that saves the archive files to Amazon S3. A while back I tried something similar using rsync, but at the time I stumbled on setting the SSH keys and all that up. Since I'm now using S3 to host images for The Tools Artists Use, adding another "bucket" to store some backups was a no-brainer.

The script works for me, and since it may be useful for others, I've put the code up on my Github account: simple-s3-backup.

2009-12-14 09:22PM — #ruby #system administrationComments

Weblog bankruptcy

Well, I did it. I killed the old weblog.

I didn't just change weblog software (although I did do that, too), but I'm getting rid of all the old posts. Half of them are outdated and the rest were sort of useless. It want to start somewhat fresh again.

In a few days, I'll have something a little more substantive on the big switch. Until then, welcome to the new brilliantcorners.org!

2009-11-25 01:14AM — #site newsComments