In the previous post of this series, I talked about the different technologies we’ll be using and the sample project which is freely available, in this post we’ll cover the basics of setting up a functional development environment, one which will allow you to develop and instantly deploy your code to production so it is available to the rest of the world.
I think that the hardest thing about starting a new service for the first time is, well, getting started. If you’re a seasoned developer, you’ve done a couple of things in your life, maybe even led some projects, you feel you can do anything. But when starting out on your own, you are faced with a challenge you haven’t faced before. In most cases, even as a fifth or sixth developer at a startup, there’s a skeleton on which you work. Somebody already setup the framework, built the necessary scripts, setup the build/deploy process, created the minimal classes. Your job is now to add the functionality, possibly adding new infrastructure that was never there, but most times there’s something to work on top of.
For a completely new service there’s nothing. You need to download the IDE, set it up, configure your application from scratch, deploy it somewhere (locally or all the way to production), and make it work.
You can check out my post on some of the tools we’ll use just to get a general idea of the different stuff you might need to install at different stages of your project. One thing to notice, all of the tools I’m going to use in this series of posts are free, open source tools, or those that are free for use by small startups which are just getting started. You might need to pay for it at some point when your project grows, but not right now.
You’ll need to do the basic stuff of getting an OS (virtual or real, preferably Unix based, I use Mac OSX, but Ubunto is a good choice for development as well), installing JAVA, a basic text editor, and some kind of image editing software (you can get adobe photoshop for a free one month trial, more than you’ll ever need for starting out). I use Chrome for all my browsing, if you’re on Windows you might still be using IE, but as it is no longer the most popular browser, I suggest switching to Chrome for the initial testing stages of your work.
So once you have all those setup, you’ll need an IDE. You can checkout my short post on choosing an IDE, I personally believe that for a startup Eclipse is more than enough. I use “Eclipse Java EE IDE for Web Developers.”, you should get some plugins installed, at least EGit (git support) and m2e (maven support).
Next step is to get source control software, I use GIT and the Basic Service project is hosted in a GIT repository on Google code, but Subversion is a decent choice as well. After that, install Maven, you’ll use it extensively. Last thing you will need to go through this tutorial is SSH, this will be used for deploying your work to production (cloudbees uses SSH for its repository communication). Note that I’m using Cloudbees as the git repository, it’s also possible to use GitHub and run from there but we won’t cover that right now.
So now you can checkout stuff, and open it in your IDE, that’s cool. You might be tempted to install an application server like Tomcat, and that’s ok, but it’s not really needed. Jetty is a very good application server which you can use directly from your IDE and it will automatically update your project as the source changes, and you can run it using project configuration only (maven FTW). We’ll get to that later, for now, let’s leave Tomcat out of the equation.
At this point, the best thing for you to do, is watch a video! Not just any video, you should watch this one. This is one of the most useful tutorials I’ve ever watched, it will take you from (almost) zero (where you are at right now or at least where I was when I started) to 100 (a fully operational, continuously deployed project) in 30 minutes (actually 26).
Come back when you’re done (meaning you followed the instructions, setup everything, built and deployed it to production, and it works for you).
So now you’re a couple of steps further than you’ve been when you started reading. You already have your work environment setup, you’re compiling and deploying an app to production, you even have it saving stuff to a production repository.
Next you’ll want to setup your local environment so you can test stuff locally. You’re almost ready, just need to install MongoDB so you can point your application to your local DB instance (it will also work against the instance on Cloudbees if you prefer, but I’d rather have my local instance which I can play with and explore). So once that’s installed, try to get it running and point your app to use the local instance. When that’s done, if you’re on a laptop like me, it means you can work from your favorite spot (on the beach?) and not require an internet connection to develop stuff.
Great, we’re ready to move on. The next post will talk about getting the Basic Service project over to your development environment, and setting it up so you play around with it and learn the technology involved, or even start developing your own online service.