How do I setup killbill on my Mac

475 views
Skip to first unread message

fernand...@gmail.com

unread,
Oct 29, 2017, 1:53:19 AM10/29/17
to Kill Bill users mailing-list
Dear KillBill Support Department:
I'm having a hard time setting up killbill on my local Mac. I need help since I'm going to be using your platform to enhance my payment and billing software.

Am I missing something since I'm getting a refused connection when I tried to navigate
http://192.168.99.100:8989/
or
http://192.168.99.100:8080/1.0/kb/tenants

where 192.168.99.100 is my $(docker-machine ip default)

Any help is appreciated in advance.

Cordially,

Fernando Mejia


These are the steps I followed below:


Local Development

It becomes fairly easy to start Kill Bill locally on your laptop. For example let's start 2 containers, one with a MySQL database and another one with a Kill Bill server version 0.18.x (adjust it with the version of your choice).

Start the mysql container:
docker run -tid --name db -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=killbill mariadb
Configure the database: First, 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
And then add the DDLs:

Kill Bill DDL

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

Analytics DDL

curl -s https://raw.githubusercontent.com/killbill/killbill-analytics-plugin/master/src/main/resources/org/killbill/billing/plugin/analytics/ddl.sql | docker exec -i db mysql -h localhost -uroot -proot -D killbill

Stripe DDL

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

Note that the -e MYSQL_DATABASE=killbill argument to docker run above took care of creating the killbill database for us. When deploying to a production scenario, you'll need to do that step explicitly.

Start the killbill container with the two plugins analytics and stripe:
docker run -tid \
--name killbill \
-p 8080:8080 \
-p 12345:12345 \
--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_ANALYTICS=1 \
-e KILLBILL_PLUGIN_STRIPE=1 \
killbill/killbill:0.18.x
Play time...
curl -v \
-X POST \
-u admin:password \
-H 'Content-Type: application/json' \
-H 'X-Killbill-CreatedBy: admin' \
-d '{"apiKey": "bob", "apiSecret": "lazar"}' \
"http://$(docker-machine ip default):8080/1.0/kb/tenants"
You can also install Kaui in a similar fashion:

Configure the database:
Create a new database for KAUI
echo "create database kaui;" | docker exec -i db mysql -h localhost -uroot -proot
Add the DDL for KAUI
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
Add the initial admin user in the KAUI database:
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 8989:8080 \
--link db:dbserver \
--link killbill:killbill \
-e KAUI_KILLBILL_URL=http://killbill:8080 \
-e KAUI_KILLBILL_API_KEY= \
-e KAUI_KILLBILL_API_SECRET= \
-e KAUI_CONFIG_DAO_URL=jdbc:mysql://dbserver:3306/kaui \
-e KAUI_CONFIG_DAO_USER=root \
-e KAUI_CONFIG_DAO_PASSWORD=root \
-e KAUI_ROOT_USERNAME=admin \
killbill/kaui:0.8.6
More Play time... with KAUI
You can connnect to KAUI using the url : http://IP:8989/ where IP=$(docker-machine ip default). You will be able to login as a superadmin using account admin/password. From there you can follow our tutorials and documentation.

Pierre-Alexandre Meyer

unread,
Oct 30, 2017, 6:19:57 AM10/30/17
to fernand...@gmail.com, Kill Bill users mailing-list
Hello Fernando,

On Sun, Oct 29, 2017 at 5:53 AM, <fernand...@gmail.com> wrote:
Am I missing something since I'm getting  a refused connection when I tried to navigate
http://192.168.99.100:8989/
or
http://192.168.99.100:8080/1.0/kb/tenants

where 192.168.99.100 is my $(docker-machine ip default)

I'm afraid we don't have enough information to understand what is not working.

Can you confirm the Kill Bill container is running (check `docker ps`)? Also, is there anything useful in the Kill Bill logs (check the files in /var/log/tomcat7)?

--
Pierre

Pierre-Alexandre Meyer

unread,
Oct 31, 2017, 5:39:25 AM10/31/17
to Fernando Mejia, killbill...@googlegroups.com
[Adding mailing-list]

