From 5cc325e7db92ff465e397ef0d66364680d5eaf05 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Thu, 16 Apr 2026 13:51:29 +0530 Subject: [PATCH 01/25] * Added playbook tasks to install Stripe, Hyperswitch, email-notification, Aviate, Deposit, Analytics and Adyen plugins. * Also, added required DDLs and scripts to install schema. --- ansible/files/killbill/adyen_ddl.sql | 115 ++ ansible/files/killbill/analytics_ddl.sql | 1441 +++++++++++++++++ ansible/files/killbill/braintree_ddl.sql | 52 + ansible/files/killbill/deposit_ddl.sql | 52 + .../killbill/email-notifications_ddl.sql | 32 + ansible/files/killbill/hyperswitch_ddl.sql | 57 + ansible/files/killbill/stripe_ddl.sql | 67 + ansible/group_vars/all.yml | 3 + ansible/roles/killbill/tasks/plugins.yml | 25 + .../roles/killbill/tasks/plugins/aviate.yml | 36 + .../killbill/tasks/plugins/hyperswitch.yml | 77 + .../killbill/tasks/plugins/kpm_plugin.yml | 39 + ansible/roles/killbill/vars/kpm_plugins.yml | 7 + 13 files changed, 2003 insertions(+) create mode 100644 ansible/files/killbill/adyen_ddl.sql create mode 100644 ansible/files/killbill/analytics_ddl.sql create mode 100644 ansible/files/killbill/braintree_ddl.sql create mode 100644 ansible/files/killbill/deposit_ddl.sql create mode 100644 ansible/files/killbill/email-notifications_ddl.sql create mode 100644 ansible/files/killbill/hyperswitch_ddl.sql create mode 100644 ansible/files/killbill/stripe_ddl.sql create mode 100644 ansible/roles/killbill/tasks/plugins.yml create mode 100644 ansible/roles/killbill/tasks/plugins/aviate.yml create mode 100644 ansible/roles/killbill/tasks/plugins/hyperswitch.yml create mode 100644 ansible/roles/killbill/tasks/plugins/kpm_plugin.yml create mode 100644 ansible/roles/killbill/vars/kpm_plugins.yml diff --git a/ansible/files/killbill/adyen_ddl.sql b/ansible/files/killbill/adyen_ddl.sql new file mode 100644 index 00000000..6ef3d546 --- /dev/null +++ b/ansible/files/killbill/adyen_ddl.sql @@ -0,0 +1,115 @@ +/* + * Copyright 2020-2023 Equinix, Inc + * Copyright 2014-2023 The Billing Project, LLC + * + * The Billing Project licenses this file to you under the Apache License, version 2.0 + * (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/*! SET default_storage_engine=INNODB */; + +drop table if exists adyen_hpp_requests; +create table adyen_hpp_requests ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_id char(36) default null +, kb_payment_transaction_id char(36) default null +, transaction_external_key varchar(255) not null +, additional_data longtext default null +, created_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index adyen_hpp_requests_kb_account_id on adyen_hpp_requests(kb_account_id); +create index adyen_hpp_requests_kb_transaction_external_key on adyen_hpp_requests(transaction_external_key); +create index adyen_hpp_requests_kb_payment_transaction_id on adyen_hpp_requests(kb_payment_transaction_id); + +drop table if exists adyen_responses; +create table adyen_responses ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_id char(36) not null +, kb_payment_transaction_id char(36) not null +, transaction_type varchar(32) not null +, transaction_status varchar(32) not null +, amount numeric(15,9) +, currency char(3) +, session_id char(36) default null +, psp_result varchar(64) +, psp_reference varchar(64) +, auth_code varchar(64) +, result_code varchar(64) +, refusal_reason varchar(64) +, reference varchar(64) +, psp_error_codes varchar(64) +, payment_internal_ref varchar(64) +, form_url varchar(1024) +, dcc_amount numeric(15,9) +, dcc_currency char(3) +, dcc_signature varchar(64) +, issuer_url varchar(1024) +, md text +, pa_request text +, additional_data longtext default null +, created_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index adyen_responses_kb_payment_id on adyen_responses(kb_payment_id); +create index adyen_responses_kb_payment_transaction_id on adyen_responses(kb_payment_transaction_id); +create index psp_reference_idx on adyen_responses(psp_reference); + +drop table if exists adyen_notifications; +create table adyen_notifications ( + record_id serial +, kb_account_id char(36) +, kb_payment_id char(36) +, kb_payment_transaction_id char(36) +, transaction_type varchar(32) +, amount numeric(15,9) +, currency char(3) +, event_code varchar(64) +, event_date datetime +, merchant_account_code varchar(64) +, merchant_reference varchar(64) +, operations varchar(1024) +, original_reference varchar(64) +, payment_method varchar(64) +, psp_reference varchar(255) +, reason text +, success smallint not null default 0 +, additional_data longtext default null +, created_date datetime not null +, kb_tenant_id char(36) +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +-- Not unique to handle retries +create index adyen_notifications_psp_reference on adyen_notifications(psp_reference); +create index adyen_notifications_kb_payment_id on adyen_notifications(kb_payment_id); +create index adyen_notifications_kb_payment_transaction_id on adyen_notifications(kb_payment_transaction_id); + +drop table if exists adyen_payment_methods; +create table adyen_payment_methods ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_method_id char(36) not null +, is_recurring smallint not null default 0 +, is_default smallint not null default 0 +, is_deleted smallint not null default 0 +, recurring_detail_reference char(36) default null +, additional_data longtext default null +, created_date datetime not null +, updated_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create unique index adyen_payment_methods_kb_payment_id on adyen_payment_methods(kb_payment_method_id); \ No newline at end of file diff --git a/ansible/files/killbill/analytics_ddl.sql b/ansible/files/killbill/analytics_ddl.sql new file mode 100644 index 00000000..e616cdf6 --- /dev/null +++ b/ansible/files/killbill/analytics_ddl.sql @@ -0,0 +1,1441 @@ +/*! SET default_storage_engine=INNODB */; + +-- Subscription events +drop table if exists analytics_subscription_transitions; +create table analytics_subscription_transitions ( + record_id serial unique +, subscription_event_record_id bigint /*! unsigned */ default null +, bundle_id varchar(36) default null +, bundle_external_key varchar(255) default null +, subscription_id varchar(36) default null +, requested_timestamp date default null +, event varchar(50) default null +, prev_product_name varchar(255) default null +, prev_product_type varchar(50) default null +, prev_product_category varchar(50) default null +, prev_slug varchar(255) default null +, prev_phase varchar(255) default null +, prev_billing_period varchar(50) default null +, prev_price numeric(10, 4) default 0 +, converted_prev_price numeric(10, 4) default null +, prev_price_list varchar(50) default null +, prev_mrr numeric(10, 4) default 0 +, converted_prev_mrr numeric(10, 4) default null +, prev_currency varchar(50) default null +, prev_service varchar(50) default null +, prev_state varchar(50) default null +, prev_business_active bool default true +, prev_start_date date default null +, next_product_name varchar(255) default null +, next_product_type varchar(50) default null +, next_product_category varchar(50) default null +, next_slug varchar(255) default null +, next_phase varchar(255) default null +, next_billing_period varchar(50) default null +, next_price numeric(10, 4) default 0 +, converted_next_price numeric(10, 4) default null +, next_price_list varchar(50) default null +, next_mrr numeric(10, 4) default 0 +, converted_next_mrr numeric(10, 4) default null +, next_currency varchar(50) default null +, next_service varchar(50) default null +, next_state varchar(50) default null +, next_business_active bool default true +, next_start_date date default null +, next_end_date date default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_subscription_transitions_bundle_id on analytics_subscription_transitions(bundle_id); +create index analytics_subscription_transitions_bundle_external_key on analytics_subscription_transitions(bundle_external_key); +create index analytics_subscription_transitions_account_id on analytics_subscription_transitions(account_id); +create index analytics_subscription_transitions_account_record_id on analytics_subscription_transitions(account_record_id); +create index analytics_subscription_transitions_tenant_account_record_id on analytics_subscription_transitions(tenant_record_id, account_record_id); + +-- Bundle summary +drop table if exists analytics_bundles; +create table analytics_bundles ( + record_id serial unique +, bundle_record_id bigint /*! unsigned */ default null +, bundle_id varchar(36) default null +, bundle_external_key varchar(255) default null +, subscription_id varchar(36) default null +, bundle_account_rank int default null +, latest_for_bundle_external_key bool default false +, charged_through_date date default null +, current_product_name varchar(255) default null +, current_product_type varchar(50) default null +, current_product_category varchar(50) default null +, current_slug varchar(255) default null +, current_phase varchar(255) default null +, current_billing_period varchar(50) default null +, current_price numeric(10, 4) default 0 +, converted_current_price numeric(10, 4) default null +, current_price_list varchar(50) default null +, current_mrr numeric(10, 4) default 0 +, converted_current_mrr numeric(10, 4) default null +, current_currency varchar(50) default null +, current_service varchar(50) default null +, current_state varchar(50) default null +, current_business_active bool default true +, current_start_date date default null +, current_end_date date default null +, converted_currency varchar(3) default null +, original_created_date datetime default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_bundles_bundle_bundle_id on analytics_bundles(bundle_id); +create index analytics_bundles_bundle_external_key on analytics_bundles(bundle_external_key); +create index analytics_bundles_account_id on analytics_bundles(account_id); +create index analytics_bundles_account_record_id on analytics_bundles(account_record_id); +create index analytics_bundles_tenant_account_record_id on analytics_bundles(tenant_record_id, account_record_id); + +-- Accounts +drop table if exists analytics_accounts; +create table analytics_accounts ( + record_id serial unique +, email varchar(128) default null +, first_name_length int default null +, currency varchar(3) default null +, billing_cycle_day_local int default null +, payment_method_id varchar(36) default null +, time_zone varchar(50) default null +, locale varchar(5) default null +, address1 varchar(100) default null +, address2 varchar(100) default null +, company_name varchar(50) default null +, city varchar(50) default null +, state_or_province varchar(50) default null +, country varchar(50) default null +, postal_code varchar(16) default null +, phone varchar(25) default null +, migrated bool default false +, balance numeric(10, 4) default 0 +, converted_balance numeric(10, 4) default null +, oldest_unpaid_invoice_date date default null +, oldest_unpaid_invoice_balance numeric(10, 4) default null +, oldest_unpaid_invoice_currency varchar(3) default null +, converted_oldest_unpaid_invoice_balance numeric(10, 4) default null +, oldest_unpaid_invoice_id varchar(36) default null +, last_invoice_date date default null +, last_invoice_balance numeric(10, 4) default null +, last_invoice_currency varchar(3) default null +, converted_last_invoice_balance numeric(10, 4) default null +, last_invoice_id varchar(36) default null +, last_payment_date datetime default null +, last_payment_status varchar(255) default null +, nb_active_bundles int default 0 +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, updated_date datetime default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, parent_account_id varchar(36) default null +, parent_account_name varchar(100) default null +, parent_account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_accounts_account_external_key on analytics_accounts(account_external_key); +create index analytics_accounts_account_id on analytics_accounts(account_id); +create index analytics_accounts_account_record_id on analytics_accounts(account_record_id); +create index analytics_accounts_tenant_account_record_id on analytics_accounts(tenant_record_id, account_record_id); +create index analytics_accounts_created_date_tenant_record_id_report_group on analytics_accounts(created_date, tenant_record_id, report_group); + +drop table if exists analytics_account_transitions; +create table analytics_account_transitions ( + record_id serial unique +, blocking_state_record_id bigint /*! unsigned */ default null +, service varchar(50) default null +, state varchar(50) default null +, start_date date default null +, end_date date default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_account_transitions_account_id on analytics_account_transitions(account_id); +create index analytics_account_transitions_account_record_id on analytics_account_transitions(account_record_id); +create index analytics_account_transitions_tenant_account_record_id on analytics_account_transitions(tenant_record_id, account_record_id); +-- For sanity queries +create index analytics_account_transitions_blocking_state_record_id on analytics_account_transitions(blocking_state_record_id); + +-- Invoices +drop table if exists analytics_invoices; +create table analytics_invoices ( + record_id serial unique +, invoice_record_id bigint /*! unsigned */ default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_date date default null +, target_date date default null +, currency varchar(50) default null +, raw_balance numeric(10, 4) default 0 +, converted_raw_balance numeric(10, 4) default null +, balance numeric(10, 4) default 0 +, converted_balance numeric(10, 4) default null +, amount_paid numeric(10, 4) default 0 +, converted_amount_paid numeric(10, 4) default null +, amount_charged numeric(10, 4) default 0 +, converted_amount_charged numeric(10, 4) default null +, original_amount_charged numeric(10, 4) default 0 +, converted_original_amount_charged numeric(10, 4) default null +, amount_credited numeric(10, 4) default 0 +, converted_amount_credited numeric(10, 4) default null +, amount_refunded numeric(10, 4) default 0 +, converted_amount_refunded numeric(10, 4) default null +, converted_currency varchar(3) default null +, written_off bool default false +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_invoices_invoice_record_id on analytics_invoices(invoice_record_id); +create index analytics_invoices_invoice_id on analytics_invoices(invoice_id); +create index analytics_invoices_account_id on analytics_invoices(account_id); +create index analytics_invoices_account_record_id on analytics_invoices(account_record_id); +create index analytics_invoices_tenant_account_record_id on analytics_invoices(tenant_record_id, account_record_id); + +-- Invoice adjustments (type REFUND_ADJ) +drop table if exists analytics_invoice_adjustments; +create table analytics_invoice_adjustments ( + record_id serial unique +, invoice_item_record_id bigint /*! unsigned */ default null +, second_invoice_item_record_id bigint /*! unsigned */ default null +, item_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, raw_invoice_balance numeric(10, 4) default 0 +, converted_raw_invoice_balance numeric(10, 4) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_written_off bool default false +, item_type varchar(50) default null +, item_source varchar(50) not null +, bundle_id varchar(36) default null +, bundle_external_key varchar(255) default null +, product_name varchar(255) default null +, product_type varchar(50) default null +, product_category varchar(50) default null +, slug varchar(255) default null +, phase varchar(255) default null +, billing_period varchar(50) default null +, start_date date default null +, end_date date default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, linked_item_id varchar(36) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_invoice_adjustments_invoice_item_record_id on analytics_invoice_adjustments(invoice_item_record_id); +create index analytics_invoice_adjustments_item_id on analytics_invoice_adjustments(item_id); +create index analytics_invoice_adjustments_invoice_id on analytics_invoice_adjustments(invoice_id); +create index analytics_invoice_adjustments_account_id on analytics_invoice_adjustments(account_id); +create index analytics_invoice_adjustments_account_record_id on analytics_invoice_adjustments(account_record_id); +create index analytics_invoice_adjustments_tenant_account_record_id on analytics_invoice_adjustments(tenant_record_id, account_record_id); + +-- Invoice items (without adjustments, type EXTERNAL_CHARGE, FIXED, RECURRING, USAGE and TAX) +drop table if exists analytics_invoice_items; +create table analytics_invoice_items ( + record_id serial unique +, invoice_item_record_id bigint /*! unsigned */ default null +, second_invoice_item_record_id bigint /*! unsigned */ default null +, item_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, raw_invoice_balance numeric(10, 4) default 0 +, converted_raw_invoice_balance numeric(10, 4) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_written_off bool default false +, item_type varchar(50) default null +, item_source varchar(50) not null +, bundle_id varchar(36) default null +, bundle_external_key varchar(255) default null +, product_name varchar(255) default null +, product_type varchar(50) default null +, product_category varchar(50) default null +, slug varchar(255) default null +, usage_name varchar(255) default null +, phase varchar(255) default null +, billing_period varchar(50) default null +, start_date date default null +, end_date date default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, linked_item_id varchar(36) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_invoice_items_invoice_item_record_id on analytics_invoice_items(invoice_item_record_id); +create index analytics_invoice_items_item_id on analytics_invoice_items(item_id); +create index analytics_invoice_items_invoice_id on analytics_invoice_items(invoice_id); +create index analytics_invoice_items_account_id on analytics_invoice_items(account_id); +create index analytics_invoice_items_account_record_id on analytics_invoice_items(account_record_id); +create index analytics_invoice_items_tenant_account_record_id on analytics_invoice_items(tenant_record_id, account_record_id); + +-- Invoice items adjustments (type ITEM_ADJ) +drop table if exists analytics_invoice_item_adjustments; +create table analytics_invoice_item_adjustments ( + record_id serial unique +, invoice_item_record_id bigint /*! unsigned */ default null +, second_invoice_item_record_id bigint /*! unsigned */ default null +, item_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, raw_invoice_balance numeric(10, 4) default 0 +, converted_raw_invoice_balance numeric(10, 4) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_written_off bool default false +, item_type varchar(50) default null +, item_source varchar(50) not null +, bundle_id varchar(36) default null +, bundle_external_key varchar(255) default null +, product_name varchar(255) default null +, product_type varchar(50) default null +, product_category varchar(50) default null +, slug varchar(255) default null +, phase varchar(255) default null +, billing_period varchar(50) default null +, start_date date default null +, end_date date default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, linked_item_id varchar(36) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_invoice_item_adjustments_invoice_item_record_id on analytics_invoice_item_adjustments(invoice_item_record_id); +create index analytics_invoice_item_adjustments_item_id on analytics_invoice_item_adjustments(item_id); +create index analytics_invoice_item_adjustments_invoice_id on analytics_invoice_item_adjustments(invoice_id); +create index analytics_invoice_item_adjustments_account_id on analytics_invoice_item_adjustments(account_id); +create index analytics_invoice_item_adjustments_account_record_id on analytics_invoice_item_adjustments(account_record_id); +create index analytics_invoice_item_adjustments_tenant_account_record_id on analytics_invoice_item_adjustments(tenant_record_id, account_record_id); + +-- Account credits (type CBA_ADJ and CREDIT_ADJ) +drop table if exists analytics_invoice_credits; +create table analytics_invoice_credits ( + record_id serial unique +, invoice_item_record_id bigint /*! unsigned */ default null +, second_invoice_item_record_id bigint /*! unsigned */ default null +, item_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, raw_invoice_balance numeric(10, 4) default 0 +, converted_raw_invoice_balance numeric(10, 4) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_written_off bool default false +, item_type varchar(50) default null +, item_source varchar(50) not null +, bundle_id varchar(36) default null +, bundle_external_key varchar(255) default null +, product_name varchar(255) default null +, product_type varchar(50) default null +, product_category varchar(50) default null +, slug varchar(255) default null +, phase varchar(255) default null +, billing_period varchar(50) default null +, start_date date default null +, end_date date default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, linked_item_id varchar(36) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_invoice_credits_invoice_item_record_id on analytics_invoice_credits(invoice_item_record_id); +create index analytics_invoice_credits_item_id on analytics_invoice_credits(item_id); +create index analytics_invoice_credits_invoice_id on analytics_invoice_credits(invoice_id); +create index analytics_invoice_credits_account_id on analytics_invoice_credits(account_id); +create index analytics_invoice_credits_account_record_id on analytics_invoice_credits(account_record_id); +create index analytics_invoice_credits_tenant_account_record_id on analytics_invoice_credits(tenant_record_id, account_record_id); + +-- Payments + +drop table if exists analytics_payment_auths; +create table analytics_payment_auths ( + record_id serial unique +, invoice_payment_record_id bigint /*! unsigned */ default null +, invoice_payment_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_payment_type varchar(50) default null +, payment_id varchar(36) default null +, refund_id varchar(36) default null +, payment_number bigint default null +, payment_external_key varchar(255) default null +, payment_transaction_id varchar(36) default null +, payment_transaction_external_key varchar(255) default null +, payment_transaction_status varchar(255) default null +, linked_invoice_payment_id varchar(36) default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, plugin_name varchar(255) default null +, payment_method_id varchar(36) default null +, payment_method_external_key varchar(255) default null +, plugin_created_date datetime default null +, plugin_effective_date datetime default null +, plugin_status varchar(255) default null +, plugin_gateway_error text default null +, plugin_gateway_error_code varchar(255) default null +, plugin_first_reference_id varchar(255) default null +, plugin_second_reference_id varchar(255) default null +, plugin_property_1 varchar(255) default null +, plugin_property_2 varchar(255) default null +, plugin_property_3 varchar(255) default null +, plugin_property_4 varchar(255) default null +, plugin_property_5 varchar(255) default null +, plugin_pm_id varchar(255) default null +, plugin_pm_is_default bool default null +, plugin_pm_type varchar(255) default null +, plugin_pm_cc_name varchar(255) default null +, plugin_pm_cc_type varchar(255) default null +, plugin_pm_cc_expiration_month varchar(255) default null +, plugin_pm_cc_expiration_year varchar(255) default null +, plugin_pm_cc_last_4 varchar(255) default null +, plugin_pm_address1 varchar(255) default null +, plugin_pm_address2 varchar(255) default null +, plugin_pm_city varchar(255) default null +, plugin_pm_state varchar(255) default null +, plugin_pm_zip varchar(255) default null +, plugin_pm_country varchar(255) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_payment_auths_created_date on analytics_payment_auths(created_date); +create index analytics_payment_auths_date_trid_plugin_name on analytics_payment_auths(created_date, tenant_record_id, plugin_name); +create index analytics_payment_auths_invoice_payment_record_id on analytics_payment_auths(invoice_payment_record_id); +create index analytics_payment_auths_invoice_payment_id on analytics_payment_auths(invoice_payment_id); +create index analytics_payment_auths_invoice_id on analytics_payment_auths(invoice_id); +create index analytics_payment_auths_account_id on analytics_payment_auths(account_id); +create index analytics_payment_auths_account_record_id on analytics_payment_auths(account_record_id); +create index analytics_payment_auths_tenant_account_record_id on analytics_payment_auths(tenant_record_id, account_record_id); +create index analytics_payment_auths_cdate_trid_crcy_status_rgroup_camount on analytics_payment_auths(created_date, tenant_record_id, currency, payment_transaction_status, report_group, converted_amount); +create index ap_auths_cdate_trid_crcy_status_rgroup_camount_pname_perror on analytics_payment_auths(created_date, tenant_record_id, currency, payment_transaction_status, report_group, plugin_name /*! , plugin_gateway_error(80) */); + +drop table if exists analytics_payment_captures; +create table analytics_payment_captures ( + record_id serial unique +, invoice_payment_record_id bigint /*! unsigned */ default null +, invoice_payment_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_payment_type varchar(50) default null +, payment_id varchar(36) default null +, refund_id varchar(36) default null +, payment_number bigint default null +, payment_external_key varchar(255) default null +, payment_transaction_id varchar(36) default null +, payment_transaction_external_key varchar(255) default null +, payment_transaction_status varchar(255) default null +, linked_invoice_payment_id varchar(36) default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, plugin_name varchar(255) default null +, payment_method_id varchar(36) default null +, payment_method_external_key varchar(255) default null +, plugin_created_date datetime default null +, plugin_effective_date datetime default null +, plugin_status varchar(255) default null +, plugin_gateway_error text default null +, plugin_gateway_error_code varchar(255) default null +, plugin_first_reference_id varchar(255) default null +, plugin_second_reference_id varchar(255) default null +, plugin_property_1 varchar(255) default null +, plugin_property_2 varchar(255) default null +, plugin_property_3 varchar(255) default null +, plugin_property_4 varchar(255) default null +, plugin_property_5 varchar(255) default null +, plugin_pm_id varchar(255) default null +, plugin_pm_is_default bool default null +, plugin_pm_type varchar(255) default null +, plugin_pm_cc_name varchar(255) default null +, plugin_pm_cc_type varchar(255) default null +, plugin_pm_cc_expiration_month varchar(255) default null +, plugin_pm_cc_expiration_year varchar(255) default null +, plugin_pm_cc_last_4 varchar(255) default null +, plugin_pm_address1 varchar(255) default null +, plugin_pm_address2 varchar(255) default null +, plugin_pm_city varchar(255) default null +, plugin_pm_state varchar(255) default null +, plugin_pm_zip varchar(255) default null +, plugin_pm_country varchar(255) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_payment_captures_created_date on analytics_payment_captures(created_date); +create index analytics_payment_captures_date_trid_plugin_name on analytics_payment_captures(created_date, tenant_record_id, plugin_name); +create index analytics_payment_captures_invoice_payment_record_id on analytics_payment_captures(invoice_payment_record_id); +create index analytics_payment_captures_invoice_payment_id on analytics_payment_captures(invoice_payment_id); +create index analytics_payment_captures_invoice_id on analytics_payment_captures(invoice_id); +create index analytics_payment_captures_account_id on analytics_payment_captures(account_id); +create index analytics_payment_captures_account_record_id on analytics_payment_captures(account_record_id); +create index analytics_payment_captures_tenant_account_record_id on analytics_payment_captures(tenant_record_id, account_record_id); +create index analytics_payment_captures_cdate_trid_crcy_status_rgroup_camount on analytics_payment_captures(created_date, tenant_record_id, currency, payment_transaction_status, report_group, converted_amount); +create index ap_captures_cdate_trid_crcy_status_rgroup_camount_pname_perror on analytics_payment_captures(created_date, tenant_record_id, currency, payment_transaction_status, report_group, plugin_name /*! , plugin_gateway_error(80) */); + +drop table if exists analytics_payment_purchases; +create table analytics_payment_purchases ( + record_id serial unique +, invoice_payment_record_id bigint /*! unsigned */ default null +, invoice_payment_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_payment_type varchar(50) default null +, payment_id varchar(36) default null +, refund_id varchar(36) default null +, payment_number bigint default null +, payment_external_key varchar(255) default null +, payment_transaction_id varchar(36) default null +, payment_transaction_external_key varchar(255) default null +, payment_transaction_status varchar(255) default null +, linked_invoice_payment_id varchar(36) default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, plugin_name varchar(255) default null +, payment_method_id varchar(36) default null +, payment_method_external_key varchar(255) default null +, plugin_created_date datetime default null +, plugin_effective_date datetime default null +, plugin_status varchar(255) default null +, plugin_gateway_error text default null +, plugin_gateway_error_code varchar(255) default null +, plugin_first_reference_id varchar(255) default null +, plugin_second_reference_id varchar(255) default null +, plugin_property_1 varchar(255) default null +, plugin_property_2 varchar(255) default null +, plugin_property_3 varchar(255) default null +, plugin_property_4 varchar(255) default null +, plugin_property_5 varchar(255) default null +, plugin_pm_id varchar(255) default null +, plugin_pm_is_default bool default null +, plugin_pm_type varchar(255) default null +, plugin_pm_cc_name varchar(255) default null +, plugin_pm_cc_type varchar(255) default null +, plugin_pm_cc_expiration_month varchar(255) default null +, plugin_pm_cc_expiration_year varchar(255) default null +, plugin_pm_cc_last_4 varchar(255) default null +, plugin_pm_address1 varchar(255) default null +, plugin_pm_address2 varchar(255) default null +, plugin_pm_city varchar(255) default null +, plugin_pm_state varchar(255) default null +, plugin_pm_zip varchar(255) default null +, plugin_pm_country varchar(255) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_payment_purchases_created_date on analytics_payment_purchases(created_date); +create index analytics_payment_purchases_date_trid_plugin_name on analytics_payment_purchases(created_date, tenant_record_id, plugin_name); +create index analytics_payment_purchases_invoice_payment_record_id on analytics_payment_purchases(invoice_payment_record_id); +create index analytics_payment_purchases_invoice_payment_id on analytics_payment_purchases(invoice_payment_id); +create index analytics_payment_purchases_invoice_id on analytics_payment_purchases(invoice_id); +create index analytics_payment_purchases_account_id on analytics_payment_purchases(account_id); +create index analytics_payment_purchases_account_record_id on analytics_payment_purchases(account_record_id); +create index analytics_payment_purchases_tenant_account_record_id on analytics_payment_purchases(tenant_record_id, account_record_id); +create index analytics_payment_prchses_cdate_trid_crcy_status_rgroup_camount on analytics_payment_purchases(created_date, tenant_record_id, currency, payment_transaction_status, report_group, converted_amount); +create index ap_prchses_cdate_trid_crcy_status_rgroup_camount_pname_perror on analytics_payment_purchases(created_date, tenant_record_id, currency, payment_transaction_status, report_group, plugin_name /*! , plugin_gateway_error(80) */); + +drop table if exists analytics_payment_refunds; +create table analytics_payment_refunds ( + record_id serial unique +, invoice_payment_record_id bigint /*! unsigned */ default null +, invoice_payment_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_payment_type varchar(50) default null +, payment_id varchar(36) default null +, refund_id varchar(36) default null +, payment_number bigint default null +, payment_external_key varchar(255) default null +, payment_transaction_id varchar(36) default null +, payment_transaction_external_key varchar(255) default null +, payment_transaction_status varchar(255) default null +, linked_invoice_payment_id varchar(36) default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, plugin_name varchar(255) default null +, payment_method_id varchar(36) default null +, payment_method_external_key varchar(255) default null +, plugin_created_date datetime default null +, plugin_effective_date datetime default null +, plugin_status varchar(255) default null +, plugin_gateway_error text default null +, plugin_gateway_error_code varchar(255) default null +, plugin_first_reference_id varchar(255) default null +, plugin_second_reference_id varchar(255) default null +, plugin_property_1 varchar(255) default null +, plugin_property_2 varchar(255) default null +, plugin_property_3 varchar(255) default null +, plugin_property_4 varchar(255) default null +, plugin_property_5 varchar(255) default null +, plugin_pm_id varchar(255) default null +, plugin_pm_is_default bool default null +, plugin_pm_type varchar(255) default null +, plugin_pm_cc_name varchar(255) default null +, plugin_pm_cc_type varchar(255) default null +, plugin_pm_cc_expiration_month varchar(255) default null +, plugin_pm_cc_expiration_year varchar(255) default null +, plugin_pm_cc_last_4 varchar(255) default null +, plugin_pm_address1 varchar(255) default null +, plugin_pm_address2 varchar(255) default null +, plugin_pm_city varchar(255) default null +, plugin_pm_state varchar(255) default null +, plugin_pm_zip varchar(255) default null +, plugin_pm_country varchar(255) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_payment_refunds_created_date on analytics_payment_refunds(created_date); +create index analytics_payment_refunds_date_trid_plugin_name on analytics_payment_refunds(created_date, tenant_record_id, plugin_name); +create index analytics_payment_refunds_invoice_payment_record_id on analytics_payment_refunds(invoice_payment_record_id); +create index analytics_payment_refunds_invoice_payment_id on analytics_payment_refunds(invoice_payment_id); +create index analytics_payment_refunds_invoice_id on analytics_payment_refunds(invoice_id); +create index analytics_payment_refunds_account_id on analytics_payment_refunds(account_id); +create index analytics_payment_refunds_account_record_id on analytics_payment_refunds(account_record_id); +create index analytics_payment_refunds_tenant_account_record_id on analytics_payment_refunds(tenant_record_id, account_record_id); +create index analytics_payment_refunds_cdate_trid_crcy_status_rgroup_camount on analytics_payment_refunds(created_date, tenant_record_id, currency, payment_transaction_status, report_group, converted_amount); +create index ap_refunds_cdate_trid_crcy_status_rgroup_camount_pname_perror on analytics_payment_refunds(created_date, tenant_record_id, currency, payment_transaction_status, report_group, plugin_name /*! , plugin_gateway_error(80) */); + +drop table if exists analytics_payment_credits; +create table analytics_payment_credits ( + record_id serial unique +, invoice_payment_record_id bigint /*! unsigned */ default null +, invoice_payment_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_payment_type varchar(50) default null +, payment_id varchar(36) default null +, refund_id varchar(36) default null +, payment_number bigint default null +, payment_external_key varchar(255) default null +, payment_transaction_id varchar(36) default null +, payment_transaction_external_key varchar(255) default null +, payment_transaction_status varchar(255) default null +, linked_invoice_payment_id varchar(36) default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, plugin_name varchar(255) default null +, payment_method_id varchar(36) default null +, payment_method_external_key varchar(255) default null +, plugin_created_date datetime default null +, plugin_effective_date datetime default null +, plugin_status varchar(255) default null +, plugin_gateway_error text default null +, plugin_gateway_error_code varchar(255) default null +, plugin_first_reference_id varchar(255) default null +, plugin_second_reference_id varchar(255) default null +, plugin_property_1 varchar(255) default null +, plugin_property_2 varchar(255) default null +, plugin_property_3 varchar(255) default null +, plugin_property_4 varchar(255) default null +, plugin_property_5 varchar(255) default null +, plugin_pm_id varchar(255) default null +, plugin_pm_is_default bool default null +, plugin_pm_type varchar(255) default null +, plugin_pm_cc_name varchar(255) default null +, plugin_pm_cc_type varchar(255) default null +, plugin_pm_cc_expiration_month varchar(255) default null +, plugin_pm_cc_expiration_year varchar(255) default null +, plugin_pm_cc_last_4 varchar(255) default null +, plugin_pm_address1 varchar(255) default null +, plugin_pm_address2 varchar(255) default null +, plugin_pm_city varchar(255) default null +, plugin_pm_state varchar(255) default null +, plugin_pm_zip varchar(255) default null +, plugin_pm_country varchar(255) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_payment_credits_created_date on analytics_payment_credits(created_date); +create index analytics_payment_credits_date_trid_plugin_name on analytics_payment_credits(created_date, tenant_record_id, plugin_name); +create index analytics_payment_credits_invoice_payment_record_id on analytics_payment_credits(invoice_payment_record_id); +create index analytics_payment_credits_invoice_payment_id on analytics_payment_credits(invoice_payment_id); +create index analytics_payment_credits_invoice_id on analytics_payment_credits(invoice_id); +create index analytics_payment_credits_account_id on analytics_payment_credits(account_id); +create index analytics_payment_credits_account_record_id on analytics_payment_credits(account_record_id); +create index analytics_payment_credits_tenant_account_record_id on analytics_payment_credits(tenant_record_id, account_record_id); +create index analytics_payment_credits_cdate_trid_crcy_status_rgroup_camount on analytics_payment_credits(created_date, tenant_record_id, currency, payment_transaction_status, report_group, converted_amount); +create index ap_credits_cdate_trid_crcy_status_rgroup_camount_pname_perror on analytics_payment_credits(created_date, tenant_record_id, currency, payment_transaction_status, report_group, plugin_name /*! , plugin_gateway_error(80) */); + +drop table if exists analytics_payment_chargebacks; +create table analytics_payment_chargebacks ( + record_id serial unique +, invoice_payment_record_id bigint /*! unsigned */ default null +, invoice_payment_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_payment_type varchar(50) default null +, payment_id varchar(36) default null +, refund_id varchar(36) default null +, payment_number bigint default null +, payment_external_key varchar(255) default null +, payment_transaction_id varchar(36) default null +, payment_transaction_external_key varchar(255) default null +, payment_transaction_status varchar(255) default null +, linked_invoice_payment_id varchar(36) default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, plugin_name varchar(255) default null +, payment_method_id varchar(36) default null +, payment_method_external_key varchar(255) default null +, plugin_created_date datetime default null +, plugin_effective_date datetime default null +, plugin_status varchar(255) default null +, plugin_gateway_error text default null +, plugin_gateway_error_code varchar(255) default null +, plugin_first_reference_id varchar(255) default null +, plugin_second_reference_id varchar(255) default null +, plugin_property_1 varchar(255) default null +, plugin_property_2 varchar(255) default null +, plugin_property_3 varchar(255) default null +, plugin_property_4 varchar(255) default null +, plugin_property_5 varchar(255) default null +, plugin_pm_id varchar(255) default null +, plugin_pm_is_default bool default null +, plugin_pm_type varchar(255) default null +, plugin_pm_cc_name varchar(255) default null +, plugin_pm_cc_type varchar(255) default null +, plugin_pm_cc_expiration_month varchar(255) default null +, plugin_pm_cc_expiration_year varchar(255) default null +, plugin_pm_cc_last_4 varchar(255) default null +, plugin_pm_address1 varchar(255) default null +, plugin_pm_address2 varchar(255) default null +, plugin_pm_city varchar(255) default null +, plugin_pm_state varchar(255) default null +, plugin_pm_zip varchar(255) default null +, plugin_pm_country varchar(255) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_payment_chargebacks_created_date on analytics_payment_chargebacks(created_date); +create index analytics_payment_chargebacks_date_trid_plugin_name on analytics_payment_chargebacks(created_date, tenant_record_id, plugin_name); +create index analytics_payment_chargebacks_invoice_payment_record_id on analytics_payment_chargebacks(invoice_payment_record_id); +create index analytics_payment_chargebacks_invoice_payment_id on analytics_payment_chargebacks(invoice_payment_id); +create index analytics_payment_chargebacks_invoice_id on analytics_payment_chargebacks(invoice_id); +create index analytics_payment_chargebacks_account_id on analytics_payment_chargebacks(account_id); +create index analytics_payment_chargebacks_account_record_id on analytics_payment_chargebacks(account_record_id); +create index analytics_payment_chargebacks_tenant_account_record_id on analytics_payment_chargebacks(tenant_record_id, account_record_id); +create index analytics_payment_cbacks_cdate_trid_crcy_status_rgroup_camount on analytics_payment_chargebacks(created_date, tenant_record_id, currency, payment_transaction_status, report_group, converted_amount); +create index ap_cbacks_cdate_trid_crcy_status_rgroup_camount_pname_perror on analytics_payment_chargebacks(created_date, tenant_record_id, currency, payment_transaction_status, report_group, plugin_name /*! , plugin_gateway_error(80) */); + +drop table if exists analytics_payment_voids; +create table analytics_payment_voids ( + record_id serial unique +, invoice_payment_record_id bigint /*! unsigned */ default null +, invoice_payment_id varchar(36) default null +, invoice_id varchar(36) default null +, invoice_number bigint default null +, invoice_created_date datetime default null +, invoice_date date default null +, invoice_target_date date default null +, invoice_currency varchar(50) default null +, invoice_balance numeric(10, 4) default 0 +, converted_invoice_balance numeric(10, 4) default null +, invoice_amount_paid numeric(10, 4) default 0 +, converted_invoice_amount_paid numeric(10, 4) default null +, invoice_amount_charged numeric(10, 4) default 0 +, converted_invoice_amount_charged numeric(10, 4) default null +, invoice_original_amount_charged numeric(10, 4) default 0 +, converted_invoice_original_amount_charged numeric(10, 4) default null +, invoice_amount_credited numeric(10, 4) default 0 +, converted_invoice_amount_credited numeric(10, 4) default null +, invoice_amount_refunded numeric(10, 4) default 0 +, converted_invoice_amount_refunded numeric(10, 4) default null +, invoice_payment_type varchar(50) default null +, payment_id varchar(36) default null +, refund_id varchar(36) default null +, payment_number bigint default null +, payment_external_key varchar(255) default null +, payment_transaction_id varchar(36) default null +, payment_transaction_external_key varchar(255) default null +, payment_transaction_status varchar(255) default null +, linked_invoice_payment_id varchar(36) default null +, amount numeric(10, 4) default 0 +, converted_amount numeric(10, 4) default null +, currency varchar(50) default null +, plugin_name varchar(255) default null +, payment_method_id varchar(36) default null +, payment_method_external_key varchar(255) default null +, plugin_created_date datetime default null +, plugin_effective_date datetime default null +, plugin_status varchar(255) default null +, plugin_gateway_error text default null +, plugin_gateway_error_code varchar(255) default null +, plugin_first_reference_id varchar(255) default null +, plugin_second_reference_id varchar(255) default null +, plugin_property_1 varchar(255) default null +, plugin_property_2 varchar(255) default null +, plugin_property_3 varchar(255) default null +, plugin_property_4 varchar(255) default null +, plugin_property_5 varchar(255) default null +, plugin_pm_id varchar(255) default null +, plugin_pm_is_default bool default null +, plugin_pm_type varchar(255) default null +, plugin_pm_cc_name varchar(255) default null +, plugin_pm_cc_type varchar(255) default null +, plugin_pm_cc_expiration_month varchar(255) default null +, plugin_pm_cc_expiration_year varchar(255) default null +, plugin_pm_cc_last_4 varchar(255) default null +, plugin_pm_address1 varchar(255) default null +, plugin_pm_address2 varchar(255) default null +, plugin_pm_city varchar(255) default null +, plugin_pm_state varchar(255) default null +, plugin_pm_zip varchar(255) default null +, plugin_pm_country varchar(255) default null +, converted_currency varchar(3) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_payment_voids_created_date on analytics_payment_voids(created_date); +create index analytics_payment_voids_date_trid_plugin_name on analytics_payment_voids(created_date, tenant_record_id, plugin_name); +create index analytics_payment_voids_invoice_payment_record_id on analytics_payment_voids(invoice_payment_record_id); +create index analytics_payment_voids_invoice_payment_id on analytics_payment_voids(invoice_payment_id); +create index analytics_payment_voids_invoice_id on analytics_payment_voids(invoice_id); +create index analytics_payment_voids_account_id on analytics_payment_voids(account_id); +create index analytics_payment_voids_account_record_id on analytics_payment_voids(account_record_id); +create index analytics_payment_voids_tenant_account_record_id on analytics_payment_voids(tenant_record_id, account_record_id); +create index analytics_payment_voids_cdate_trid_crcy_status_rgroup_camount on analytics_payment_voids(created_date, tenant_record_id, currency, payment_transaction_status, report_group, converted_amount); +create index ap_voids_cdate_trid_crcy_status_rgroup_camount_pname_perror on analytics_payment_voids(created_date, tenant_record_id, currency, payment_transaction_status, report_group, plugin_name /*! , plugin_gateway_error(80) */); + +-- Tags + +drop table if exists analytics_account_tags; +create table analytics_account_tags ( + record_id serial unique +, tag_record_id bigint /*! unsigned */ default null +, name varchar(50) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_account_tags_account_id on analytics_account_tags(account_id); +create index analytics_account_tags_account_record_id on analytics_account_tags(account_record_id); +create index analytics_account_tags_tenant_account_record_id on analytics_account_tags(tenant_record_id, account_record_id); + +drop table if exists analytics_bundle_tags; +create table analytics_bundle_tags ( + record_id serial unique +, tag_record_id bigint /*! unsigned */ default null +, bundle_id varchar(36) default null +, bundle_external_key varchar(255) default null +, name varchar(50) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_bundle_tags_account_id on analytics_bundle_tags(account_id); +create index analytics_bundle_tags_bundle_id on analytics_bundle_tags(bundle_id); +create index analytics_bundle_tags_bundle_external_key on analytics_bundle_tags(bundle_external_key); +create index analytics_bundle_tags_account_record_id on analytics_bundle_tags(account_record_id); +create index analytics_bundle_tags_tenant_account_record_id on analytics_bundle_tags(tenant_record_id, account_record_id); + +drop table if exists analytics_invoice_tags; +create table analytics_invoice_tags ( + record_id serial unique +, tag_record_id bigint /*! unsigned */ default null +, invoice_id varchar(36) default null +, name varchar(50) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_invoice_tags_account_id on analytics_invoice_tags(account_id); +create index analytics_invoice_tags_account_record_id on analytics_invoice_tags(account_record_id); +create index analytics_invoice_tags_tenant_account_record_id on analytics_invoice_tags(tenant_record_id, account_record_id); + +drop table if exists analytics_payment_tags; +create table analytics_payment_tags ( + record_id serial unique +, tag_record_id bigint /*! unsigned */ default null +, invoice_payment_id varchar(36) default null +, name varchar(50) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_payment_tags_account_id on analytics_payment_tags(account_id); +create index analytics_payment_tags_account_record_id on analytics_payment_tags(account_record_id); +create index analytics_payment_tags_tenant_account_record_id on analytics_payment_tags(tenant_record_id, account_record_id); + +drop table if exists analytics_account_fields; +create table analytics_account_fields ( + record_id serial unique +, custom_field_record_id bigint /*! unsigned */ default null +, name varchar(64) default null +, field_value varchar(255) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_account_fields_account_id on analytics_account_fields(account_id); +create index analytics_account_fields_account_record_id on analytics_account_fields(account_record_id); +create index analytics_account_fields_tenant_account_record_id on analytics_account_fields(tenant_record_id, account_record_id); + +drop table if exists analytics_bundle_fields; +create table analytics_bundle_fields ( + record_id serial unique +, custom_field_record_id bigint /*! unsigned */ default null +, bundle_id varchar(36) default null +, bundle_external_key varchar(255) default null +, name varchar(64) default null +, field_value varchar(255) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_bundle_fields_account_id on analytics_bundle_fields(account_id); +create index analytics_bundle_fields_bundle_id on analytics_bundle_fields(bundle_id); +create index analytics_bundle_fields_bundle_external_key on analytics_bundle_fields(bundle_external_key); +create index analytics_bundle_fields_account_record_id on analytics_bundle_fields(account_record_id); +create index analytics_bundle_fields_tenant_account_record_id on analytics_bundle_fields(tenant_record_id, account_record_id); + +drop table if exists analytics_invoice_fields; +create table analytics_invoice_fields ( + record_id serial unique +, custom_field_record_id bigint /*! unsigned */ default null +, invoice_id varchar(36) default null +, name varchar(64) default null +, field_value varchar(255) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_invoice_fields_account_id on analytics_invoice_fields(account_id); +create index analytics_invoice_fields_account_record_id on analytics_invoice_fields(account_record_id); +create index analytics_invoice_fields_tenant_account_record_id on analytics_invoice_fields(tenant_record_id, account_record_id); + +drop table if exists analytics_invoice_payment_fields; +create table analytics_invoice_payment_fields ( + record_id serial unique +, custom_field_record_id bigint /*! unsigned */ default null +, invoice_payment_id varchar(36) default null +, name varchar(64) default null +, field_value varchar(255) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_invoice_payment_fields_account_id on analytics_invoice_payment_fields(account_id); +create index analytics_invoice_payment_fields_account_record_id on analytics_invoice_payment_fields(account_record_id); +create index analytics_invoice_payment_fields_tenant_account_record_id on analytics_invoice_payment_fields(tenant_record_id, account_record_id); + +drop table if exists analytics_payment_fields; +create table analytics_payment_fields ( + record_id serial unique +, custom_field_record_id bigint /*! unsigned */ default null +, payment_id varchar(36) default null +, name varchar(64) default null +, field_value varchar(255) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_payment_fields_account_id on analytics_payment_fields(account_id); +create index analytics_payment_fields_account_record_id on analytics_payment_fields(account_record_id); +create index analytics_payment_fields_tenant_account_record_id on analytics_payment_fields(tenant_record_id, account_record_id); + +drop table if exists analytics_payment_method_fields; +create table analytics_payment_method_fields ( + record_id serial unique +, custom_field_record_id bigint /*! unsigned */ default null +, payment_method_id varchar(36) default null +, name varchar(64) default null +, field_value varchar(255) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_payment_method_fields_account_id on analytics_payment_method_fields(account_id); +create index analytics_payment_method_fields_account_record_id on analytics_payment_method_fields(account_record_id); +create index analytics_payment_method_fields_tenant_account_record_id on analytics_payment_method_fields(tenant_record_id, account_record_id); + +drop table if exists analytics_transaction_fields; +create table analytics_transaction_fields ( + record_id serial unique +, custom_field_record_id bigint /*! unsigned */ default null +, transaction_id varchar(36) default null +, name varchar(64) default null +, field_value varchar(255) default null +, created_date datetime default null +, created_by varchar(50) default null +, created_reason_code varchar(255) default null +, created_comments varchar(255) default null +, account_id varchar(36) default null +, account_name varchar(100) default null +, account_external_key varchar(255) default null +, account_record_id bigint /*! unsigned */ default null +, tenant_record_id bigint /*! unsigned */ default null +, report_group varchar(50) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_transaction_fields_account_id on analytics_transaction_fields(account_id); +create index analytics_transaction_fields_account_record_id on analytics_transaction_fields(account_record_id); +create index analytics_transaction_fields_tenant_account_record_id on analytics_transaction_fields(tenant_record_id, account_record_id); + +drop table if exists analytics_notifications; +create table analytics_notifications ( + record_id serial unique +, class_name varchar(256) not null +, event_json varchar(2048) not null +, user_token varchar(36) +, created_date datetime not null +, creating_owner varchar(50) not null +, processing_owner varchar(50) default null +, processing_available_date datetime default null +, processing_state varchar(14) default 'AVAILABLE' +, error_count int /*! unsigned */ DEFAULT 0 +, search_key1 int /*! unsigned */ default null +, search_key2 int /*! unsigned */ default null +, queue_name varchar(64) not null +, effective_date datetime not null +, future_user_token varchar(36) +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_notifications_comp_where on analytics_notifications(effective_date, processing_state, processing_owner, processing_available_date); +create index analytics_notifications_update on analytics_notifications(processing_state,processing_owner,processing_available_date); +create index analytics_notifications_get_ready on analytics_notifications(effective_date,created_date); +create index analytics_notifications_search_keys on analytics_notifications(search_key2, search_key1); + +drop table if exists analytics_notifications_history; +create table analytics_notifications_history ( + record_id serial unique +, class_name varchar(256) not null +, event_json varchar(2048) not null +, user_token varchar(36) +, created_date datetime not null +, creating_owner varchar(50) not null +, processing_owner varchar(50) default null +, processing_available_date datetime default null +, processing_state varchar(14) default 'AVAILABLE' +, error_count int /*! unsigned */ DEFAULT 0 +, search_key1 int /*! unsigned */ default null +, search_key2 int /*! unsigned */ default null +, queue_name varchar(64) not null +, effective_date datetime not null +, future_user_token varchar(36) +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; + +drop table if exists analytics_currency_conversion; +create table analytics_currency_conversion ( + record_id serial unique +, currency varchar(3) not null +, start_date date not null +, end_date date not null +, reference_rate decimal(10, 4) not null +, reference_currency varchar(3) default 'USD' +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index analytics_currency_conversion_dates_currencies on analytics_currency_conversion(start_date, end_date, currency, reference_currency); + +drop table if exists analytics_reports; +create table analytics_reports ( + record_id serial unique +, report_name varchar(100) not null +, report_pretty_name varchar(256) default null +, report_type varchar(24) not null default 'TIMELINE' +, source_table_name varchar(256) default null +, source_name varchar(256) default null +, source_query varchar(4096) default null +, refresh_procedure_name varchar(256) default null +, refresh_frequency varchar(50) default null +, refresh_hour_of_day_gmt smallint default null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create unique index analytics_reports_report_name on analytics_reports(report_name); diff --git a/ansible/files/killbill/braintree_ddl.sql b/ansible/files/killbill/braintree_ddl.sql new file mode 100644 index 00000000..53e2fea1 --- /dev/null +++ b/ansible/files/killbill/braintree_ddl.sql @@ -0,0 +1,52 @@ +/* + * Copyright 2020-2020 Equinix, Inc + * Copyright 2014-2020 The Billing Project, LLC + * + * The Billing Project licenses this file to you under the Apache License, version 2.0 + * (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/*! SET default_storage_engine=INNODB */; + +create table braintree_responses ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_id char(36) not null +, kb_payment_transaction_id char(36) not null +, transaction_type varchar(32) not null +, amount numeric(15,9) +, currency char(3) +, braintree_id varchar(255) not null +, additional_data longtext default null +, created_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index braintree_responses_kb_payment_id on braintree_responses(kb_payment_id); +create index braintree_responses_kb_payment_transaction_id on braintree_responses(kb_payment_transaction_id); +create index braintree_responses_braintree_id on braintree_responses(braintree_id); + +create table braintree_payment_methods ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_method_id char(36) not null +, braintree_id varchar(255) not null +, is_default smallint not null default 0 +, is_deleted smallint not null default 0 +, additional_data longtext default null +, created_date datetime not null +, updated_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create unique index braintree_payment_methods_kb_payment_id on braintree_payment_methods(kb_payment_method_id); +create index braintree_payment_methods_braintree_id on braintree_payment_methods(braintree_id); diff --git a/ansible/files/killbill/deposit_ddl.sql b/ansible/files/killbill/deposit_ddl.sql new file mode 100644 index 00000000..4e1888b5 --- /dev/null +++ b/ansible/files/killbill/deposit_ddl.sql @@ -0,0 +1,52 @@ +/* + * Copyright 2020-2021 Equinix, Inc + * Copyright 2014-2021 The Billing Project, LLC + * + * The Billing Project licenses this file to you under the Apache License, version 2.0 + * (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/*! SET default_storage_engine=INNODB */; + +create table deposit_responses ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_id char(36) not null +, kb_payment_transaction_id char(36) not null +, transaction_type varchar(32) not null +, amount numeric(15,9) +, currency char(3) +, deposit_type varchar(255) default null +, deposit_reference_number varchar(255) default null +, deposit_effective_date datetime default null +, additional_data longtext default null +, created_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index deposit_responses_kb_payment_id on deposit_responses(kb_payment_id); +create index deposit_responses_kb_payment_transaction_id on deposit_responses(kb_payment_transaction_id); +create index deposit_responses_deposit_reference_number on deposit_responses(deposit_reference_number); + +create table deposit_payment_methods ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_method_id char(36) not null +, is_default smallint not null default 0 +, is_deleted smallint not null default 0 +, additional_data longtext default null +, created_date datetime not null +, updated_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create unique index deposit_payment_methods_kb_payment_id on deposit_payment_methods(kb_payment_method_id); diff --git a/ansible/files/killbill/email-notifications_ddl.sql b/ansible/files/killbill/email-notifications_ddl.sql new file mode 100644 index 00000000..42b7c1b2 --- /dev/null +++ b/ansible/files/killbill/email-notifications_ddl.sql @@ -0,0 +1,32 @@ +/* + * Copyright 2010-2014 Ning, Inc. + * Copyright 2014-2020 Groupon, Inc + * Copyright 2020-2020 Equinix, Inc + * Copyright 2014-2020 The Billing Project, LLC + * + * The Billing Project licenses this file to you under the Apache License, version 2.0 + * (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +DROP table If exists email_notifications_configuration; +CREATE TABLE email_notifications_configuration ( + record_id serial unique, + kb_account_id varchar(255) NOT NULL, + kb_tenant_id varchar(255) NOT NULL, + event_type varchar(255) NOT NULL, + created_at datetime NOT NULL, + PRIMARY KEY (record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +CREATE UNIQUE INDEX email_notifications_configuration_event_type_kb_account_id ON email_notifications_configuration(event_type, kb_account_id); +CREATE INDEX email_notifications_configuration_kb_account_id ON email_notifications_configuration(kb_account_id); +CREATE INDEX email_notifications_configuration_kb_tenant_id ON email_notifications_configuration(kb_tenant_id); +CREATE INDEX email_notifications_configuration_event_type_kb_tenant_id ON email_notifications_configuration(event_type, kb_tenant_id); \ No newline at end of file diff --git a/ansible/files/killbill/hyperswitch_ddl.sql b/ansible/files/killbill/hyperswitch_ddl.sql new file mode 100644 index 00000000..3fa6f77c --- /dev/null +++ b/ansible/files/killbill/hyperswitch_ddl.sql @@ -0,0 +1,57 @@ +/* + * Copyright 2020-2023 Equinix, Inc + * Copyright 2014-2023 The Billing Project, LLC + * + * The Billing Project licenses this file to you under the Apache License, version 2.0 + * (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/*! SET default_storage_engine=INNODB */; + +drop table if exists hyperswitch_payment_methods ; +create table hyperswitch_payment_methods ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_method_id char(36) not null +, hyperswitch_id varchar(255) not null +, is_default smallint not null default 0 +, is_deleted smallint not null default 0 +, additional_data longtext default null +, created_date datetime not null +, updated_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create unique index hyperswitch_payment_methods_kb_payment_id on hyperswitch_payment_methods(kb_payment_method_id); +create index hyperswitch_payment_methods_hyperswitch_id on hyperswitch_payment_methods(hyperswitch_id); + + +drop table if exists hyperswitch_responses; +create table hyperswitch_responses ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_id char(36) not null +, kb_payment_transaction_id char(36) not null +, transaction_type varchar(32) not null +, amount numeric(15,9) +, currency char(3) +, payment_attempt_id varchar(64) not null +, error_message varchar(64) +, error_code varchar(64) +, additional_data longtext default null +, created_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index hyperswitch_responses_kb_payment_id on hyperswitch_responses(kb_payment_id); +create index hyperswitch_responses_kb_payment_transaction_id on hyperswitch_responses(kb_payment_transaction_id); +create index hyperswitch_responses_payment_attempt_id on hyperswitch_responses(payment_attempt_id); \ No newline at end of file diff --git a/ansible/files/killbill/stripe_ddl.sql b/ansible/files/killbill/stripe_ddl.sql new file mode 100644 index 00000000..3962a389 --- /dev/null +++ b/ansible/files/killbill/stripe_ddl.sql @@ -0,0 +1,67 @@ +/* + * Copyright 2020-2020 Equinix, Inc + * Copyright 2014-2020 The Billing Project, LLC + * + * The Billing Project licenses this file to you under the Apache License, version 2.0 + * (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/*! SET default_storage_engine=INNODB */; + +create table stripe_hpp_requests ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_id char(36) default null +, kb_payment_transaction_id char(36) default null +, session_id varchar(255) not null +, additional_data longtext default null +, created_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index stripe_hpp_requests_kb_account_id on stripe_hpp_requests(kb_account_id); +create unique index stripe_hpp_requests_kb_session_id on stripe_hpp_requests(session_id); +create index stripe_hpp_requests_kb_payment_transaction_id on stripe_hpp_requests(kb_payment_transaction_id); + +create table stripe_responses ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_id char(36) not null +, kb_payment_transaction_id char(36) not null +, transaction_type varchar(32) not null +, amount numeric(15,9) +, currency char(3) +, stripe_id varchar(255) default null +, additional_data longtext default null +, created_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create index stripe_responses_kb_payment_id on stripe_responses(kb_payment_id); +create index stripe_responses_kb_payment_transaction_id on stripe_responses(kb_payment_transaction_id); +create index stripe_responses_stripe_id on stripe_responses(stripe_id); + +create table stripe_payment_methods ( + record_id serial +, kb_account_id char(36) not null +, kb_payment_method_id char(36) not null +, stripe_id varchar(255) not null +, is_default smallint not null default 0 +, is_deleted smallint not null default 0 +, additional_data longtext default null +, created_date datetime not null +, updated_date datetime not null +, kb_tenant_id char(36) not null +, primary key(record_id) +) /*! CHARACTER SET utf8 COLLATE utf8_bin */; +create unique index stripe_payment_methods_kb_payment_id on stripe_payment_methods(kb_payment_method_id); +create index stripe_payment_methods_stripe_id on stripe_payment_methods(stripe_id); diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 1b562916..d9510af6 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -45,6 +45,9 @@ flyway_group: root kaui_system_properties: '' kb_system_properties: '' +cloudsmith_token_aviate: kd355k1mdx5IL8TU +cloudsmith_url_aviate: "https://dl.cloudsmith.io/{{ cloudsmith_token_aviate }}" + # Tomcat and JVM properties -- recommended defaults jvm_initial_memory: 512m jvm_max_memory: 2G diff --git a/ansible/roles/killbill/tasks/plugins.yml b/ansible/roles/killbill/tasks/plugins.yml new file mode 100644 index 00000000..a3844290 --- /dev/null +++ b/ansible/roles/killbill/tasks/plugins.yml @@ -0,0 +1,25 @@ +--- +- name: Load KPM plugins to install + ansible.builtin.include_vars: + file: kpm_plugins.yml + +- name: Generate plugin ddl setup script + become: true + ansible.builtin.template: + src: "killbill/setup_plugin_ddl.sh.j2" + dest: "{{ tomcat_home }}/bin/setup_plugin_ddl.sh" + mode: u=rwx,g=r,o=r + owner: "{{ tomcat_owner }}" + group: "{{ tomcat_group }}" + +- name: Install KPM plugins + ansible.builtin.include_tasks: plugins/kpm_plugin.yml + loop: "{{ killbill_kpm_plugins }}" + loop_control: + loop_var: plugin + +- name: Load Hyperswitch plugin tasks + ansible.builtin.include_tasks: plugins/hyperswitch.yml + +- name: Load Aviate plugin tasks + ansible.builtin.include_tasks: plugins/aviate.yml diff --git a/ansible/roles/killbill/tasks/plugins/aviate.yml b/ansible/roles/killbill/tasks/plugins/aviate.yml new file mode 100644 index 00000000..11c7b55b --- /dev/null +++ b/ansible/roles/killbill/tasks/plugins/aviate.yml @@ -0,0 +1,36 @@ +--- +- name: Get latest Aviate plugin version + ansible.builtin.uri: + url: "{{ cloudsmith_url_aviate }}/killbill/aviate/maven/com/kill-bill/billing/plugin/java/aviate-plugin-prod/maven-metadata.xml" + return_content: true + register: killbill_aviate_metadata + tags: + - aviate + - plugins + +- name: Set aviate version + ansible.builtin.set_fact: + killbill_aviate_version: "{{ killbill_aviate_metadata.content | regex_search('(.*)', '\\1') | first }}" + tags: + - aviate + - plugins + +- name: Download Aviate plugin jar + ansible.builtin.get_url: + url: "{{ cloudsmith_url_aviate }}/killbill/aviate/maven/com/kill-bill/billing/plugin/java/aviate-plugin/{{ killbill_aviate_version }}/aviate-plugin-{{ killbill_aviate_version }}.jar" + dest: "{{ kb_plugins_dir }}/aviate-plugin-{{ killbill_aviate_version }}.jar" + mode: "0644" + tags: + - aviate + - plugins + +- name: Install Aviate plugin + become: true + become_user: "{{ tomcat_owner }}" + ansible.builtin.command: | + "{{ kpm_path }}/kpm" install_java_plugin aviate --from-source-file={{ kb_plugins_dir }}/aviate-plugin-{{ killbill_aviate_version }}.jar --destination={{ kb_plugins_dir }} + args: + creates: "{{ kb_plugins_dir }}/plugins/java/aviate-plugin" + tags: + - aviate + - plugins diff --git a/ansible/roles/killbill/tasks/plugins/hyperswitch.yml b/ansible/roles/killbill/tasks/plugins/hyperswitch.yml new file mode 100644 index 00000000..c0a6a727 --- /dev/null +++ b/ansible/roles/killbill/tasks/plugins/hyperswitch.yml @@ -0,0 +1,77 @@ +--- +- name: Get latest Hyperswitch plugin version + ansible.builtin.uri: + url: "{{ nexus_url }}/{{ nexus_repository }}/io/github/juspay/hyperswitchplugin/hyperswitch-killbill-plugin/maven-metadata.xml" + return_content: true + register: killbill_hyperswitch_metadata + tags: + - hyperswitch + - plugins + +- name: Set hyperswitch version + ansible.builtin.set_fact: + killbill_hyperswitch_version: "{{ killbill_hyperswitch_metadata.content | regex_search('(.*)', '\\1') | first }}" + tags: + - hyperswitch + - plugins + +- name: Download Hyperswitch plugin jar + ansible.builtin.get_url: + url: "{{ nexus_url }}/{{ nexus_repository }}/io/github/juspay/hyperswitchplugin/hyperswitch-killbill-plugin/{{ killbill_hyperswitch_version }}/hyperswitch-killbill-plugin-{{ killbill_hyperswitch_version }}.jar" + dest: "{{ kb_plugins_dir }}/hyperswitch-killbill-plugin-{{ killbill_hyperswitch_version }}.jar" + mode: "0644" + tags: + - hyperswitch + - plugins + +- name: Install Hyperswitch plugin + become: true + become_user: "{{ tomcat_owner }}" + ansible.builtin.command: | + "{{ kpm_path }}/kpm" install_java_plugin hyperswitch --from-source-file={{ kb_plugins_dir }}/hyperswitch-killbill-plugin-{{ killbill_hyperswitch_version }}.jar --destination={{ kb_plugins_dir }} + args: + creates: "{{ kb_plugins_dir }}/plugins/java/hyperswitch-plugin" + tags: + - hyperswitch + - plugins + +- name: Ensure temp directory exists + ansible.builtin.file: + path: "{{ kb_plugins_dir }}/temp/hyperswitch" + state: directory + owner: "{{ tomcat_owner }}" + group: "{{ tomcat_group }}" + mode: "0755" + tags: + - hyperswitch + - plugins + +- name: Copy Hyperswitch DDL + ansible.builtin.copy: + force: true + src: killbill/hyperswitch_ddl.sql + dest: "{{ kb_plugins_dir }}/temp/hyperswitch/hyperswitch_ddl.sql" + mode: u=rw,g=r,o=r + owner: "{{ tomcat_owner }}" + group: "{{ tomcat_group }}" + tags: + - hyperswitch + - plugins + +- name: Setup Hyperswitch DDL # noqa no-changed-when + become: true + become_user: "{{ tomcat_owner }}" + ansible.builtin.command: > + "{{ tomcat_home }}/bin/setup_plugin_ddl.sh + hyperswitch + {{ db_config_address | default('') }} + {{ db_config_username | default('') }} + {{ db_config_password | default('') }} + {{ db_config_killbill_db_name | default('') }}" + changed_when: false + when: + - db_config_address is defined + no_log: true + tags: + - hyperswitch + - plugins diff --git a/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml b/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml new file mode 100644 index 00000000..c467f40d --- /dev/null +++ b/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml @@ -0,0 +1,39 @@ +--- +- name: Install plugin (kpm) - {{ plugin }} + become: true + become_user: "{{ tomcat_owner }}" + ansible.builtin.command: > + "{{ kpm_path }}/kpm" install_java_plugin {{ plugin }} + --destination={{ kb_plugins_dir }} + args: + creates: "{{ kb_plugins_dir }}/plugins/java/{{ plugin }}-plugin" + +- name: Ensure temp directory exists + ansible.builtin.file: + path: "{{ kb_plugins_dir }}/temp/{{ plugin }}" + state: directory + owner: "{{ tomcat_owner }}" + group: "{{ tomcat_group }}" + mode: "0755" + +- name: Copy DDL + ansible.builtin.copy: + src: "killbill/{{ plugin }}_ddl.sql" + dest: "{{ kb_plugins_dir }}/temp/{{ plugin }}/{{ plugin }}_ddl.sql" + owner: "{{ tomcat_owner }}" + group: "{{ tomcat_group }}" + mode: u=rw,g=r,o=r + +- name: Run DDL + become: true + become_user: "{{ tomcat_owner }}" + ansible.builtin.command: > + {{ tomcat_home }}/bin/setup_plugin_ddl.sh + {{ plugin }} + {{ db_config_address | default('') }} + {{ db_config_username | default('') }} + {{ db_config_password | default('') }} + {{ db_config_killbill_db_name | default('') }} + changed_when: false + when: + - db_config_address is defined diff --git a/ansible/roles/killbill/vars/kpm_plugins.yml b/ansible/roles/killbill/vars/kpm_plugins.yml new file mode 100644 index 00000000..b81e6885 --- /dev/null +++ b/ansible/roles/killbill/vars/kpm_plugins.yml @@ -0,0 +1,7 @@ +killbill_kpm_plugins: + - adyen + - analytics + - braintree + - deposit + - email-notifications + - stripe From e2bf29e48dcd4ede08ca62b9e6286e8802da1e42 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Thu, 16 Apr 2026 16:23:18 +0530 Subject: [PATCH 02/25] * Moved all plugins .sql files under roles/killbill directory * Added setup_plugin_ddl.sh.j2 --- ansible/install_plugins.yml | 6 ++++ .../killbill/files}/adyen_ddl.sql | 0 .../killbill/files}/analytics_ddl.sql | 0 .../killbill/files}/braintree_ddl.sql | 0 .../killbill/files}/deposit_ddl.sql | 0 .../files}/email-notifications_ddl.sql | 0 .../killbill/files}/hyperswitch_ddl.sql | 0 .../killbill/files}/stripe_ddl.sql | 0 .../{plugins.yml => install_plugins.yml} | 0 .../killbill/tasks/plugins/kpm_plugin.yml | 2 +- .../templates/killbill/setup_plugin_ddl.sh.j2 | 28 +++++++++++++++++++ 11 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 ansible/install_plugins.yml rename ansible/{files/killbill => roles/killbill/files}/adyen_ddl.sql (100%) rename ansible/{files/killbill => roles/killbill/files}/analytics_ddl.sql (100%) rename ansible/{files/killbill => roles/killbill/files}/braintree_ddl.sql (100%) rename ansible/{files/killbill => roles/killbill/files}/deposit_ddl.sql (100%) rename ansible/{files/killbill => roles/killbill/files}/email-notifications_ddl.sql (100%) rename ansible/{files/killbill => roles/killbill/files}/hyperswitch_ddl.sql (100%) rename ansible/{files/killbill => roles/killbill/files}/stripe_ddl.sql (100%) rename ansible/roles/killbill/tasks/{plugins.yml => install_plugins.yml} (100%) create mode 100644 ansible/templates/killbill/setup_plugin_ddl.sh.j2 diff --git a/ansible/install_plugins.yml b/ansible/install_plugins.yml new file mode 100644 index 00000000..1051e9e3 --- /dev/null +++ b/ansible/install_plugins.yml @@ -0,0 +1,6 @@ +--- +- name: Install Plugins + hosts: all + tasks: + - name: Install plugins + import_tasks: roles/common/tasks/install_plugins.yml diff --git a/ansible/files/killbill/adyen_ddl.sql b/ansible/roles/killbill/files/adyen_ddl.sql similarity index 100% rename from ansible/files/killbill/adyen_ddl.sql rename to ansible/roles/killbill/files/adyen_ddl.sql diff --git a/ansible/files/killbill/analytics_ddl.sql b/ansible/roles/killbill/files/analytics_ddl.sql similarity index 100% rename from ansible/files/killbill/analytics_ddl.sql rename to ansible/roles/killbill/files/analytics_ddl.sql diff --git a/ansible/files/killbill/braintree_ddl.sql b/ansible/roles/killbill/files/braintree_ddl.sql similarity index 100% rename from ansible/files/killbill/braintree_ddl.sql rename to ansible/roles/killbill/files/braintree_ddl.sql diff --git a/ansible/files/killbill/deposit_ddl.sql b/ansible/roles/killbill/files/deposit_ddl.sql similarity index 100% rename from ansible/files/killbill/deposit_ddl.sql rename to ansible/roles/killbill/files/deposit_ddl.sql diff --git a/ansible/files/killbill/email-notifications_ddl.sql b/ansible/roles/killbill/files/email-notifications_ddl.sql similarity index 100% rename from ansible/files/killbill/email-notifications_ddl.sql rename to ansible/roles/killbill/files/email-notifications_ddl.sql diff --git a/ansible/files/killbill/hyperswitch_ddl.sql b/ansible/roles/killbill/files/hyperswitch_ddl.sql similarity index 100% rename from ansible/files/killbill/hyperswitch_ddl.sql rename to ansible/roles/killbill/files/hyperswitch_ddl.sql diff --git a/ansible/files/killbill/stripe_ddl.sql b/ansible/roles/killbill/files/stripe_ddl.sql similarity index 100% rename from ansible/files/killbill/stripe_ddl.sql rename to ansible/roles/killbill/files/stripe_ddl.sql diff --git a/ansible/roles/killbill/tasks/plugins.yml b/ansible/roles/killbill/tasks/install_plugins.yml similarity index 100% rename from ansible/roles/killbill/tasks/plugins.yml rename to ansible/roles/killbill/tasks/install_plugins.yml diff --git a/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml b/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml index c467f40d..c805b1db 100644 --- a/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml +++ b/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml @@ -18,7 +18,7 @@ - name: Copy DDL ansible.builtin.copy: - src: "killbill/{{ plugin }}_ddl.sql" + src: "{{ plugin }}_ddl.sql" dest: "{{ kb_plugins_dir }}/temp/{{ plugin }}/{{ plugin }}_ddl.sql" owner: "{{ tomcat_owner }}" group: "{{ tomcat_group }}" diff --git a/ansible/templates/killbill/setup_plugin_ddl.sh.j2 b/ansible/templates/killbill/setup_plugin_ddl.sh.j2 new file mode 100644 index 00000000..c169691b --- /dev/null +++ b/ansible/templates/killbill/setup_plugin_ddl.sh.j2 @@ -0,0 +1,28 @@ +#!/bin/bash + +[ $# -ne 5 ] && { echo "Usage: $0 "; exit 1; } + +PLUGIN=$1 +ENDPOINT=$2 +USER=$3 +PWD=$4 +DB_NAME=$5 + +MYSQL_CMD="mysql --ssl-mode=disabled --get-server-public-key -h ${ENDPOINT} -u${USER} -p${PWD}" + +$MYSQL_CMD -e "USE ${DB_NAME};" 2>/dev/null; + +DDL_FILE="{{ kb_plugins_dir }}/temp/${PLUGIN}/${PLUGIN}_ddl.sql" + +if [ ! -f "$DDL_FILE" ]; then + echo "DDL file not found: $DDL_FILE" + exit 1 +fi + +echo "Installing ${PLUGIN} plugin schema..." + +cat "$DDL_FILE" | $MYSQL_CMD ${DB_NAME} + +rm -rf {{ kb_plugins_dir }}/temp + +echo "${PLUGIN} schema installation completed" \ No newline at end of file From 026f01b46f68956b18fcc1f06644654ccdd5937d Mon Sep 17 00:00:00 2001 From: Vijay N Date: Sun, 26 Apr 2026 06:56:54 +0530 Subject: [PATCH 03/25] Fixed path location of setup_plugin_ddl.sh.j2 file. --- ansible/roles/killbill/tasks/install_plugins.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/killbill/tasks/install_plugins.yml b/ansible/roles/killbill/tasks/install_plugins.yml index a3844290..b30ee514 100644 --- a/ansible/roles/killbill/tasks/install_plugins.yml +++ b/ansible/roles/killbill/tasks/install_plugins.yml @@ -6,7 +6,7 @@ - name: Generate plugin ddl setup script become: true ansible.builtin.template: - src: "killbill/setup_plugin_ddl.sh.j2" + src: "{{ playbook_dir }}/templates/killbill/setup_plugin_ddl.sh.j2" dest: "{{ tomcat_home }}/bin/setup_plugin_ddl.sh" mode: u=rwx,g=r,o=r owner: "{{ tomcat_owner }}" From cdb132152d7ffc46cd9e304db3c0e6609f7ab7b1 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Sun, 26 Apr 2026 08:02:25 +0530 Subject: [PATCH 04/25] Fixed hyperswitch ddl path --- .../roles/killbill/tasks/install_plugins.yml | 2 +- .../killbill/tasks/plugins/hyperswitch.yml | 2 +- .../templates/killbill/setup_plugin_ddl.sh.j2 | 28 ------------------- 3 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 ansible/templates/killbill/setup_plugin_ddl.sh.j2 diff --git a/ansible/roles/killbill/tasks/install_plugins.yml b/ansible/roles/killbill/tasks/install_plugins.yml index b30ee514..a3844290 100644 --- a/ansible/roles/killbill/tasks/install_plugins.yml +++ b/ansible/roles/killbill/tasks/install_plugins.yml @@ -6,7 +6,7 @@ - name: Generate plugin ddl setup script become: true ansible.builtin.template: - src: "{{ playbook_dir }}/templates/killbill/setup_plugin_ddl.sh.j2" + src: "killbill/setup_plugin_ddl.sh.j2" dest: "{{ tomcat_home }}/bin/setup_plugin_ddl.sh" mode: u=rwx,g=r,o=r owner: "{{ tomcat_owner }}" diff --git a/ansible/roles/killbill/tasks/plugins/hyperswitch.yml b/ansible/roles/killbill/tasks/plugins/hyperswitch.yml index c0a6a727..394ad393 100644 --- a/ansible/roles/killbill/tasks/plugins/hyperswitch.yml +++ b/ansible/roles/killbill/tasks/plugins/hyperswitch.yml @@ -49,7 +49,7 @@ - name: Copy Hyperswitch DDL ansible.builtin.copy: force: true - src: killbill/hyperswitch_ddl.sql + src: hyperswitch_ddl.sql dest: "{{ kb_plugins_dir }}/temp/hyperswitch/hyperswitch_ddl.sql" mode: u=rw,g=r,o=r owner: "{{ tomcat_owner }}" diff --git a/ansible/templates/killbill/setup_plugin_ddl.sh.j2 b/ansible/templates/killbill/setup_plugin_ddl.sh.j2 deleted file mode 100644 index c169691b..00000000 --- a/ansible/templates/killbill/setup_plugin_ddl.sh.j2 +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -[ $# -ne 5 ] && { echo "Usage: $0 "; exit 1; } - -PLUGIN=$1 -ENDPOINT=$2 -USER=$3 -PWD=$4 -DB_NAME=$5 - -MYSQL_CMD="mysql --ssl-mode=disabled --get-server-public-key -h ${ENDPOINT} -u${USER} -p${PWD}" - -$MYSQL_CMD -e "USE ${DB_NAME};" 2>/dev/null; - -DDL_FILE="{{ kb_plugins_dir }}/temp/${PLUGIN}/${PLUGIN}_ddl.sql" - -if [ ! -f "$DDL_FILE" ]; then - echo "DDL file not found: $DDL_FILE" - exit 1 -fi - -echo "Installing ${PLUGIN} plugin schema..." - -cat "$DDL_FILE" | $MYSQL_CMD ${DB_NAME} - -rm -rf {{ kb_plugins_dir }}/temp - -echo "${PLUGIN} schema installation completed" \ No newline at end of file From 8803083ed0afc69d04b695a242aab69d786df197 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Sun, 26 Apr 2026 08:32:41 +0530 Subject: [PATCH 05/25] Fixed Ansible parsing error --- ansible/roles/killbill/tasks/plugins/hyperswitch.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ansible/roles/killbill/tasks/plugins/hyperswitch.yml b/ansible/roles/killbill/tasks/plugins/hyperswitch.yml index 394ad393..581259c4 100644 --- a/ansible/roles/killbill/tasks/plugins/hyperswitch.yml +++ b/ansible/roles/killbill/tasks/plugins/hyperswitch.yml @@ -62,16 +62,15 @@ become: true become_user: "{{ tomcat_owner }}" ansible.builtin.command: > - "{{ tomcat_home }}/bin/setup_plugin_ddl.sh + {{ tomcat_home }}/bin/setup_plugin_ddl.sh hyperswitch {{ db_config_address | default('') }} {{ db_config_username | default('') }} {{ db_config_password | default('') }} - {{ db_config_killbill_db_name | default('') }}" + {{ db_config_killbill_db_name | default('') }} changed_when: false when: - db_config_address is defined - no_log: true tags: - hyperswitch - plugins From bbf5bbc2d298f5e8b7f2adb570606ace161c4c66 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Mon, 27 Apr 2026 13:40:10 +0530 Subject: [PATCH 06/25] Corrected Aviate URL and removed variables that were not required. --- ansible/group_vars/all.yml | 3 --- ansible/roles/killbill/tasks/plugins/aviate.yml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index d9510af6..1b562916 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -45,9 +45,6 @@ flyway_group: root kaui_system_properties: '' kb_system_properties: '' -cloudsmith_token_aviate: kd355k1mdx5IL8TU -cloudsmith_url_aviate: "https://dl.cloudsmith.io/{{ cloudsmith_token_aviate }}" - # Tomcat and JVM properties -- recommended defaults jvm_initial_memory: 512m jvm_max_memory: 2G diff --git a/ansible/roles/killbill/tasks/plugins/aviate.yml b/ansible/roles/killbill/tasks/plugins/aviate.yml index 11c7b55b..37b90415 100644 --- a/ansible/roles/killbill/tasks/plugins/aviate.yml +++ b/ansible/roles/killbill/tasks/plugins/aviate.yml @@ -17,7 +17,7 @@ - name: Download Aviate plugin jar ansible.builtin.get_url: - url: "{{ cloudsmith_url_aviate }}/killbill/aviate/maven/com/kill-bill/billing/plugin/java/aviate-plugin/{{ killbill_aviate_version }}/aviate-plugin-{{ killbill_aviate_version }}.jar" + url: "{{ cloudsmith_url_aviate }}/killbill/aviate/maven/com/kill-bill/billing/plugin/java/aviate-plugin-prod/{{ killbill_aviate_version }}/aviate-plugin-{{ killbill_aviate_version }}.jar" dest: "{{ kb_plugins_dir }}/aviate-plugin-{{ killbill_aviate_version }}.jar" mode: "0644" tags: From 9e9d736c9b17513ff2c7acb138db873e97c730ef Mon Sep 17 00:00:00 2001 From: Vijay N Date: Mon, 27 Apr 2026 14:06:40 +0530 Subject: [PATCH 07/25] Corrected Aviate prod URL --- ansible/roles/killbill/tasks/plugins/aviate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/killbill/tasks/plugins/aviate.yml b/ansible/roles/killbill/tasks/plugins/aviate.yml index 37b90415..239f838f 100644 --- a/ansible/roles/killbill/tasks/plugins/aviate.yml +++ b/ansible/roles/killbill/tasks/plugins/aviate.yml @@ -17,7 +17,7 @@ - name: Download Aviate plugin jar ansible.builtin.get_url: - url: "{{ cloudsmith_url_aviate }}/killbill/aviate/maven/com/kill-bill/billing/plugin/java/aviate-plugin-prod/{{ killbill_aviate_version }}/aviate-plugin-{{ killbill_aviate_version }}.jar" + url: "{{ cloudsmith_url_aviate }}/killbill/aviate/maven/com/kill-bill/billing/plugin/java/aviate-plugin-prod/{{ killbill_aviate_version }}/aviate-plugin-prod-{{ killbill_aviate_version }}.jar" dest: "{{ kb_plugins_dir }}/aviate-plugin-{{ killbill_aviate_version }}.jar" mode: "0644" tags: From 5167bc0a28035e47cee66a62fe642f4a49939aea Mon Sep 17 00:00:00 2001 From: Vijay N Date: Mon, 27 Apr 2026 14:47:02 +0530 Subject: [PATCH 08/25] Updated kpm_plugin.yml, removed become_user=tomcat to prevent sudo timeout during plugin install --- ansible/roles/killbill/tasks/plugins/kpm_plugin.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml b/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml index c805b1db..71f0e1b9 100644 --- a/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml +++ b/ansible/roles/killbill/tasks/plugins/kpm_plugin.yml @@ -1,7 +1,6 @@ --- - name: Install plugin (kpm) - {{ plugin }} become: true - become_user: "{{ tomcat_owner }}" ansible.builtin.command: > "{{ kpm_path }}/kpm" install_java_plugin {{ plugin }} --destination={{ kb_plugins_dir }} @@ -26,7 +25,6 @@ - name: Run DDL become: true - become_user: "{{ tomcat_owner }}" ansible.builtin.command: > {{ tomcat_home }}/bin/setup_plugin_ddl.sh {{ plugin }} From 46c4d3514143c59faecf07bcad94192aff590067 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Mon, 27 Apr 2026 15:08:37 +0530 Subject: [PATCH 09/25] Updated aviate.yml and hyperswitch.yml, removed become_user=tomcat to prevent sudo timeout during plugin install --- ansible/roles/killbill/tasks/plugins/aviate.yml | 1 - ansible/roles/killbill/tasks/plugins/hyperswitch.yml | 2 -- 2 files changed, 3 deletions(-) diff --git a/ansible/roles/killbill/tasks/plugins/aviate.yml b/ansible/roles/killbill/tasks/plugins/aviate.yml index 239f838f..9ab53f7d 100644 --- a/ansible/roles/killbill/tasks/plugins/aviate.yml +++ b/ansible/roles/killbill/tasks/plugins/aviate.yml @@ -26,7 +26,6 @@ - name: Install Aviate plugin become: true - become_user: "{{ tomcat_owner }}" ansible.builtin.command: | "{{ kpm_path }}/kpm" install_java_plugin aviate --from-source-file={{ kb_plugins_dir }}/aviate-plugin-{{ killbill_aviate_version }}.jar --destination={{ kb_plugins_dir }} args: diff --git a/ansible/roles/killbill/tasks/plugins/hyperswitch.yml b/ansible/roles/killbill/tasks/plugins/hyperswitch.yml index 581259c4..e457fcaf 100644 --- a/ansible/roles/killbill/tasks/plugins/hyperswitch.yml +++ b/ansible/roles/killbill/tasks/plugins/hyperswitch.yml @@ -26,7 +26,6 @@ - name: Install Hyperswitch plugin become: true - become_user: "{{ tomcat_owner }}" ansible.builtin.command: | "{{ kpm_path }}/kpm" install_java_plugin hyperswitch --from-source-file={{ kb_plugins_dir }}/hyperswitch-killbill-plugin-{{ killbill_hyperswitch_version }}.jar --destination={{ kb_plugins_dir }} args: @@ -60,7 +59,6 @@ - name: Setup Hyperswitch DDL # noqa no-changed-when become: true - become_user: "{{ tomcat_owner }}" ansible.builtin.command: > {{ tomcat_home }}/bin/setup_plugin_ddl.sh hyperswitch From bc7d7adca8db519902347802ff871c7c51d64ed8 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Tue, 28 Apr 2026 15:34:46 +0530 Subject: [PATCH 10/25] Braintree now installs DDL itself -- updated install_plugins.yml playbook and removed its ddl.sql. --- .../roles/killbill/files/braintree_ddl.sql | 52 ------------------- .../roles/killbill/tasks/install_plugins.yml | 10 ++++ ansible/roles/killbill/vars/kpm_plugins.yml | 1 - 3 files changed, 10 insertions(+), 53 deletions(-) delete mode 100644 ansible/roles/killbill/files/braintree_ddl.sql diff --git a/ansible/roles/killbill/files/braintree_ddl.sql b/ansible/roles/killbill/files/braintree_ddl.sql deleted file mode 100644 index 53e2fea1..00000000 --- a/ansible/roles/killbill/files/braintree_ddl.sql +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020-2020 Equinix, Inc - * Copyright 2014-2020 The Billing Project, LLC - * - * The Billing Project licenses this file to you under the Apache License, version 2.0 - * (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - -/*! SET default_storage_engine=INNODB */; - -create table braintree_responses ( - record_id serial -, kb_account_id char(36) not null -, kb_payment_id char(36) not null -, kb_payment_transaction_id char(36) not null -, transaction_type varchar(32) not null -, amount numeric(15,9) -, currency char(3) -, braintree_id varchar(255) not null -, additional_data longtext default null -, created_date datetime not null -, kb_tenant_id char(36) not null -, primary key(record_id) -) /*! CHARACTER SET utf8 COLLATE utf8_bin */; -create index braintree_responses_kb_payment_id on braintree_responses(kb_payment_id); -create index braintree_responses_kb_payment_transaction_id on braintree_responses(kb_payment_transaction_id); -create index braintree_responses_braintree_id on braintree_responses(braintree_id); - -create table braintree_payment_methods ( - record_id serial -, kb_account_id char(36) not null -, kb_payment_method_id char(36) not null -, braintree_id varchar(255) not null -, is_default smallint not null default 0 -, is_deleted smallint not null default 0 -, additional_data longtext default null -, created_date datetime not null -, updated_date datetime not null -, kb_tenant_id char(36) not null -, primary key(record_id) -) /*! CHARACTER SET utf8 COLLATE utf8_bin */; -create unique index braintree_payment_methods_kb_payment_id on braintree_payment_methods(kb_payment_method_id); -create index braintree_payment_methods_braintree_id on braintree_payment_methods(braintree_id); diff --git a/ansible/roles/killbill/tasks/install_plugins.yml b/ansible/roles/killbill/tasks/install_plugins.yml index a3844290..17e09b49 100644 --- a/ansible/roles/killbill/tasks/install_plugins.yml +++ b/ansible/roles/killbill/tasks/install_plugins.yml @@ -23,3 +23,13 @@ - name: Load Aviate plugin tasks ansible.builtin.include_tasks: plugins/aviate.yml + +- name: Install Braintree plugin + become: true + ansible.builtin.command: | + "{{ kpm_path }}/kpm" install_java_plugin braintree --destination={{ kb_plugins_dir }} + args: + creates: "{{ kb_plugins_dir }}/plugins/java/braintree-plugin" + tags: + - hyperswitch + - plugins \ No newline at end of file diff --git a/ansible/roles/killbill/vars/kpm_plugins.yml b/ansible/roles/killbill/vars/kpm_plugins.yml index b81e6885..ce606de2 100644 --- a/ansible/roles/killbill/vars/kpm_plugins.yml +++ b/ansible/roles/killbill/vars/kpm_plugins.yml @@ -1,7 +1,6 @@ killbill_kpm_plugins: - adyen - analytics - - braintree - deposit - email-notifications - stripe From 2e2e2916f0ccf316d48b6319e6de37f523d4981a Mon Sep 17 00:00:00 2001 From: Vijay N Date: Wed, 6 May 2026 18:48:05 +0530 Subject: [PATCH 11/25] Added install_plugins.yml for Docker image -- updated Dockerfile to run this playbook. --- ansible/install_plugins.yml | 2 +- ansible/roles/killbill/tasks/install_plugins.yml | 2 +- docker/templates/killbill/latest/Dockerfile.template | 11 +++++++++++ docker/templates/killbill/latest/killbill.sh | 2 ++ docker/templates/killbill/tagged/Dockerfile.template | 2 ++ 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ansible/install_plugins.yml b/ansible/install_plugins.yml index 1051e9e3..f9716ca3 100644 --- a/ansible/install_plugins.yml +++ b/ansible/install_plugins.yml @@ -3,4 +3,4 @@ hosts: all tasks: - name: Install plugins - import_tasks: roles/common/tasks/install_plugins.yml + import_tasks: roles/killbill/tasks/install_plugins.yml diff --git a/ansible/roles/killbill/tasks/install_plugins.yml b/ansible/roles/killbill/tasks/install_plugins.yml index 17e09b49..e66d18de 100644 --- a/ansible/roles/killbill/tasks/install_plugins.yml +++ b/ansible/roles/killbill/tasks/install_plugins.yml @@ -31,5 +31,5 @@ args: creates: "{{ kb_plugins_dir }}/plugins/java/braintree-plugin" tags: - - hyperswitch + - braintree - plugins \ No newline at end of file diff --git a/docker/templates/killbill/latest/Dockerfile.template b/docker/templates/killbill/latest/Dockerfile.template index 7a4715de..28704920 100644 --- a/docker/templates/killbill/latest/Dockerfile.template +++ b/docker/templates/killbill/latest/Dockerfile.template @@ -61,6 +61,17 @@ ENV MIGRATIONS_CMD="ansible-playbook $ANSIBLE_OPTS \ -e catalina_base=$CATALINA_BASE \ $KILLBILL_CLOUD_ANSIBLE_ROLES/migrations.yml" +ENV INSTALL_PLUGINS_CMD="ansible-playbook $ANSIBLE_OPTS \ + -e kpm_install_dir=$KPM_INSTALL_DIR \ + -e killbill_kpm_yml=$KILLBILL_INSTALL_DIR/kpm.yml \ + -e kb_config_dir=$KILLBILL_INSTALL_DIR/config \ + -e kb_plugins_dir=$KILLBILL_INSTALL_DIR/bundles \ + -e tomcat_owner=$TOMCAT_OWNER \ + -e tomcat_group=$TOMCAT_GROUP \ + -e catalina_base=$CATALINA_BASE \ + -e kb_system_properties=-Dcom.killbill.license=$KILLBILL_INSTALL_DIR/config/aws.out \ + $KILLBILL_CLOUD_ANSIBLE_ROLES/install_plugins.yml" + # Install Logtstash dependencies ENV LOGSTASH_ENABLED=true RUN ansible-playbook $ANSIBLE_OPTS $KILLBILL_CLOUD_ANSIBLE_ROLES/killbill_json_logging.yml --tags download diff --git a/docker/templates/killbill/latest/killbill.sh b/docker/templates/killbill/latest/killbill.sh index f2a4ecf5..dba34b4c 100755 --- a/docker/templates/killbill/latest/killbill.sh +++ b/docker/templates/killbill/latest/killbill.sh @@ -3,6 +3,8 @@ # Run both the main playbook and the one enabling structured logging $KPM_INSTALL_CMD $KILLBILL_CLOUD_ANSIBLE_ROLES/killbill_json_logging.yml +$INSTALL_PLUGINS_CMD + originalfile=$KILLBILL_INSTALL_DIR/config/shiro.ini.template cat $originalfile | envsubst '${KB_ADMIN_PASSWORD}' > $KILLBILL_INSTALL_DIR/config/shiro.ini diff --git a/docker/templates/killbill/tagged/Dockerfile.template b/docker/templates/killbill/tagged/Dockerfile.template index 3be41d3a..979c6b17 100644 --- a/docker/templates/killbill/tagged/Dockerfile.template +++ b/docker/templates/killbill/tagged/Dockerfile.template @@ -9,5 +9,7 @@ COPY ./kpm.yml $KILLBILL_INSTALL_DIR # Run both the main playbook and the one enabling structured logging RUN $KPM_INSTALL_CMD $KILLBILL_CLOUD_ANSIBLE_ROLES/killbill_json_logging.yml +RUN $INSTALL_PLUGINS_CMD + # Override start script (no need for Ansible scripts to be run) COPY ./killbill.sh $KILLBILL_INSTALL_DIR From f13b842d6ce28f57ac929b1516ff020476163cf4 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Fri, 8 May 2026 16:16:18 +0530 Subject: [PATCH 12/25] Updated Docker image build command to not use cache --- docker/Makefile | 2 +- docker/templates/base/latest/Dockerfile | 2 +- docker/templates/killbill/latest/killbill.sh | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docker/Makefile b/docker/Makefile index 32152bf5..0e0005be 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -23,7 +23,7 @@ all: build build: @echo "Building image $(IMAGE) for version $(VERSION) from template $(TEMPLATE) with parent $(PARENT_VERSION)" $(DOCKER_TEMPLATE) -p $(PARENT_VERSION) -v $(VERSION) -t $(TARGET) -i - $(DOCKER) build -t $(IMAGE) $(TEMPLATE) + $(DOCKER) build --no-cache -t $(IMAGE) $(TEMPLATE) $(DOCKER_TEMPLATE) -t $(TARGET) -c rebuild: diff --git a/docker/templates/base/latest/Dockerfile b/docker/templates/base/latest/Dockerfile index cd174252..f8bd7691 100644 --- a/docker/templates/base/latest/Dockerfile +++ b/docker/templates/base/latest/Dockerfile @@ -57,7 +57,7 @@ WORKDIR $TOMCAT_HOME # Install ansible roles dependencies ARG KILLBILL_CLOUD_VERSION RUN ansible-galaxy collection install community.general && \ - ansible-galaxy install git+https://git@github.com/killbill/killbill-cloud.git,$KILLBILL_CLOUD_VERSION + ansible-galaxy install git+https://git@github.com/vnandwana/killbill-cloud.git,$KILLBILL_CLOUD_VERSION ENV KILLBILL_CLOUD_ANSIBLE_ROLES=$TOMCAT_HOME/.ansible/roles/killbill-cloud/ansible ENV ENV_HOST_IP=localhost ENV ANSIBLE_OPTS="-i localhost, \ diff --git a/docker/templates/killbill/latest/killbill.sh b/docker/templates/killbill/latest/killbill.sh index dba34b4c..6a72629f 100755 --- a/docker/templates/killbill/latest/killbill.sh +++ b/docker/templates/killbill/latest/killbill.sh @@ -1,8 +1,16 @@ #!/bin/bash +set -ex + +echo "STARTING INSTALL_PLUGINS_CMD" + + # Run both the main playbook and the one enabling structured logging $KPM_INSTALL_CMD $KILLBILL_CLOUD_ANSIBLE_ROLES/killbill_json_logging.yml +echo "STARTING INSTALL_PLUGINS_CMD..." +echo "$INSTALL_PLUGINS_CMD" + $INSTALL_PLUGINS_CMD originalfile=$KILLBILL_INSTALL_DIR/config/shiro.ini.template From 8895517507ffc04b51be702e5e1f9049e8081216 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Fri, 8 May 2026 17:00:11 +0530 Subject: [PATCH 13/25] Fixed Ansible var path of kpm_plugins.yml. --- ansible/roles/killbill/tasks/install_plugins.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/killbill/tasks/install_plugins.yml b/ansible/roles/killbill/tasks/install_plugins.yml index e66d18de..38353ffd 100644 --- a/ansible/roles/killbill/tasks/install_plugins.yml +++ b/ansible/roles/killbill/tasks/install_plugins.yml @@ -1,7 +1,7 @@ --- - name: Load KPM plugins to install ansible.builtin.include_vars: - file: kpm_plugins.yml + file: "{{ role_path }}/vars/kpm_plugins.yml" - name: Generate plugin ddl setup script become: true From 46c3f1ddcf2da3f2aa780897f84ed6a039ecc97c Mon Sep 17 00:00:00 2001 From: Vijay N Date: Fri, 8 May 2026 17:55:48 +0530 Subject: [PATCH 14/25] Fixed 'role_path' is undefined issue --- ansible/install_plugins.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ansible/install_plugins.yml b/ansible/install_plugins.yml index f9716ca3..cc122be8 100644 --- a/ansible/install_plugins.yml +++ b/ansible/install_plugins.yml @@ -3,4 +3,6 @@ hosts: all tasks: - name: Install plugins - import_tasks: roles/killbill/tasks/install_plugins.yml + ansible.builtin.include_role: + name: killbill + tasks_from: install_plugins From f0d0ee1fd91732510ed777821ea4f21cec291641 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Wed, 13 May 2026 13:25:22 +0530 Subject: [PATCH 15/25] Added setup_plugin_ddl.sh.j2 file. --- .../templates/killbill/setup_plugin_ddl.sh.j2 | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 ansible/templates/killbill/setup_plugin_ddl.sh.j2 diff --git a/ansible/templates/killbill/setup_plugin_ddl.sh.j2 b/ansible/templates/killbill/setup_plugin_ddl.sh.j2 new file mode 100644 index 00000000..c169691b --- /dev/null +++ b/ansible/templates/killbill/setup_plugin_ddl.sh.j2 @@ -0,0 +1,28 @@ +#!/bin/bash + +[ $# -ne 5 ] && { echo "Usage: $0 "; exit 1; } + +PLUGIN=$1 +ENDPOINT=$2 +USER=$3 +PWD=$4 +DB_NAME=$5 + +MYSQL_CMD="mysql --ssl-mode=disabled --get-server-public-key -h ${ENDPOINT} -u${USER} -p${PWD}" + +$MYSQL_CMD -e "USE ${DB_NAME};" 2>/dev/null; + +DDL_FILE="{{ kb_plugins_dir }}/temp/${PLUGIN}/${PLUGIN}_ddl.sql" + +if [ ! -f "$DDL_FILE" ]; then + echo "DDL file not found: $DDL_FILE" + exit 1 +fi + +echo "Installing ${PLUGIN} plugin schema..." + +cat "$DDL_FILE" | $MYSQL_CMD ${DB_NAME} + +rm -rf {{ kb_plugins_dir }}/temp + +echo "${PLUGIN} schema installation completed" \ No newline at end of file From 12560e4b06e87f338c5a8611a75f58e8122464bd Mon Sep 17 00:00:00 2001 From: Vijay N Date: Wed, 13 May 2026 13:46:29 +0530 Subject: [PATCH 16/25] Added Aviate token and URL variables. --- ansible/group_vars/all.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 1b562916..4dad8bda 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -20,6 +20,9 @@ kaui_webapps: webapps tomcat_foreground: false +cloudsmith_token_aviate: kd355k1mdx5IL8TU +cloudsmith_url_aviate: "https://dl.cloudsmith.io/{{ cloudsmith_token_aviate }}" + # Base directory for namespacing kb_install_dir: /var/lib/killbill # Configuration files (killbill.properties, JRuby files, etc.) From b63bb8d38bfa115a2ed168f7a6d9be0fcb0d6211 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Wed, 13 May 2026 15:01:06 +0530 Subject: [PATCH 17/25] Updated killbill.sh script to wait for DB to be ready before installing plugins. --- docker/templates/killbill/latest/killbill.sh | 6 ++++++ docker/templates/killbill/tagged/Dockerfile.template | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/templates/killbill/latest/killbill.sh b/docker/templates/killbill/latest/killbill.sh index 6a72629f..d6a20c69 100755 --- a/docker/templates/killbill/latest/killbill.sh +++ b/docker/templates/killbill/latest/killbill.sh @@ -9,6 +9,12 @@ echo "STARTING INSTALL_PLUGINS_CMD" $KPM_INSTALL_CMD $KILLBILL_CLOUD_ANSIBLE_ROLES/killbill_json_logging.yml echo "STARTING INSTALL_PLUGINS_CMD..." + +until mysql --protocol=TCP -h127.0.0.1 -P3306 -uroot -pkillbill -e "SELECT 1"; do + echo "Waiting for MariaDB..." + sleep 5 +done + echo "$INSTALL_PLUGINS_CMD" $INSTALL_PLUGINS_CMD diff --git a/docker/templates/killbill/tagged/Dockerfile.template b/docker/templates/killbill/tagged/Dockerfile.template index 979c6b17..3be41d3a 100644 --- a/docker/templates/killbill/tagged/Dockerfile.template +++ b/docker/templates/killbill/tagged/Dockerfile.template @@ -9,7 +9,5 @@ COPY ./kpm.yml $KILLBILL_INSTALL_DIR # Run both the main playbook and the one enabling structured logging RUN $KPM_INSTALL_CMD $KILLBILL_CLOUD_ANSIBLE_ROLES/killbill_json_logging.yml -RUN $INSTALL_PLUGINS_CMD - # Override start script (no need for Ansible scripts to be run) COPY ./killbill.sh $KILLBILL_INSTALL_DIR From b6cfc396db18eb016aa7e7f1f9eb7715805b5311 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Wed, 13 May 2026 15:37:14 +0530 Subject: [PATCH 18/25] Updated killbill.sh script --- docker/templates/killbill/latest/killbill.sh | 29 +++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/docker/templates/killbill/latest/killbill.sh b/docker/templates/killbill/latest/killbill.sh index d6a20c69..7a17b335 100755 --- a/docker/templates/killbill/latest/killbill.sh +++ b/docker/templates/killbill/latest/killbill.sh @@ -2,24 +2,33 @@ set -ex -echo "STARTING INSTALL_PLUGINS_CMD" - +echo "STARTING KPM INSTALL" -# Run both the main playbook and the one enabling structured logging $KPM_INSTALL_CMD $KILLBILL_CLOUD_ANSIBLE_ROLES/killbill_json_logging.yml -echo "STARTING INSTALL_PLUGINS_CMD..." +originalfile=$KILLBILL_INSTALL_DIR/config/shiro.ini.template +cat $originalfile | envsubst '${KB_ADMIN_PASSWORD}' > $KILLBILL_INSTALL_DIR/config/shiro.ini + +echo "Starting Tomcat..." + +/usr/share/tomcat/bin/catalina.sh run & + +TOMCAT_PID=$! + +echo "Waiting for MariaDB..." until mysql --protocol=TCP -h127.0.0.1 -P3306 -uroot -pkillbill -e "SELECT 1"; do - echo "Waiting for MariaDB..." sleep 5 done -echo "$INSTALL_PLUGINS_CMD" +echo "Waiting for Kill Bill readiness..." -$INSTALL_PLUGINS_CMD +until curl -f http://127.0.0.1:8080/1.0/healthcheck; do + sleep 10 +done -originalfile=$KILLBILL_INSTALL_DIR/config/shiro.ini.template -cat $originalfile | envsubst '${KB_ADMIN_PASSWORD}' > $KILLBILL_INSTALL_DIR/config/shiro.ini +echo "STARTING INSTALL_PLUGINS_CMD" + +$INSTALL_PLUGINS_CMD -exec /usr/share/tomcat/bin/catalina.sh run +wait $TOMCAT_PID From 83412bfcbaa33858ee9589e055b775ebce2df2ea Mon Sep 17 00:00:00 2001 From: Vijay N Date: Wed, 13 May 2026 16:10:10 +0530 Subject: [PATCH 19/25] Updated Dockerfile.template, added db_config_address --- docker/templates/killbill/latest/Dockerfile.template | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/templates/killbill/latest/Dockerfile.template b/docker/templates/killbill/latest/Dockerfile.template index 28704920..905437ac 100644 --- a/docker/templates/killbill/latest/Dockerfile.template +++ b/docker/templates/killbill/latest/Dockerfile.template @@ -69,6 +69,7 @@ ENV INSTALL_PLUGINS_CMD="ansible-playbook $ANSIBLE_OPTS \ -e tomcat_owner=$TOMCAT_OWNER \ -e tomcat_group=$TOMCAT_GROUP \ -e catalina_base=$CATALINA_BASE \ + -e db_config_address=127.0.0.1 \ -e kb_system_properties=-Dcom.killbill.license=$KILLBILL_INSTALL_DIR/config/aws.out \ $KILLBILL_CLOUD_ANSIBLE_ROLES/install_plugins.yml" From d17b143b47d5a497748c42a76540260f4109f29d Mon Sep 17 00:00:00 2001 From: Vijay N Date: Wed, 13 May 2026 16:54:25 +0530 Subject: [PATCH 20/25] Updated Dockerfile.template, passed database variables to INSTALL_PLUGINS_CMD. --- docker/templates/killbill/latest/Dockerfile.template | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/templates/killbill/latest/Dockerfile.template b/docker/templates/killbill/latest/Dockerfile.template index 905437ac..b9f4e4dd 100644 --- a/docker/templates/killbill/latest/Dockerfile.template +++ b/docker/templates/killbill/latest/Dockerfile.template @@ -70,6 +70,9 @@ ENV INSTALL_PLUGINS_CMD="ansible-playbook $ANSIBLE_OPTS \ -e tomcat_group=$TOMCAT_GROUP \ -e catalina_base=$CATALINA_BASE \ -e db_config_address=127.0.0.1 \ + -e db_config_port=3306 \ + -e db_config_user=$KILLBILL_DAO_USER \ + -e db_config_password=$KILLBILL_DAO_PASSWORD \ -e kb_system_properties=-Dcom.killbill.license=$KILLBILL_INSTALL_DIR/config/aws.out \ $KILLBILL_CLOUD_ANSIBLE_ROLES/install_plugins.yml" From fa81997b5216aa52ef250db252d5ea3fc7190c04 Mon Sep 17 00:00:00 2001 From: Vijay N Date: Wed, 13 May 2026 17:29:14 +0530 Subject: [PATCH 21/25] Updated Dockerfile.template, passed database variables to INSTALL_PLUGINS_CMD. --- docker/templates/killbill/latest/Dockerfile.template | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/templates/killbill/latest/Dockerfile.template b/docker/templates/killbill/latest/Dockerfile.template index b9f4e4dd..35ed038d 100644 --- a/docker/templates/killbill/latest/Dockerfile.template +++ b/docker/templates/killbill/latest/Dockerfile.template @@ -71,8 +71,9 @@ ENV INSTALL_PLUGINS_CMD="ansible-playbook $ANSIBLE_OPTS \ -e catalina_base=$CATALINA_BASE \ -e db_config_address=127.0.0.1 \ -e db_config_port=3306 \ - -e db_config_user=$KILLBILL_DAO_USER \ + -e db_config_username=$KILLBILL_DAO_USER \ -e db_config_password=$KILLBILL_DAO_PASSWORD \ + -e db_config_killbill_db_name=killbill \ -e kb_system_properties=-Dcom.killbill.license=$KILLBILL_INSTALL_DIR/config/aws.out \ $KILLBILL_CLOUD_ANSIBLE_ROLES/install_plugins.yml" From b271ecab7622e5ae81fb0e73df5f770d19acf05b Mon Sep 17 00:00:00 2001 From: Vijay N Date: Thu, 14 May 2026 11:25:26 +0530 Subject: [PATCH 22/25] Moved DB variables declaration from INSTALL_PLUGINS_CMD to killbill.sh. --- .../killbill/latest/Dockerfile.template | 5 --- docker/templates/killbill/latest/killbill.sh | 35 +++++++++---------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/docker/templates/killbill/latest/Dockerfile.template b/docker/templates/killbill/latest/Dockerfile.template index 35ed038d..28704920 100644 --- a/docker/templates/killbill/latest/Dockerfile.template +++ b/docker/templates/killbill/latest/Dockerfile.template @@ -69,11 +69,6 @@ ENV INSTALL_PLUGINS_CMD="ansible-playbook $ANSIBLE_OPTS \ -e tomcat_owner=$TOMCAT_OWNER \ -e tomcat_group=$TOMCAT_GROUP \ -e catalina_base=$CATALINA_BASE \ - -e db_config_address=127.0.0.1 \ - -e db_config_port=3306 \ - -e db_config_username=$KILLBILL_DAO_USER \ - -e db_config_password=$KILLBILL_DAO_PASSWORD \ - -e db_config_killbill_db_name=killbill \ -e kb_system_properties=-Dcom.killbill.license=$KILLBILL_INSTALL_DIR/config/aws.out \ $KILLBILL_CLOUD_ANSIBLE_ROLES/install_plugins.yml" diff --git a/docker/templates/killbill/latest/killbill.sh b/docker/templates/killbill/latest/killbill.sh index 7a17b335..6ea82352 100755 --- a/docker/templates/killbill/latest/killbill.sh +++ b/docker/templates/killbill/latest/killbill.sh @@ -2,33 +2,32 @@ set -ex -echo "STARTING KPM INSTALL" - -$KPM_INSTALL_CMD $KILLBILL_CLOUD_ANSIBLE_ROLES/killbill_json_logging.yml - -originalfile=$KILLBILL_INSTALL_DIR/config/shiro.ini.template -cat $originalfile | envsubst '${KB_ADMIN_PASSWORD}' > $KILLBILL_INSTALL_DIR/config/shiro.ini - -echo "Starting Tomcat..." +echo "STARTING INSTALL_PLUGINS_CMD" -/usr/share/tomcat/bin/catalina.sh run & -TOMCAT_PID=$! +# Run both the main playbook and the one enabling structured logging +$KPM_INSTALL_CMD $KILLBILL_CLOUD_ANSIBLE_ROLES/killbill_json_logging.yml -echo "Waiting for MariaDB..." +echo "STARTING INSTALL_PLUGINS_CMD..." until mysql --protocol=TCP -h127.0.0.1 -P3306 -uroot -pkillbill -e "SELECT 1"; do + echo "Waiting for MariaDB..." sleep 5 done -echo "Waiting for Kill Bill readiness..." -until curl -f http://127.0.0.1:8080/1.0/healthcheck; do - sleep 10 -done +INSTALL_PLUGINS_CMD="$INSTALL_PLUGINS_CMD \ + -e db_config_address=127.0.0.1 \ + -e db_config_port=3306 \ + -e db_config_username=$KILLBILL_DAO_USER \ + -e db_config_password=$KILLBILL_DAO_PASSWORD \ + -e db_config_killbill_db_name=killbill" -echo "STARTING INSTALL_PLUGINS_CMD" +echo "$INSTALL_PLUGINS_CMD" -$INSTALL_PLUGINS_CMD +eval "$INSTALL_PLUGINS_CMD" + +originalfile=$KILLBILL_INSTALL_DIR/config/shiro.ini.template +cat $originalfile | envsubst '${KB_ADMIN_PASSWORD}' > $KILLBILL_INSTALL_DIR/config/shiro.ini -wait $TOMCAT_PID +exec /usr/share/tomcat/bin/catalina.sh run From aa145c40349c31086e4f26c89b344543962ce06e Mon Sep 17 00:00:00 2001 From: Vijay N Date: Fri, 15 May 2026 00:53:12 +0530 Subject: [PATCH 23/25] Moved setup_plugin_ddl.sh.j2 to /roles/killbill to fix file not found error during AMI creation. --- ansible/{templates => roles}/killbill/setup_plugin_ddl.sh.j2 | 0 ansible/roles/killbill/tasks/install_plugins.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename ansible/{templates => roles}/killbill/setup_plugin_ddl.sh.j2 (100%) diff --git a/ansible/templates/killbill/setup_plugin_ddl.sh.j2 b/ansible/roles/killbill/setup_plugin_ddl.sh.j2 similarity index 100% rename from ansible/templates/killbill/setup_plugin_ddl.sh.j2 rename to ansible/roles/killbill/setup_plugin_ddl.sh.j2 diff --git a/ansible/roles/killbill/tasks/install_plugins.yml b/ansible/roles/killbill/tasks/install_plugins.yml index 38353ffd..217f4fd3 100644 --- a/ansible/roles/killbill/tasks/install_plugins.yml +++ b/ansible/roles/killbill/tasks/install_plugins.yml @@ -6,7 +6,7 @@ - name: Generate plugin ddl setup script become: true ansible.builtin.template: - src: "killbill/setup_plugin_ddl.sh.j2" + src: "setup_plugin_ddl.sh.j2" dest: "{{ tomcat_home }}/bin/setup_plugin_ddl.sh" mode: u=rwx,g=r,o=r owner: "{{ tomcat_owner }}" From 396b644442c3eb3f4b6c015b5e73dc9b72ce94df Mon Sep 17 00:00:00 2001 From: Vijay N Date: Thu, 21 May 2026 19:38:15 +0530 Subject: [PATCH 24/25] * Rolled back repo name to killbill. * Removed logging that could reveal DB credentials. --- docker/Makefile | 2 +- docker/templates/base/latest/Dockerfile | 2 +- docker/templates/killbill/latest/killbill.sh | 12 ++---------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/docker/Makefile b/docker/Makefile index 0e0005be..32152bf5 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -23,7 +23,7 @@ all: build build: @echo "Building image $(IMAGE) for version $(VERSION) from template $(TEMPLATE) with parent $(PARENT_VERSION)" $(DOCKER_TEMPLATE) -p $(PARENT_VERSION) -v $(VERSION) -t $(TARGET) -i - $(DOCKER) build --no-cache -t $(IMAGE) $(TEMPLATE) + $(DOCKER) build -t $(IMAGE) $(TEMPLATE) $(DOCKER_TEMPLATE) -t $(TARGET) -c rebuild: diff --git a/docker/templates/base/latest/Dockerfile b/docker/templates/base/latest/Dockerfile index f8bd7691..cd174252 100644 --- a/docker/templates/base/latest/Dockerfile +++ b/docker/templates/base/latest/Dockerfile @@ -57,7 +57,7 @@ WORKDIR $TOMCAT_HOME # Install ansible roles dependencies ARG KILLBILL_CLOUD_VERSION RUN ansible-galaxy collection install community.general && \ - ansible-galaxy install git+https://git@github.com/vnandwana/killbill-cloud.git,$KILLBILL_CLOUD_VERSION + ansible-galaxy install git+https://git@github.com/killbill/killbill-cloud.git,$KILLBILL_CLOUD_VERSION ENV KILLBILL_CLOUD_ANSIBLE_ROLES=$TOMCAT_HOME/.ansible/roles/killbill-cloud/ansible ENV ENV_HOST_IP=localhost ENV ANSIBLE_OPTS="-i localhost, \ diff --git a/docker/templates/killbill/latest/killbill.sh b/docker/templates/killbill/latest/killbill.sh index 6ea82352..b65b3ef2 100755 --- a/docker/templates/killbill/latest/killbill.sh +++ b/docker/templates/killbill/latest/killbill.sh @@ -2,20 +2,16 @@ set -ex -echo "STARTING INSTALL_PLUGINS_CMD" - +echo "Installing plugins..." # Run both the main playbook and the one enabling structured logging $KPM_INSTALL_CMD $KILLBILL_CLOUD_ANSIBLE_ROLES/killbill_json_logging.yml -echo "STARTING INSTALL_PLUGINS_CMD..." - until mysql --protocol=TCP -h127.0.0.1 -P3306 -uroot -pkillbill -e "SELECT 1"; do - echo "Waiting for MariaDB..." + echo "Waiting for DB..." sleep 5 done - INSTALL_PLUGINS_CMD="$INSTALL_PLUGINS_CMD \ -e db_config_address=127.0.0.1 \ -e db_config_port=3306 \ @@ -23,10 +19,6 @@ INSTALL_PLUGINS_CMD="$INSTALL_PLUGINS_CMD \ -e db_config_password=$KILLBILL_DAO_PASSWORD \ -e db_config_killbill_db_name=killbill" -echo "$INSTALL_PLUGINS_CMD" - -eval "$INSTALL_PLUGINS_CMD" - originalfile=$KILLBILL_INSTALL_DIR/config/shiro.ini.template cat $originalfile | envsubst '${KB_ADMIN_PASSWORD}' > $KILLBILL_INSTALL_DIR/config/shiro.ini From 213583f4badcb09d25a172b386a0bc8d887b65ac Mon Sep 17 00:00:00 2001 From: Vijay N Date: Thu, 21 May 2026 21:04:08 +0530 Subject: [PATCH 25/25] Addressed lint error. --- ansible/roles/killbill/tasks/install_plugins.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/killbill/tasks/install_plugins.yml b/ansible/roles/killbill/tasks/install_plugins.yml index 217f4fd3..5f44cb80 100644 --- a/ansible/roles/killbill/tasks/install_plugins.yml +++ b/ansible/roles/killbill/tasks/install_plugins.yml @@ -32,4 +32,4 @@ creates: "{{ kb_plugins_dir }}/plugins/java/braintree-plugin" tags: - braintree - - plugins \ No newline at end of file + - plugins