Create a DevOps platform with Clever Tools and NodeJS-Part 1: DVCS

Philippe Charrière
3 min readSep 18, 2017

--

A few days ago, I explained how I scripted Clever Tools to deploy code on the cloud (at Clever Cloud) see “Scripting Clever Tools with NodeJS is more fun … And more efficient”. You should know that you could also deploy binaries on the Clever Cloud platform, not just code.

When I worked at GitHub, I learned a lot and especially about DevOps processes (CI, CD, GitHub Flow ❤️, …) and I use all theses skills all the days. So, one of my side projects is to create a DevOps platform for small teams with this components:

  • GitBucket as Git repository management (it’s like a “little GitHub”)
  • Jenkins as CI and automation server
  • Let’s Chat as chat platform (like Slack)
  • And of course, a bot with Hubot

So I decided to create tools to deploy these components very easily on Clever Cloud. That’s why I added some feature to my script (I called it Casti), to facilitate the process.

Deploy binaries on Clever Cloud

GitBucket is very easy to use, it’s a war file, you just have to launch a command like that: export GITBUCKET_HOME=storage/.gitbucket java -jar gitbucket.war

So, the global process to deploy it on Clever Cloud is as follows:

  • Create a FS-Buckets add-on (it’s a file system with persistence), you need it to store your Git repositories
  • Provision a “war/jar application” on Clever Cloud with its environment variables
  • Link the application to the FS-Buckets add-on
  • Download the binary (for us, it will be gitbucket.war )
  • Initialise a git repository (git init etc. …)
  • Commit all files and push them on Clever Cloud

You can do this with the “web administration Clever Cloud console”, or with the Clever Tools, it’s easy to do, but it’s a little bit repetitive and boring 😉

👋 So you can use my tool Casti and my “recipes”.

Some days ago, Casti was only a helper to run shell commands:

This week-end, I added some tools to hide as much as possible the “shell” side and to facilitate the deployment of an application. My goal is to do something a bit like the Vagrant files but in JavaScript and for Clever Cloud. So …

Deploy GitBucket on Clever Cloud with NodeJS (and Casti)

I will not explain the genesis of the script, but present it directly. Each feature (or command) is a promise. If you use an async function, you obtain a more readable script of deployment:

With this 🥘 recipe, now it’s very easy to deploy an instance of GitBucket on Clever Cloud. And you can re-use it again and again and modify it for your own needs. (source code is here https://github.com/k33g/casti/blob/master/recipes/deploy-gitbucket.js)

Just, with running this recipe, I get a completely functional Repository Management tool:

Next time, I’ll explain how to deploy Jenkins on Clever Cloud and use it in conjunction with GitBucket.

So, stay tuned, next steps:

  • Jenkins and CI + CD with GitBucket
  • Let’s Chat and Hubot

Have a very nice 🌞

--

--