These instructions are for advanced users already familiar with Docker. I would suggest you follow our "Getting Started" guide instead (http://docs.killbill.io/latest/getting_started.html) as a first step.

Our main documentation (http://docs.killbill.io/) has also various step-by-step tutorials.

Hope that helps,

On Tue, Oct 31, 2017 at 2:45 AM, Fernando Mejia <fernand...@gmail.com> wrote:
Hi Pierre,
thanks for getting back to me. I guess I a bit confused on the docker installation instructions. Am I supposed to follow thoroughly all the instructions on this link

And I mean the instructions  below. Please pay attention to the underlined bold and italicized text


Quick start

docker run -ti -p 8080:8080 killbill/killbill:0.18.x(0.18.13  is the latest at the moment)

Images (Just these two images to pull from the list ?)

  • killbill/tagged: image with Kill Bill installed (published on Docker Hub)
  • kaui/tagged: image with Kaui installed (published on Docker Hub)

Environment variables

Just assume default values?

Local Development

  1. Start the mysql container:

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

  1. Configure the database: First, 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

And then add the DDLs:


  • Note that the 
    -e MYSQL_DATABASE=killbill argument to docker run above took care of creating the killbilldatabase for us. When deploying to a production scenario, you'll need to do that step explicitly.

Tomcat configuration (Do I do a manual installation of Tomcat in addition to use the docker command below?)


HTTPS

  1. Expose port 8443:

docker run -ti -p 8080:8080 -p 8443:8443 killbill/killbill:0.18.1

  1. Import your SSL certificate (see docs). For testing, you can just create a self-signed certificate:

sudo apt-get update

sudo apt-get install ssl-cert

sudo usermod -a -G ssl-cert tomcat7

  1. Update Tomcat's configuration:

# In /var/lib/tomcat7/conf/server.xml

<Connector executor="tomcatThreadPool"

           port="8443"

           connectionTimeout="20000"

           acceptorThreadCount="2"

           SSLEnabled="true"

           SSLCertificateFile="/etc/ssl/certs/ssl-cert-snakeoil.pem"

           SSLCertificateKeyFile="/etc/ssl/private/ssl-cert-snakeoil.key"

           scheme="https"

           secure="true" />


X-Forwarded headers support

When org.killbill.jaxrs.location.full.url=true, Kill Bill will build location headers using a full URL. In a typical load balancer scneario, which receives traffic on port 8443 and forwards it to port 8080 on the Kill Bill instances (i.e. SSL terminated at the load balancer), you probably want the headers to return something like https://killbill-vip.mycompany.net:8443 instead of http://10.1.2.3:8080.

To do so:

  1. Enable the RemoteIpValve (make sure to configure correctly at least the internalProxies and trustedProxiesattributes depending on your environment, see the docs):

# In /var/lib/tomcat7/conf/server.xml— (Am I supposed to create /var/lib/tomcat7/conf/server.xml? or docker creates it for me?)


<Valve className="org.apache.catalina.valves.RemoteIpValve"

       protocolHeader="x-forwarded-proto"

       portHeader="x-forwarded-port" />

  1. Set org.killbill.jaxrs.location.host=killbill-vip.mycompany.net

Without any X-Forwarded header, the default Location header will result to something like http://killbill-vip.mycompany.net:8080. With X-Forwarded-For: 10.0.0.0X-Forwarded-Proto: https and X-Forwarded-Port: 8443, the header will become something like https://killbill-vip.mycompany.net:8443.

You optionally also want to set requestAttributesEnabled="true" to org.apache.catalina.valves.AccessLogValve, to log the IP address from the X-Forwarded-For header in the access logs.


Build

All images are based upon a base image which (in theory) should not have to be rebuilt too often. In order to build it:

> cd docker/templates/base/latest (am I supposed to create a docker folder at some point? If so, when and where in the instructions?)


> docker build --no-cache -t killbill/base:latest .

To build an image:

make

To build a specific Kill Bill version:

make -e VERSION=0.x.y

To build Kaui:

make -e TARGET=kaui -e VERSION=0.x.y

To build MariaDB:

make -e TARGET=mariadb -e VERSION=0.x # e.g. 0.18

To debug it:

make run

To cleanup containers and images:

make clean

To run it:

make run-container

To publish an image:

# Build the image locally

export TARGET=killbill # or base, kaui

export VERSION=latest # or 0.18.0

make -e TARGET=$TARGET -e VERSION=$VERSION

docker login

docker push killbill/$TARGET:$VERSION

docker logout





Thanks in advanced, Pierre.

Cordially,

Fernando Mejia



--
Enviado desde mi Huawei





--
Pierre
Reply all
Reply to author
Forward
0 new messages