Skip to content

빌링 서비스 및 오픈소스 도구 Pass 연계 메뉴얼

SeungpilPark edited this page Mar 20, 2017 · 1 revision

Docker images for Kill Bill

Quick start

Kill Bill 0.18.1 도커 시작하기:

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

도커 컨테이너의 ip 주소를 알아내기 위해서는 docker-machine env <name> 또는 환경변수 $DOCKER_HOST 를 사용하도록 한다.

Images

  • base/latest: shared base image with Tomcat 7 and KPM inside Ubuntu 14.04
  • killbill/latest: empty base Kill Bill image. The first time it is started, the latest version of Kill Bill is downloaded
  • killbill/tagged: image with Kill Bill installed (published on Docker Hub)
  • kaui/latest: empty base Kaui image. The first time it is started, the latest version of Kaui is downloaded
  • kaui/tagged: image with Kaui installed (published on Docker Hub)
  • killbill/build: official build environment for all published Kill Bill artifacts (useful for developers)

환경 변수 세팅

공용 환경 변수 일람:

  • KILLBILL_JVM_PERM_SIZE (default 512m)
  • KILLBILL_JVM_MAX_PERM_SIZE (default 1G)
  • KILLBILL_JVM_XMS (default 1G)
  • KILLBILL_JVM_XMX (default 2G)
  • KILLBILL_JVM_CMS_INITIATING_OCCUPANCY_FRACTION (default 70)
  • KPM_PROPS (default --verify-sha1)
  • NEXUS_URL (default https://oss.sonatype.org)
  • NEXUS_REPOSITORY (default releases)

킬빌 컨피그레이션 환경 변수:

  • KILLBILL_CONFIG_DAO_URL (default jdbc:h2:file:/var/lib/killbill/killbill;MODE=MYSQL;DB_CLOSE_DELAY=-1;MVCC=true;DB_CLOSE_ON_EXIT=FALSE)
  • KILLBILL_CONFIG_DAO_USER (default killbill)
  • KILLBILL_CONFIG_DAO_PASSWORD (default killbill)
  • KILLBILL_CONFIG_OSGI_DAO_URL (default $KILLBILL_CONFIG_DAO_URL)
  • KILLBILL_CONFIG_OSGI_DAO_USER (default $KILLBILL_CONFIG_DAO_USER)
  • KILLBILL_CONFIG_OSGI_DAO_PASSWORD (default $KILLBILL_CONFIG_OSGI_DAO_PASSWORD)
  • KILLBILL_SERVER_BASE_URL (default http://localhost:8080)
  • KILLBILL_SHIRO_RESOURCE_PATH (default classpath:shiro.ini)
  • KILLBILL_SERVER_TEST_MODE (default true)
  • KILLBILL_METRICS_GRAPHITE (default false)
  • KILLBILL_METRICS_GRAPHITE_HOST (default localhost)
  • KILLBILL_METRICS_GRAPHITE_PORT (default 2003)
  • KILLBILL_QUEUE_CREATOR_NAME (no default is specified, Kill Bill will use the hostname)
  • KILLBILL_SHIRO_NB_HASH_ITERATIONS (same default value from KillBill SecurityConfig (200000))

Kaui 환경 변수:

  • KAUI_KILLBILL_URL (default http://127.0.0.1:8080)
  • KAUI_KILLBILL_API_KEY (default bob)
  • KAUI_KILLBILL_API_SECRET (default lazar)
  • KAUI_CONFIG_DAO_URL (default jdbc:mysql://localhost:3306/kaui)
  • KAUI_CONFIG_DAO_USER (default kaui)
  • KAUI_CONFIG_DAO_PASSWORD (default kaui)
  • KAUI_CONFIG_DEMO (default false)

주의: bug in Sonatype where the sha1 is sometimes wrong. sha1 verification 를 해제하기 위해서, 도커 컨테이너 시작시 다음의 변수를 넣도록한다.: KPM_PROPS="--verify-sha1=false".

Configuration of the images is driven by the kpm.yml.erb KPM configuration file. Advanced users may need to extend it beyond the plugin properties exposed. To do so, you can create an overlay file as $KILLBILL_CONFIG/kpm.yml.erb.overlay: both files will be merged at startup, with the overlay having precedence. Take a look at our testing image for an example.

Local Development

아마존 RDS 대신 mysql 서버를 container 로 띄우고, RDS 라고 가정하도록 한다. Kill Bill server version 0.16.7 과 mysql container 로 배포 테스트를 진행하도록 한다.

  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:

데이터베이스의 binlog_formatRow 로 설정하도록 한다.

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

DDLs 를 추가한다.:

  • Kill Bill DDL

    curl -s http://docs.killbill.io/0.16/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

  1. analytics and stripe 플러그인을 포함하여 킬빌 container 를 생성한다.:
docker run -tid \
         --name killbill_0_16_0 \
         -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.16.7
  1. 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"

위 과정과 유사하게 Kaui 배포를 진행하도록 한다.:

  1. 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_0_7_0 \
           -p 8989:8080 \
           --link db:dbserver \
           --link killbill_0_16_0: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 \
           killbill/kaui:0.7.0
  1. More Play time... with KAUI

KAUI 는 다음 url 로 접근가능하다. : http://IP:8989/ where IP=$(docker-machine ip default). 최초 로그인은 admin/password 이다.

Clone this wiki locally