My dev setup at YouNow: SFTP and a Remote Environment

When you don’t have a local development environment, development processes take a big hit in efficiency. Our stack at YouNow is dated and non-developer friendly, so I’ve had to work around some of the obstacles. This writeup will serve as an insight into my day to day workflow, in addition to serving as some documentation for posterity sake.

We use the following:

Backend: PHP, AWS, and MySQL
Versioning: SVN

Some tools that I use:
* iTerm2 for a terminal replacement with the Fish shell
* Codekit for JavaScript build systems and SLIM and SASS compilation
* Sublime Text 2 with the awesome SFTP plugin
* My PHP Repl for tinkering

SFTP Plugin

The lack of a local development environment means that you can’t see the output of the code that you’re writing locally. It also means that you always need an internet connection to do any work. Couple this with the fact that we’re using SVN.

The reason why we don’t have a local environment is that there are many moving pieces in our system:
* We’re very cron-job heavy. Replicating the cron-jobs for each of our machines isn’t great for our database and is quite wasteful. Hence, we simply use a shared development server.
* Our database schema changes frequently and keeping our local dbs synced would take extra effort
* We use dedicated WOWZA servers for video streaming
* And potentially other configurations (caching, no-sql session storage, etc)

There are several ways around the lack of a development environment:

  1. Master VIM and just code in the ssh session of your remote machine. No thanks.
  2. Actually create a local environment possibly using Vagrant. Kills a few days of productivity (which hurts such a young startup) but pays dividends in the long run.
  3. Use an SFTP plugin for your editor.

Since I use Sublime Text 2, I went with the well done SFTP plugin by Will Bond. The most notable usage of the plugin is that I watch my entire working directory. This means that when I save a file, that file gets uploaded to my remote server. I can pretty much mimic a local environment this way: I write code, save, and then refresh my browser. The delay in my actions gives the transfer of the changed file plenty of time to complete.

The downside to sftp

When you start using preprocessors like SLIM and SASS and their compilation through CodeKit, maintaining the “watch” status of each compiled file is a headache.

Basically, since Codekit will compile the SLIM file I’m currently editing, the SFTP plugin needs to be watching the compiled HTML file in order to kick the newly compiled file to my dev server. This hurts… espcially when the sftp plugin loses connection (due to a change in internet connection or the closing of sublime text) and you need to manually rewatch all of your compiled html and css files. Use Coffeescript and you’ll find yourself with a third editor pane that only contains watched compiled files… (I know)

I haven’t found a quick enhancement to this setup just yet. There are a few ideas for improvement:

  • sublime text build systems that may trigger automatic sftp transfers
  • bucking up and trying Vagrant
  • Ruby guard to handle both compilation (replacing Codekit) and sftp

The hard part is fixing development workflows while shipping product and meeting deadlines. I guess that’s startup life.

Comments

comments