I recently setup a new CI/CD platform for a project written in Python based on my default choice of Jenkins, however I noticed that the VPS I was running it on kept killing Jenkins because I was running out of RAM. Sure enough, “free -m” revealed that I had under 20M free on the system just by starting Jenkins.
I tried tweaking the Java memory requirements but that just prevented Jenkins from running at all, so I started looking for a Jenkins replacement that I can run happily on my systems (i.e. “behind the firewall”) with minimum RAM requirements and support private repos on github/bitbucket (I don’t ask for much do I? 😉 ).
After looking at drone.io, codeship.io and TravisCI, I found Strider – an OpenSource CI/CD tool written in Node.js and ready to run on Ubuntu 14.04 (my current OS of choice).
Strider also has plugins for Slack so that we can be notified when builds pass or fail.
Installation of Strider on a fresh installation is relatively straight forward and this article is the first in what I hope will become a series on how to use Strider with Python to automatically test and deploy your code.
Much of the following is a drawing together of existing knowledge from here and here – the main answer seems to be that installing Node.JS from the PPA is a bad thing.
To install Strider on Ubuntu 14.04 (assuming a fresh installation), type the following commands as the root user:
apt-get update && apt-get upgrade apt-get install mongodb nodejs-legacy npm git python-virtualenv python-dev useradd -s /bin/bash -m -d /home/strider -c "strider" strider usermod -aG sudo strider npm install -g strider
I know that this is all very manual, however I haven’t had a chance to package this into a chef recipe or ansible playbook yet!
Once you have successfully installed Strider, create an upstart script at /etc/init/strider.conf with the following content:
#!upstart description "Strider upstart job" start on startup stop on shutdown script export PORT=4000 export DB_URI="[Your MongoDB URI]" # NOT REQUIRED IF RUNNING ON LOCALHOST export SMTP_HOST="[YOUR MAIL SERVER]" export SMTP_PORT="[YOUR MAIL PORT]" export SMTP_USER="[YOUR MAIL USER]" export SMTP_PASS="[YOUR MAIL PASSWORD]" export SERVER_NAME="[IF NOT http://localhost:3000]" export STRIDER_CLONE_DEST="/home/strider/builds/" export PLUGIN_BITBUCKET_APP_KEY="[BITBUCKET APP KEY]" export PLUGIN_BITBUCKET_APP_SECRET="[BITBUCKET APP SECRET]" export PLUGIN_GITHUB_APP_ID="[Your Github Client ID]" export PLUGIN_GITHUB_APP_SECRET="[Your Github Client Secret]" echo $$ > /var/run/strider.pid exec sudo -u strider \ DB_UIR=$DB_URI \ SERVER_NAME=$SERVER_NAME \ PLUGIN_GITHUB_APP_ID=$PLUGIN_GITHUB_APP_ID \ PLUGIN_GITHUB_APP_SECRET=$PLUGIN_GITHUB_APP_SECRET \ PLUGIN_BITBUCKET_APP_KEY=$PLUGIN_BITBUCKET_APP_KEY \ PLUGIN_BITBUCKET_APP_SECRET=$PLUGIN_BITBUCKET_APP_SECRET \ PLUGIN_BITBUCKET_HOSTNAME=$SERVER_NAME \ SMTP_HOST=$SMTP_HOST SMTP_PORT=$SMTP_PORT \ SMTP_USER=$SMTP_USER SMTP_PASS=$SMTP_PASS PORT=$PORT STRIDER_CLONE_DEST=$STRIDER_CLONE_DEST \ strider >> /var/log/strider.log 2>&1 end script
The above configures Strider to use both Github and BitBucket for integration and allows you to set a database URI if you are hosting Mongo elsewhere.
The next step is to create a strider admin user that we can use to log in to the system:
su - strider strider addUser
Follow the prompts and you will end up with an administrative user that we can log in with
Connecting to MongoDB URL: mongodb://localhost/strider-foss Enter email []: mmw@lunchtimetrains.co.uk Is admin? (y/n) [n]y Enter password []: ******** Email: mmw@lunchtimetrains.co.uk Password: **** isAdmin: y OK? (y/n) [y]y adding User added successfully! Enjoy.
and now we can start the service:
start strider
Give your host a few seconds to spool up and then you should be able to access Strider at http://<your-host-name>:4000.
I found it incredibly intuitive to configure my jobs etc once I had logged in to Strider and linked it to my Bitbucket account, and running them is even easier!
I’m going to work with Strider for the next few daysso I’ll post more here once I’ve had a good play with it.
EDIT: With Strider running on the VM and executing a job, I still have 186M free in RAM – much better than Jenkins!
Glad you’re enjoying Strider! Thanks for writing this up — I think I’m going to reference that upstart script in the future… What is the total RAM on that box? 512 ?
LikeLike
The upstart script was taken from the tutorial blog post linked above, I’ve just added some variables to enable the bitbucket stuff.
I’d ideally want to refactor that to take input from a “defaults” file or similar so that we separate code from config but for now it will do nicely 😉
The VM that this is running on has 1G RAM and whilst that’s fine for running unit tests etc. I think I’d want to scale out the slaves using Docker for the functional testing.
LikeLike
Take a look at [Docker](https://www.docker.com/)
LikeLike
Docker will be the next step here using the remote executors – I hope to get that up and running in the near future to allow for full functional testing of web apps etc.
That’s going to be a bit more involved and I want to get it working before I start writing it up!
LikeLike
Hi, how are plugin updates working for you? Did you have to set some permissions or so? When I try to update a plugin from the web interface, I end up being not able to do so because strider was installed under root but is not running under root.
LikeLike