Continuous integration and deployment servers are vital to the development process. Especially for web applications, being able to immediately test your branches and automatically deploy them is invaluable. Strider is a new open-souce continuous deployment suite written in nodejs. While it is quite new and not without quirks, it features web hooks, email alerts, full Github integration, account management, Heroku deployment, and Sauce Labs integration.
This article is a quick tutorial on how to set up your own in-house installation of Strider on a Digital Ocean VPS as low as $5/month.
Setup DigitalOcean account
The first step is, if you don’t have one already, register an account on Digital Ocean. You will be required to enter billing information before you can create any “droplets” (Digital Ocean terminalology for a VPS instance).
Create a droplet - Ubuntu 13.04 x64
Now we need to create our droplet that will host the Strider instance. I chose to register a 64 bit Ubuntu 13.04 installation, if only for the easy access to an up-to-date nodejs installation through Chris Lea’s PPA. You can pick any distribution you would like, but you’ll have the find the appropriate packages yourself.
When your droplet has been provisioned, Digital Ocean will send you an email with your root password. Now you can SSH into the root account of the droplet, and change the password.
As always, you should change the root password now that we have logged into the droplet:
Bring the system up-to-date
The droplet might be out of date from the official Ubuntu repository, so let’s be sure that we are running the latest updates and software before doing anything:
Be sure to reboot if necessary. If you do reboot, you will be disconnected from the droplet. Simply reconnect via SSH again once the droplet is back up and running.
Since Strider is written in nodejs, and our testing application will be a nodejs application, we are going to need to install nodejs! Ubuntu offers a package for this, but due to the constant development of nodejs it is very outdated. Instead, we will register a new repository via Chris Lea’s PPA.
Now let us install nodejs! A signifigant amount of nodejs dependencies we will be using require compilation, so we will also install g++ and make. Remember to update the cache first as we have recently added a repository.
Now, let’s install Strider through npm.
Creating a MongoDB database
Strider uses a MongoDB database to store its meta information. This includes things like users, invitation codes, repository information, and so on. It doesn’t require much, so you can likely host your own MongoDB server and use that if you would like. For my purposes though, I found it easier to just set up a free managed database with MongoHQ. Their free tier is more than enough to support Strider’s database needs.
Sign up for an account on their signup page, then create your Strider database.
After creating the database, you will be dropped into their database web console. Strider hasn’t been configured yet, so there will be nothing there. Make sure to keep track of the MongoDB URI though, it will be used to configure Strider.
Create a Github application
For Github integration, we are going to need to create a Github application under our user account. This application will have OAuth tokens that will be used to authenticate your Strider instance with Github accounts. To register a Github application, go to the “Register a new OAuth application” page. I’m going to be using port 4000 for hosting my Strider instance, if you’d like a different port you will need to change your entries appropriately. Be sure to use your IP address as well.
After registering a new Github OAuth application, you will be taken to that application’s control page. The control page will list the Client ID and Client Secret for the application. Be sure to keep track of these, because you will need them when configuring Strider.
Getting SMTP credentials
In order for Strider to send our email notifications we will need access to SMTP server credentials. Just like with the MongoDB server, you may host your own if you’d like! In my case, I chose to go with Mandrill for SMTP service. They provide a free tier as well, which should be more than sufficient for Strider’s traditional needs. You can register an account with Mandrill on their signup page. After you have an account with Mandrill, you can navigate to their SMTP & Credentials section. There, you will find your SMTP credentials that you will use to configure Strider.
Add an initial administrative user
Before we go about starting Strider, we should create an initial administrative user. Without at least one user account, we can’t log in. After you have the one administrative account, however, you can create more accounts and send invites through the web interface. We just need to create the one, and be sure to specify that it is an administrative user. You will need your MongoDB URI here.
Create the Strider Upstart job
We are going to want to use Strider as a service, as this will make our life much easier on a server system. Recent versions of Ubuntu use Upstart, so we will be creating an upstart job for Strider. This will allow us to daemonize Strider and provide us with start, stop, and status scripts. This is also where your configuration information that you collected earlier is going to be needed. Be sure to use your port and IP address. Also, ensure SERVER_NAME does not have a trailing slash.
Use your favourite terminal text editor to create
Create a Strider user
If you happened to notice the references in the script above, we are going to be running Strider under a non-root user. In case of a security related issue in Strider, we don’t want to be providing root access to an attacker. Let’s create a separate user called “strider”.
We should also disable password login for the “strider” user. You will still be able to login to that account via
sudo -u strider, but this will disable anyone from logging into the account via password.
If everything has gone right, it’s now time to start up our Strider instance!
Later on, you can stop your Strider instance with the
stop command, and see the status of it with the
status command. Your log file for Strider will be in
/var/log/strider.log, and you can check debugging output there. If anything went wrong, that is also were you will find the errors.
Login to Strider
If everything went right, you should be able to open up your web browser and direct yourself to your Strider instance on your IP and port!
You will be able to login to your Strider instance with the email and password of the account that you created earlier, and the first page you see will be your dashboard.
Add a repository to Strider
Unfortunately, the dashboard won’t be very interesting yet since we have not configured any repositories to run tests on. The easiest way to add a repository will be to directly connect with your Github account. You should get an OAuth permissions dialogue upon clicking the link.
If you run into issues with connecting your Github account, you have likely made an error in your Github application settings or your Strider environment variables. The hosts need to match exactly. The screenshots in the sections above can help you with what that should look like if you get stuck.
Assuming all is well though, you should see a list of the applications under your account!
Go ahead and add one. Strider will automatically set up all the necessary hooks, and immediately run your first test. You’ll be able to see the test status on the dashboard, and you’ll recieve an email notification when the test completes. For a nodejs application, Strider will automatically run
npm test. You can configure this to run a separate command, see their docs for more information.
At this point you might want to make a snapshot of your droplet, if you’re using Digital Ocean’s hosting. This will allow you to roll back to that point, or spin up additional copies of that image later on with different resources.
You can now begin to explore all of Strider’s features. You’ll likely want to invites other users to your instance, and you can send them email invitations through the administrative interface. You can also set up Heroku deploy keys so that your builds will automatically deploy.
As Strider is under heavy development, new features and bug fixes will likely be coming out in the near future. You can update your Strider installation at any time by logging into the instance and running
npm update -g strider as root.
And with that, you should be all set! Strider is an exciting new CI/CD that looks like it has a promising future. If you have any issues or questions with the setup, send me an email at email@example.com.
Updated January 18, 2014: Updated for Strider version 1.4.3
Updated April 5, 2015: Added syntax highlighting