Having fun with Docker, Stripe and Kill Bill

Having fun with Docker, Stripe and Kill Bill

Note! An updated version of this tutorial can be found here.   Kill Bill has been dockerized! In this post, I’m going to show you how to get started with your own Kill Bill installation, integrated with Stripe, running on Docker.   Setup Start by installing Docker if you don’t have it yet. You will also need a Stripe api key. To get one: Create a free account at Stripe.com Go to your API Key Settings Write down the Test Secret Key   Deep dive into the Kill Bill container Our Docker image is based off the ubuntu:14.04 one. It comes with Tomcat and KPM (the Kill Bill package manager). Kill Bill is not yet present in the image: it is the role of KPM to fetch the Kill Bill war and its plugins. The first time the container is started, KPM will look at its configuration file (/etc/killbill/kpm.yml) and lay down the bits accordingly. The reason for this deferred step is to let you customize the image if you want to (Kill Bill version, plugins, etc.). You can start Kill Bill by running: docker run -tid --name killbilltest -p 8080:8080 killbill/killbill --name killbilltest assigns a name to the container, to be able to reference it easily later on -p 8080:8080 exports the port from the container, to access it from the host Here are some useful commands: docker logs -f killbilltest to tail the Kill Bill logs docker exec -ti killbilltest /bin/bash to log-in to the container docker exec -ti killbilltest cat /etc/killbill/killbill.properties to explore the Kill Bill configuration docker exec -ti killbilltest cat /etc/killbill/kpm.yml to explore the KPM...

Deploying Kill Bill on OpenShift

Thanks to the entry-level offering of the Cloud Application Platform by Red Hat — OpenShift, you can run in the cloud Kill Bill and the Kill Bill admin UI — Kaui, for free. This article will guide you through it. Note that you only have free access to small containers (so called gears), which are less than ideal to run Kill Bill on: RAM is capped at 512MB, which is a bit small for the JVM (especially if you install Kill Bill plugins). This is reflected in the UI, which feels slow. While it is probably good enough for quick prototyping, we recommend you use at least a medium gear for your production environment. Once you created an account, the first step is to setup the OpenShift command line client: gem install rhc rhc setup Check the OpenShift documentation for more details. Let’s create our Demo app, which will be running Tomcat and MySQL: rhc create-app Demo jbossews-2.0 rhc cartridge add mysql-5.1 -a Demo Note that for simplicity, we created a non-scaled application. This means that Tomcat and MySQL will be installed on the same gear. For a real production environment, we would create a scaled application instead, which would make OpenShift install automatically MySQL on its own dedicated gear. The next step is to download Kill Bill. Grab the latest jar-with-dependencies.war artifact from Maven Central. Creating the Demo app should have cloned a demo.git repository. Go to that directory and copy the war file (you can also cleanup the src/ directory and pom.xml file): cp /path/to/killbill-server-*.war webapps/ROOT.war git rm -r src/ pom.xml Kill Bill system properties can be...