Apache, nginx, Scripting, SVN

My tasks for the weekend

This is my plan for the coming weekend. In hindsight, I should have done all this over Labor Day weekend, but what do you want me to say – I was busy watching Netflix and eating oreos. This is likely going to be an uber-rough post, so my apologies.

Format / Update

  • Backup computer
    • SQL databases should be backed up separately for easy retrieval…
  • Format
  • Install Lion, upgrade to Mountain Lion (I wish there was a ML thumb drive… Maybe I’ll format, upgrade to Lion, purchase Mountain Lion, roll my own and re-format to keep things super fresh/clean)

Restoration / Rebuilding

  • Restore the bare minimum:
    • Dev Frameworks
    • Standard Apps (ST2, CS6, iTunes, etc.)
  • Install new AMP stack if OS X-default isn’t sufficient
    • I use an NMP stack currently… I’d love to keep using it but all of our client sites run on Apache… Perhaps Apahce on 80 and nginx on 8080.
    • Reminder: Setup music proxy
  • Reinstall Parallels and recreate my VMs (Debian, Ubuntu, Trixbox, Windows via Bootcamp)

Setup Version Control

I’m still thinking about how I want to do this, but what I’ve got so far, and very likely to change…
  1. Most likely git
  2. If possible, mirrored in two locations:
    1. External HDD
    2. My webserver
  3. Again, if possible, it should keep the last 3-5 revisions locally in case I need to revert without access to remote repo.
    1. Somehow this should all sync and not delete older local revisions until synced with the remote repo.
  4. I also want to write a script that will package a site / project when I’m finished… Ideally, it would:
    1. Export all linked databases (I’m fine with providing credentials and db names)
    2. Grab the latest revision
    3. Create a text file with:
      1. the path of the git repo
      2. the command I ran to generate
      3. the date, time, and location (work/home… manual entry)
    4. Tar it all and open a finder window with the file highlighted
I’m not sure if all that is possible because I don’t know nearly enough about git, or applescript / shell scripts, so this will be a good learning experience.

Final Thoughts…

Wish me luck.


Link Shorteners and a Call to Action

Some of you may know that I have a domain I use for link shortening: buze.co. If you hit up the domain root, it redirects you to my blog. But if you go to a shortened URL, such as buze.co/pe4es, it will redirect you to the proper page. I set this up using YOURLS because it seemed like the easiest way to get the domain up and running.

What you probably don’t know is that I have another domain that’s run off the same database. In any normal scenario, you’d probably want to split your databases on a per-service basis, i.e. separate personal from work, which is what this other project is. The reason I serve the same content is because I don’t shorten enough links to require two separate databases. And nobody can see the database anyway, so it doesn’t matter.

To achieve this, I symbolically link the work domain to buze.co. Coincidentally, /www is also a symbolic link.

My vhost paths are strange, but they get the job done. The actual path for this domain is /var/www/buzelac.com/public_html/ but that’s a different blog post.

/www/buze.co/index.php looks like this:

And then nginx handles rewrites for any “directory.” If the path isn’t a directory (!-d) and it isn’t a file (!-f), then it rewrites to the YOURLS script. Note: this can be handled with one step using !-e.

YOURLS isn’t bad. In fact, it’s actually pretty cool. It records how many clicks links get, has a stats page with graphs for hits and traffic location, and there’s even a nifty plugin to make it produce links similar in format to other services, such as “pe4es” instead of “23,” the default format.

…What’s the problem?

While YOURLS is a pretty decent link shortener, there’s something about it not being mine that I don’t really know how to explain. Essentially, I think there are some improvements that could be made (both programmatically and aesthetically), so I might as well just write my own.

YOURLS follows what I would call a “Web 2.0” approach, a term which I think should have been shot before it was even incepted. Clients always say, “This design isn’t ‘Web 2.0’ enough.” or “Yeah, this is good, but can you make it more… ‘Web 2.0’?” These clients don’t even understand what “Web 2.0” is, they’re just trying to sound savvy and keep up with the latest “trends.” If crappy gradients / color schemes, extremely rounded corners, and ill-fitting typography is what it takes to fit in, then I want to be as far away from conformity as possible.

I digress. The YOURLS code is messy in my opinion. Understandably so, as I don’t think the project was originally intended to be as big as it is. But still another reason that it will be easier for me to start from scratch. I prefer an object-oriented approach. Plus, this way, I’ll be able to easily integrate the new system with my new CMS I’m working on… but that’s another blog post.

The “Call to Action”?

The world doesn’t have enough URL shorteners. So I’m going to create another. Most likely a PHP / Redis approach, because I’m looking for my first project using Redis. But it could easily end up a PHP / SQL project as well. It really depends on how my experiments with Redis go. (I’m not extremely fond of the idea of everything being in memory; I’m really just looking for a NoSQL approach.) It will have to have an import feature, though, so I can copy all of my YOURLS links into the new system. And some sort of API for plugin creation. I’d also like some sort of module-esque system (plugins) to enable features like public URL submits, a user system, etc.

Closing Irony

Some of you reading this clicked the short link, which is currently produced with YOURLS.