Skip to content

Commit

Permalink
merge from master (#4)
Browse files Browse the repository at this point in the history
* Update externely outdated killbill client version

* Bump kpm version for release

* Update version for release

* docker: Update KPM version in base image

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* docker: make the start command configurable via START_TOMCAT_OPTS

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* mention 4GB memory limit

* Update README.adoc

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* docker: make Tomcat the main Docker process

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* spec: fix assertion

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* circleci: upgrade Docker images

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: handle special escape sequence \N{}

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* account: expand the source file

To support things like ~.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* tasks: add KPM_DEBUG env variable to enable DEBUG logging

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix spec expectation

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* account: include reference_time in dates to fix

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: allow for blank DB passwords

Make sure we never fallback to the default password.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: add Kaui playbook

This also cleans up the Kaui role and associated configuration.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: update Kaui image to the latest base image

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: offline support

Make sure kpm install is idempotent when a sha1 file is
populated, even if no outbound networking is allowed.

If force_download is specified however (false by default),
network access to a Nexus instance is required.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* .circleci: clear cache

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: take into account force_download in KillbillServerArtifact#info

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: first pass at Flyway integration

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: better idempotency checks for baseline

Verified that if the schema_version table exists and is valid,
Ansible doesn't detect any change.

Verified that the task fails if the table exists and is invalid.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: improve migration errors handling

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: Flyway task cleanups and enhanced error handling

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: don't reinstall KPM unless needed

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: document Flyway feature

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: install Flyway in killbill image

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: docker: various cleanups

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: integrate kpm diagnostic

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* kpm: update version to 0.7.2 prior release

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: docker: update KPM to 0.7.2

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: skip validations before migration

If existing migrations have already been applied, Flyway will by default
validate all of them before migrating.

Our Ansible playbook however only downloads the delta of migrations to
run, not the full history: so if there are existing migrations, the
playbook would fail.

Flyway has a flag ignoreMissingMigrations since 4.1.0, but our binary is
still based on 4.0 and upgrading it is quite hard unfortunately.

Luckily validateOnMigrate skips that validation as well, so it offers a good
workaround for now.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* ansible: enable RemoteIpValve by default

See discussion at killbill#147.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: make dispatching and complete queue threads configurable

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* ansible: make Reaper configurable

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* tomcat: add X-Request-Id to access logs

* ansible: revisit JVM and Tomcat defaults

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* kpm: setup RuboCop

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix Layout/AlignArguments

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix Layout/AlignHash

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix Layout/EmptyLines

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix Layout/EmptyLinesAroundBlockBody

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix Layout/AccessModifierIndentation

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix Layout/*

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix various Style cops

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix various auto-correct cops

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* circleci: RuboCop integration

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* circleci: fix config

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: RuboCop iteration

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: RuboCop iteration

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: RuboCop iteration

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* circleci: upgrade Kill Bill version

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: revisit JVM and Tomcat defaults

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: fix typo in README

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: make JVM properties configurable

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: use killbill/base:0.21.x

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: tag latest as latest-0.21.x

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* circleci: switch to 0.21.x images

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* circleci: RuboCop integration

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix regression on recent rubies

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* circleci: fix typo

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* circleci: fix typo

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix issues reported by RucoCop

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix issues reported by RucoCop

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix issues reported by RucoCop

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix issues reported by RucoCop

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix issues reported by RuboCop

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix issues reported by RuboCop

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix formatter regression

String#% and format have two different signatures.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: add tests for cpu_information

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: add tests for disk_space_information

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: add tests for memory_information

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: add tests for entropy_available

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix specs on older Rubies

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: add tests for os_information

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: update README with caching behavior

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: document diagnostic commands

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix Tomcat PID detection in system command

This also cleans up the code a little bit.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: add --as-json option to kpm inspect

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: refactor uninstaller in preparation for cleanup command

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: add cleanup command

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* spec: cleanup sha1_checker_spec

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix issues with Nexus cache

* Nexus cache should be cleaned when removing an entry in the sha1 registry
* Nexus cache shouldn't index with LATEST

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix spec syntax for older rubies

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: add --version option to uninstall command

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix regressions in base_artifact_spec

* Fix caching behavior with LATEST: since versions are always resolved in the sha1.yml, caching won't work
anymore if LATEST is specified
* Be more lenient with the expected networking error (sometimes it's a timeout, sometimes a socket error)

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: implement retries around Nexus operations

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* plugins_directory: remove Litle entry

This plugin was for Litle before the acquisition by Vantiv.
The rebranding occurred in 2017 and integrating with the current
version of Litle would require code changes.

New users shouldn't use this plugin.

I've archived https://github.com/killbill/killbill-litle-plugin

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* plugins_directory: remove logging entry

The logging plugin (klogger) was an initial proof of concept
for notification plugins written in Ruby.

New users shouldn't use this plugin.

I've archived https://github.com/killbill/killbill-logging-plugin

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* plugins_directory: remove currency entry

The plugin isn't maintained anymore.

New users shouldn't use this plugin.

I've archived https://github.com/killbill/killbill-currency-plugin

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* plugins_directory: remove firstdata_e4 entry

First Data recommends switching to the Payeezy RESTful APIs instead.

New users shouldn't use this plugin.

I've archived https://github.com/killbill/killbill-firstdata-e4-plugin

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* plugins_directory: remove payu_latam entry

The plugin isn't maintained anymore.

New users shouldn't use this plugin.

I've archived https://github.com/killbill/killbill-payu-latam-plugin

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* plugins_directory: remove braintree_blue entry

The plugin isn't maintained anymore (Blue and Orange platforms
don't exist anymore).

New users shouldn't use this plugin.

I've archived https://github.com/killbill/killbill-braintree-blue-plugin
and https://github.com/killbill/killbill-braintree-demo

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* plugins_directory: remove zendesk entry

The plugin isn't maintained anymore.

New users shouldn't use this plugin.

I've archived https://github.com/killbill/killbill-zendesk-plugin

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* plugins_directory: clean legacy entries

Remove entries for unsupported versions of Kill Bill.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix spec expectation

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* Update plugins_directory.yml

* kpm: implement kpm info --as-json

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: trivial tweaks

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: glob support

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: improve docs

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* base_installer: RuboCop fix

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Account export: Add missing catalog_effective_date entry in DATE_COLUMNS_TO_FIX

* Import account: Add support to import b64 encoded value for billing_events

* Add instructions to make sure mysql LOAD_FILE works as expected

* Rubocop offenses

* README: document KAUI_CONFIG_DAO_ADAPTER property

When using PostgreSQL, one needs to specify `KAUI_CONFIG_DAO_ADAPTER=postgresql` for Kaui.

Otherwise, Kaui fails to start with the following error:

```
org.jruby.rack.RackInitializationException: No such file to load -- java.lang.StackOverflowError: null.rb
```

* Update plugins_directory.yml

* Update plugins_directory.yml

* kpm: better handling of large imports

Verified we can import very large tables (100k+ rows).

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: be more lenient when importing data

Ignore out of range errors for instance, in case the deployment
has a slightly modified DDL.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* database: fix RuboCop warnings

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: remove bintray profile

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* plugins_directory: remove legacy require section

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: fix build image

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* directory: small regex fix

No behavior change though.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: switch Maven url to HTTPS

See https://support.sonatype.com/hc/en-us/articles/360041287334.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* Update plugins_directory.yml

* kpm: prepare v0.8.0 release

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Revert "docker: tag latest as latest-0.21.x"

This reverts commit 7248b09.

* Revert "docker: tag latest as latest-0.21.x"

This reverts commit 7248b09.

* ansible: docker: updates for Kill Bill 0.22

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: don't use 0.21.x base image anymore

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: fix modules with latest KPM version

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: add missing logger import in modules

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix regression on Ruby 2.2.x

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: prepare v0.8.1 release

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* kpm: fix tests

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* docker: install latest PostgreSQL bridge

See also killbill#163.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* ansible: configure KPM bundle via environment properties

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugin_directory.xml for payment-test

* docker: add missing KPM env variables in killbill Docker image

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* plugins_directory: re-introduce kpm entry for backward compatibility

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update stripe version

* Update payment-test version

* kpm: force UTF-8 when opening files

This is necessary for split to work when parsing UTF-8 data.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

* Update plugins_directory.yml

* Update plugins_directory.yml

* Update plugins_directory.yml

* Replace logback.xml in the ROOT.war archive (no more shared logback.xml)

* Make tomcat \'webapps\' location configurable

* Replace KAUI logback.xml in the ROOT.war archive (no more shared logback.xml)

* Fix location where we unpack the ROOT.war

* Fix permissions for the ROOT expanded directory

* Update README.md

* Ignore unknown tables when importing account dump file

* Disable rubocop Style/Guard clause:

lib/kpm/database.rb:47:9: C: Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
        if response.include?('Table') && response.include?('doesn\'t exist')

I don't think the suggestion makes sense (apparently, I am not the only one: rubocop/rubocop#2903 (comment)

* Fix rubocop warnings

Co-authored-by: stephane brossier <sbrossier@groupon.com>
Co-authored-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Co-authored-by: Victor Mokry <victor.mokry@uwhiz.co>
Co-authored-by: Stéphane Brossier <stephane@kill-bill.org>
  • Loading branch information
5 people authored Jun 8, 2020
1 parent 950bedb commit 3c1bd1d
Show file tree
Hide file tree
Showing 120 changed files with 4,397 additions and 3,323 deletions.
81 changes: 53 additions & 28 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
build-jruby-1.7.26:
<<: *defaults
docker:
- image: killbill/kbbuild:0.2.0
- image: killbill/kbbuild:0.7.0
steps:
- checkout
- restore_cache:
key: v4-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
- run:
name: Install gem dependencies
command: |
Expand All @@ -24,20 +24,20 @@ jobs:
- kpm/Gemfile.lock
- kpm/.bundle
- kpm/vendor/bundle
key: v4-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}

test-mysql-jruby-1.7.26:
<<: *defaults
docker:
- image: killbill/kbbuild:0.2.0
- image: killbill/killbill:0.18.16
- image: killbill/mariadb:0.18
- image: killbill/kbbuild:0.7.0
- image: killbill/killbill:0.22.0
- image: killbill/mariadb:0.22
environment:
- MYSQL_ROOT_PASSWORD=root
steps:
- checkout
- restore_cache:
key: v4-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
- run:
name: Setup DDL
command: |
Expand Down Expand Up @@ -92,11 +92,11 @@ jobs:
build-ruby-2.2.2:
<<: *defaults
docker:
- image: killbill/kbbuild:0.2.0
- image: killbill/kbbuild:0.7.0
steps:
- checkout
- restore_cache:
key: v4-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
- run:
name: Install gem dependencies
command: |
Expand All @@ -109,20 +109,20 @@ jobs:
- kpm/Gemfile.lock
- kpm/.bundle
- kpm/vendor/bundle
key: v4-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}

test-mysql-ruby-2.2.2:
<<: *defaults
docker:
- image: killbill/kbbuild:0.2.0
- image: killbill/killbill:0.18.16
- image: killbill/mariadb:0.18
- image: killbill/kbbuild:0.7.0
- image: killbill/killbill:0.22.0
- image: killbill/mariadb:0.22
environment:
- MYSQL_ROOT_PASSWORD=root
steps:
- checkout
- restore_cache:
key: v4-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
- run:
name: Setup DDL
command: |
Expand Down Expand Up @@ -179,11 +179,11 @@ jobs:
build-ruby-2.4.2:
<<: *defaults
docker:
- image: killbill/kbbuild:0.2.0
- image: killbill/kbbuild:0.7.0
steps:
- checkout
- restore_cache:
key: v4-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
- run:
name: Install gem dependencies
command: |
Expand All @@ -196,20 +196,20 @@ jobs:
- kpm/Gemfile.lock
- kpm/.bundle
- kpm/vendor/bundle
key: v4-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}

test-mysql-ruby-2.4.2:
<<: *defaults
docker:
- image: killbill/kbbuild:0.2.0
- image: killbill/killbill:0.18.16
- image: killbill/mariadb:0.18
- image: killbill/kbbuild:0.7.0
- image: killbill/killbill:0.22.0
- image: killbill/mariadb:0.22
environment:
- MYSQL_ROOT_PASSWORD=root
steps:
- checkout
- restore_cache:
key: v4-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
- run:
name: Setup DDL
command: |
Expand Down Expand Up @@ -263,14 +263,36 @@ jobs:
path: /tmp/test-results
destination: test-results

test-rubocop:
<<: *defaults
docker:
- image: killbill/kbbuild:0.7.0
steps:
- checkout
- restore_cache:
key: v5-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
- run:
name: Run RuboCop
command: |
mkdir /tmp/test-results
cd kpm
source /usr/share/rvm/scripts/rvm
rvm use ruby-2.4.2
bundle exec rubocop --format tap | tee /tmp/test-results/rubocop.txt 2>&1
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
destination: test-results

build-jruby-9.1.14.0:
<<: *defaults
docker:
- image: killbill/kbbuild:0.2.0
- image: killbill/kbbuild:0.7.0
steps:
- checkout
- restore_cache:
key: v4-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
- run:
name: Install gem dependencies
command: |
Expand All @@ -283,20 +305,20 @@ jobs:
- kpm/Gemfile.lock
- kpm/.bundle
- kpm/vendor/bundle
key: v4-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}

test-mysql-jruby-9.1.14.0:
<<: *defaults
docker:
- image: killbill/kbbuild:0.2.0
- image: killbill/killbill:0.18.16
- image: killbill/mariadb:0.18
- image: killbill/kbbuild:0.7.0
- image: killbill/killbill:0.22.0
- image: killbill/mariadb:0.22
environment:
- MYSQL_ROOT_PASSWORD=root
steps:
- checkout
- restore_cache:
key: v4-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
key: v5-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "kpm/kpm.gemspec" }}
- run:
name: Setup DDL
command: |
Expand Down Expand Up @@ -378,6 +400,9 @@ workflows:
requires:
- build-ruby-2.4.2
- test-mysql-jruby-1.7.26
- test-rubocop:
requires:
- build-ruby-2.4.2
- test-mysql-jruby-9.1.14.0:
requires:
- build-jruby-9.1.14.0
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ logs/
ansible/*.retry
ansible/hosts
ansible-container/ansible-deployment
docker/templates/killbill/tagged/Dockerfile
docker/templates/killbill/tagged/kpm.yml
46 changes: 46 additions & 0 deletions ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The roles can now be referenced in your playbooks via `killbill-cloud/ansible/ro

See below for example playbooks.


# Usage

## killbill.yml playbook
Expand Down Expand Up @@ -58,6 +59,18 @@ Example playbook on how to install Tomcat (Java is a pre-requisite):
ansible-playbook -i <HOST_FILE> tomcat.yml
```

## migrations.yml playbook

Playbook to manage Kill Bill (and its plugins) database migrations.

Assuming Kill Bill is installed locally (`/var/lib/tomcat/webapps/ROOT.war` by default) and your `kpm.yml` (`/var/lib/killbill/kpm.yml` by default) points to the **new** version of Kill Bill:

```
ansible-playbook -i localhost, -e ansible_connection=local -e gh_token=XXX migrations.yml
```

This will install Flyway, fetch all migrations and prompt the user whether they should be applied.

## plugin.yml playbook

Allow to restart a specific plugin
Expand Down Expand Up @@ -107,3 +120,36 @@ ansible <HOST_GROUP> -i <HOST_FILE> -m killbill_facts -a 'killbill_web_path=/pat
```

Ansible requires the module file to start with `/usr/bin/ruby` to allow for shebang line substitution. If no Ruby interpreter is available at that path, you can configure it through `ansible_ruby_interpreter`, which is set per-host as an inventory variable associated with a host or group of hosts (e.g. `ansible_ruby_interpreter=/opt/kpm-0.5.2-linux-x86_64/lib/ruby/bin/ruby` in your host file).


# Testing Playbooks

In order to test, one can an inventory:

## Locally

```
# File localhost/inventory
[server]
127.0.0.1 ansible_user=sbrossier
```

```
> ansible-playbook -v -i localhost/inventory -e java_home=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home -u <user> the _playbook.yml
```

## EC2

```
# File ec2/inventory
[server]
ec2-18-233-67-208.compute-1.amazonaws.com ansible_user=ubuntu
```

```
> ansible-playbook -v -i ec2/inventory -e java_home=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home -u ubuntu the _playbook.yml
```




21 changes: 21 additions & 0 deletions ansible/diagnostic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: Gather diagnostics
hosts: all
tasks:
- name: setup Ruby
import_tasks: roles/common/tasks/main.yml
- name: setup KPM
import_tasks: roles/kpm/tasks/main.yml
- name: gather diagnostics
killbill_diagnostics:
kpm_path: "{{ kpm_path }}"
killbill_url: "{{ killbill_url|default('http://127.0.0.1:8080') }}"
killbill_web_path: "{{ catalina_base }}/{{ kb_webapps }}/ROOT.war"
killbill_user: "{{ killbill_user|default('admin') }}"
killbill_password: "{{ killbill_password|default('password') }}"
killbill_api_key: "{{ killbill_api_key|default('bob') }}"
killbill_api_secret: "{{ killbill_api_secret|default('lazar') }}"
killbill_account: "{{ killbill_account|default('') }}"
bundles_dir: "{{ kb_plugins_dir }}"
log_dir: "{{ catalina_base }}/logs"
tags: diagnostics
13 changes: 8 additions & 5 deletions ansible/flyway.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
- name: Flyway migrations
- name: Install Flyway
hosts: all
roles:
- common
- kpm
- migrations
tasks:
- name: setup Ruby
import_tasks: roles/common/tasks/main.yml
- name: setup KPM
import_tasks: roles/kpm/tasks/main.yml
- name: install Flyway
import_tasks: roles/migrations/tasks/flyway.yml
50 changes: 19 additions & 31 deletions ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,45 @@ nexus_url: https://oss.sonatype.org
nexus_repository: releases

kpm_install_dir: /opt
kpm_version: 0.6.5
kpm_version: 0.8.1
kpm_path: "{{ kpm_install_dir }}/kpm-{{ kpm_version }}-linux-{{ ansible_architecture }}"

catalina_home: /usr/share/tomcat
catalina_base: /opt/apache-tomcat
tomcat_owner: "{{ ansible_user_id }}"
tomcat_group: root
catalina_base: /var/lib/tomcat
tomcat_owner: tomcat
tomcat_group: tomcat

# Webapps directory : {{ catalina_base }}/{{ kb_webapps }}
kb_webapps: webapps
kaui_webapps: webapps

tomcat_foreground: false

# Base directory for namespacing
kb_install_dir: /opt/killbill
kb_install_dir: /var/lib/killbill
# Configuration files (killbill.properties, JRuby files, etc.)
kb_config_dir: "{{ kb_install_dir }}/config"
# Kill Bill plugins and OSGI bundles
kb_plugins_dir: "{{ kb_install_dir }}/bundles"
# kpm.yml -- see https://github.com/killbill/killbill-cloud/tree/master/kpm
kpm_yml:
killbill:
version: 0.18.10
webapp_path: "{{ catalina_base }}/webapps/ROOT.war"
nexus:
ssl_verify: false
url: "{{ nexus_url }}"
repository: "{{ nexus_repository }}"
plugins_dir: "{{ kb_plugins_dir }}"
plugins:
java:
- name: analytics
ruby:
- name: kpm

# Kaui specific properties
killbill_url: http://127.0.0.1:8080
killbill_api_key: bob
killbill_api_secret: lazar
kaui_db_adapter: mysql2
# kpm.yml file
kpm_yml: "{{ kb_install_dir }}/kpm.yml"

flyway_install_dir: /opt
flyway: java -jar {{ flyway_install_dir }}/killbill-flyway.jar -url='{{ lookup('env','KILLBILL_DAO_URL') }}' -user={{ lookup('env','KILLBILL_DAO_USER') }} -password={{ lookup('env','KILLBILL_DAO_PASSWORD') }}

# Extra JVM properties (e.g. -Dlogback.configurationFile={{ kb_config_dir }}/logback.xml)
kaui_system_properties: ''
kb_system_properties: ''

# Tomcat and JVM properties -- recommended defaults
jvm_initial_memory: 4G
jvm_max_memory: 4G
jvm_initial_memory: 512m
jvm_max_memory: 2G
jvm_jdwp_port: 12345
jvm_jdwp_server: y
jvm_cms_initiating_fraction_threshold: 50
jvm_new_size: 600m
jvm_max_new_size: 1900m
jvm_new_size: 256m
jvm_max_new_size: 1024m
jvm_survivor_ratio: 10
jvm_jmx_port: 8000
tomcat_port: 8080
tomcat_max_threads: 150
tomcat_max_threads: 100
12 changes: 12 additions & 0 deletions ansible/kaui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Deploy Kaui
hosts: all
vars:
kpm_yml: /var/lib/kaui/kpm.yml
tasks:
- name: setup Ruby
import_tasks: roles/common/tasks/main.yml
- name: setup Tomcat
import_tasks: roles/tomcat/tasks/main.yml
- name: install Kaui
import_tasks: roles/kaui/tasks/main.yml
Loading

0 comments on commit 3c1bd1d

Please sign in to comment.