Kill Bill on Microsoft Azure

Kill Bill on Microsoft Azure

The open-source Kill Bill platform provides advanced subscription management as well as payment APIs. Businesses of any size, from the 2-person startup to public companies, rely on it for their e-commerce recurring billing and shopping cart payment needs.

Lots of SaaS companies have similar offerings. Choosing the right partner from the get go is critical however, as migrations are error-prone and difficult. If you are a young startup, you probably want something simple, cheap and low-maintenance, which can adapt to your needs as you grow. Kill Bill combined with Microsoft Azure BizSpark for startups gives you just that, which probably explains the uptick of requests we’ve had recently regarding integration with Microsoft Azure.

Thanks to our Docker images, this is quite easy – this tutorial will show you how to deploy Kill Bill integrated with Stripe in a few commands.

Pre-requisites

VM setup

Create the VM using docker-machine:


docker-machine create -d azure \
                      --azure-ssh-user ops \
                      --azure-subscription-id AZURE_SUBSCRIPTION_ID \
                      --azure-open-port 8080 \
                      --azure-open-port 3000 \
                      azure

You should see it running at https://portal.azure.com/#blade/HubsExtension/BrowseAllResourcesBlade.

Write down the IP of the machine by running docker-machine ip azure

Configure your shell for the rest of the tutorial:


eval $(docker-machine env azure)

Database setup

For this tutorial, we will simply run a MySQL database in a Docker container on the same host:


docker run -tid \
           --name db \
           -p 3306:3306 \
           -e MYSQL_ROOT_PASSWORD=root \
           -e MYSQL_DATABASE=killbill \
           mariadb

Modify the database to make sure it is using the ROW binlog_format:


echo "set global binlog_format = 'ROW'" | docker exec -i db mysql -h localhost -uroot -proot

To install the tables required by Kill Bill itself, run:


curl -s http://docs.killbill.io/0.16/ddl.sql | docker exec -i db mysql -h localhost -uroot -proot -D killbill

To install the tables required by the Stripe plugin, run:


curl -s https://raw.githubusercontent.com/killbill/killbill-stripe-plugin/master/db/ddl.sql | docker exec -i db mysql -h localhost -uroot -proot -D killbill

You can verify the 49 tables were correctly installed by running:


echo 'show tables' | docker exec -i db mysql -h localhost -uroot -proot -D killbill

Kill Bill setup

Create the Docker container which will run Kill Bill with the Stripe plugin, connected to the MySQL container:


docker run -tid \
           --name killbill \
           -p 8080:8080 \
           --link db:dbserver \
           -e KILLBILL_CONFIG_DAO_URL=jdbc:mysql://dbserver:3306/killbill \
           -e KILLBILL_CONFIG_DAO_USER=root \
           -e KILLBILL_CONFIG_DAO_PASSWORD=root \
           -e KILLBILL_CONFIG_OSGI_DAO_URL=jdbc:mysql://dbserver:3306/killbill \
           -e KILLBILL_CONFIG_OSGI_DAO_USER=root \
           -e KILLBILL_CONFIG_OSGI_DAO_PASSWORD=root \
           -e KILLBILL_PLUGIN_STRIPE=1 \
           killbill/killbill:0.16.7

Check the Kill Bill logs to verify it was started correctly:


docker logs -tf killbill

Kaui setup (optional)

While Kill Bill is now ready to be used, we recommend installing Kaui as well, the Kill Bill Admin UI.

Kaui needs its own database and set of tables. We will also create an initial admin user:


echo "create database kaui" | docker exec -i db mysql -h localhost -uroot -proot

curl -s https://raw.githubusercontent.com/killbill/killbill-admin-ui/master/db/ddl.sql | docker exec -i db mysql -h localhost -uroot -proot -D kaui

echo "insert into kaui_allowed_users (kb_username, description, created_at, updated_at) values ('admin', 'super admin', NOW(), NOW());" | docker exec -i db mysql -h localhost -uroot -proot -D kaui

Start the Kaui container:


docker run -tid \
           --name kaui \
           -p 3000:8080 \
           --link db:dbserver \
           --link killbill:killbill \
           -e KAUI_URL=http://killbill:8080 \
           -e KAUI_API_KEY= \
           -e KAUI_API_SECRET= \
           -e KAUI_CONFIG_DAO_URL=jdbc:mysql://dbserver:3306/kaui \
           -e KAUI_CONFIG_DAO_USER=root \
           -e KAUI_CONFIG_DAO_PASSWORD=root \
           killbill/kaui:0.7.0

Check the Kaui logs to verify it was started correctly:


docker logs -tf kaui

Testing

Kill Bill is available at VM_IP:8080 and Kaui at http://VM_IP:3000. Log-in to Kaui using the admin/password credentials and create your test tenant. You should now be able to create accounts, subscriptions, etc.

Our Getting started guide will guide you in exploring Kaui. Our subscription and payment guides will go over how to configure and integrate Kill Bill with your application. Make sure also to configure your Stripe credentials to start triggering payments.

Questions about next steps? Feel free to reach-out to our mailing-list for help!

4 Comments

  1. Do you guys have a .net api client?

    Reply
    • Hello Pierre,
      The community project has been going for 2 years without any progress. I am sure that Kill Bill has changed a lot in the past 2 years.
      Any plans for providing a .NET client, or at least contributing to the community project?

      Reply

Leave a Reply