From ffa2a169ea98fb54a29d90ca158059e79e2816ba Mon Sep 17 00:00:00 2001 From: Carlos Konstanski Date: Mon, 13 Nov 2017 16:50:55 -0700 Subject: initial commit --- .../etc/openbook/database/bin/fix_permissions.sh | 39 + .../etc/openbook/database/bin/start_galera_node.sh | 13 + .../etc/openbook/database/conf.d/cluster.cnf | 17 + .../etc/openbook/database/conf.d/debconfrc | 2 + .../openbook/database/create_openbook_schemas.sql | 2538 ++++++++++++++++++++ .../database/etc/openbook/database/debian.cnf | 11 + 6 files changed, 2620 insertions(+) create mode 100755 templates/database/etc/openbook/database/bin/fix_permissions.sh create mode 100755 templates/database/etc/openbook/database/bin/start_galera_node.sh create mode 100644 templates/database/etc/openbook/database/conf.d/cluster.cnf create mode 100644 templates/database/etc/openbook/database/conf.d/debconfrc create mode 100644 templates/database/etc/openbook/database/create_openbook_schemas.sql create mode 100644 templates/database/etc/openbook/database/debian.cnf (limited to 'templates/database/etc/openbook') diff --git a/templates/database/etc/openbook/database/bin/fix_permissions.sh b/templates/database/etc/openbook/database/bin/fix_permissions.sh new file mode 100755 index 0000000..69f2b75 --- /dev/null +++ b/templates/database/etc/openbook/database/bin/fix_permissions.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +sed -e 's|{{ "{{" }} openbook_database_password {{ "}}" }}|{{ openbook_database_password }}|g' -i /root/.my.cnf + +# wait for mysql to start +for i in {120..0}; do + if echo 'SELECT 1' | mysql &>/dev/null; then + break + fi + sleep 1 +done + +# privilege fixes - must be idempotent! +mysql < curdate() */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_current_host_attributes`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_current_host_attributes` AS select `tha1`.`host_id` AS `host_id`,`tha1`.`update_date` AS `update_date`,`tha1`.`ram_mb` AS `ram_mb`,`tha1`.`ram_mb_used` AS `ram_mb_used`,`tha1`.`disk_gb` AS `disk_gb`,`tha1`.`disk_gb_used` AS `disk_gb_used`,`tha1`.`vcpus` AS `vcpus`,`tha1`.`vcpus_used` AS `vcpus_used`,`tha1`.`vm_count` AS `vm_count`,`tha1`.`socket_count` AS `socket_count` from `t_host_attributes` `tha1` where `tha1`.`update_date` = (select max(`t_host_attributes`.`update_date`) from `t_host_attributes` where `t_host_attributes`.`host_id` = `tha1`.`host_id`) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_customer`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_customer` AS select `c`.`customer_id` AS `customer_id`,`c`.`customer_name` AS `customer_name`,`c`.`metadata` AS `metadata`,`c`.`tax_rate` AS `tax_rate`,`c`.`currency` AS `currency`,`c`.`discount_percent` AS `discount_percent`,`c`.`billing_frequency` AS `billing_frequency`,`c`.`last_bill_date` AS `last_bill_date`,`c`.`next_bill_date` AS `next_bill_date`,`c`.`is_active` AS `is_active`,`c`.`create_date` AS `create_date`,`c`.`activate_date` AS `activate_date`,`c`.`billing_start_date` AS `billing_start_date`,`c`.`last_payment_date` AS `last_payment_date`,`c`.`deactivate_date` AS `deactivate_date`,`c`.`description` AS `description`,`c`.`minimum_invoice_commitment` AS `minimum_invoice_commitment`,`c`.`invoicing_method` AS `invoicing_method`,`c`.`management_region_id` AS `management_region_id`,`c`.`billing_address_line_1` AS `billing_address_line_1`,`c`.`billing_address_line_2` AS `billing_address_line_2`,`c`.`billing_address_city` AS `billing_address_city`,`c`.`billing_address_region` AS `billing_address_region`,`c`.`billing_address_country` AS `billing_address_country`,`c`.`billing_address_postal_code` AS `billing_address_postal_code`,`c`.`payer_payment_details` AS `payer_payment_details`,`c`.`payment_method_confirmed` AS `payment_method_confirmed`,`c`.`balance_due` AS `balance_due`,`c`.`spend_soft_limit` AS `spend_soft_limit`,`c`.`spend_hard_limit` AS `spend_hard_limit`,`c`.`terms_and_conditions_2_accept_date` AS `terms_and_conditions_2_accept_date`,`c`.`tax_id` AS `tax_id`,`c`.`registration_number` AS `registration_number`,`r1`.`region_name` AS `management_region_name` from (`t_customer` `c` left join `t_region` `r1` on(`c`.`management_region_id` = `r1`.`region_id`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_metric`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_metric` AS select `m`.`metric_id` AS `metric_id`,`m`.`service_manager_type_id` AS `service_manager_type_id`,`m`.`metric_name` AS `metric_name`,`m`.`metric_label` AS `metric_label`,`m`.`metric_source` AS `metric_source`,`m`.`metric_type` AS `metric_type`,`m`.`metric_unit` AS `metric_unit`,`m`.`entity_resolution` AS `entity_resolution`,`m`.`time_resolution` AS `time_resolution`,`sm`.`service_manager_type` AS `service_manager_type` from (`t_metric` `m` left join `t_service_manager_type` `sm` on(`m`.`service_manager_type_id` = `sm`.`service_manager_type_id`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_promo_code_redemption`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_promo_code_redemption` AS select `p`.`management_region_id` AS `management_region_id`,`p`.`promo_code_id` AS `promo_code_id`,`p`.`promo_code` AS `promo_code`,`p`.`salesperson` AS `salesperson`,`p`.`discount_or_credit` AS `discount_or_credit`,`p`.`credit_amount` AS `credit_amount`,`p`.`credit_type` AS `credit_type`,`p`.`apply_to_charge_category` AS `apply_to_charge_category`,`p`.`trigger_charge_category` AS `trigger_charge_category`,`p`.`trigger_amount` AS `trigger_amount`,`p`.`discount_percent` AS `discount_percent`,`p`.`available_invoice_periods` AS `available_invoice_periods`,`p`.`expire_date` AS `expire_date`,`p`.`currency` AS `currency`,`r`.`redemption_date` AS `redemption_date`,`c`.`customer_id` AS `customer_id`,`c`.`customer_name` AS `customer_name` from ((`t_promo_code_redemption` `r` join `t_customer` `c`) join `t_promo_code` `p`) where `r`.`payer_type` = 'Customer' and `r`.`payer_id` = `c`.`customer_id` and `p`.`promo_code_id` = `r`.`promo_code_id` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_provider`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_provider` AS select `t_provider`.`provider_id` AS `provider_id`,`t_provider`.`provider_name` AS `provider_name`,`t_provider`.`provider_type` AS `provider_type`,`t_provider`.`metadata` AS `metadata`,`t_provider`.`tax_rate` AS `tax_rate`,`t_provider`.`currency` AS `currency`,`t_provider`.`discount_percent` AS `discount_percent`,`t_provider`.`billing_frequency` AS `billing_frequency`,`t_provider`.`last_bill_date` AS `last_bill_date`,`t_provider`.`next_bill_date` AS `next_bill_date`,`t_provider`.`last_payment_date` AS `last_payment_date`,`t_provider`.`is_active` AS `is_active`,`t_provider`.`create_date` AS `create_date`,`t_provider`.`activate_date` AS `activate_date`,`t_provider`.`billing_start_date` AS `billing_start_date`,`t_provider`.`deactivate_date` AS `deactivate_date`,`t_provider`.`description` AS `description`,`t_provider`.`minimum_invoice_commitment` AS `minimum_invoice_commitment`,`t_provider`.`invoicing_method` AS `invoicing_method`,`t_provider`.`invoice_processing_method` AS `invoice_processing_method`,`t_provider`.`billing_address_line_1` AS `billing_address_line_1`,`t_provider`.`billing_address_line_2` AS `billing_address_line_2`,`t_provider`.`billing_address_city` AS `billing_address_city`,`t_provider`.`billing_address_region` AS `billing_address_region`,`t_provider`.`billing_address_country` AS `billing_address_country`,`t_provider`.`billing_address_postal_code` AS `billing_address_postal_code`,`t_provider`.`legal_address_line_1` AS `legal_address_line_1`,`t_provider`.`legal_address_line_2` AS `legal_address_line_2`,`t_provider`.`legal_address_city` AS `legal_address_city`,`t_provider`.`legal_address_region` AS `legal_address_region`,`t_provider`.`legal_address_country` AS `legal_address_country`,`t_provider`.`legal_address_postal_code` AS `legal_address_postal_code`,`t_provider`.`payer_payment_details` AS `payer_payment_details`,`t_provider`.`payee_payment_details` AS `payee_payment_details`,`t_provider`.`public_url` AS `public_url`,`t_provider`.`management_region_id` AS `management_region_id`,`t_provider`.`balance_due` AS `balance_due`,`t_provider`.`openbook_processes_payments` AS `openbook_processes_payments`,`t_provider`.`openbook_processes_past_due_invoices` AS `openbook_processes_past_due_invoices`,`t_provider`.`openstack_tenant_id` AS `openstack_tenant_id`,`t_provider`.`tax_id` AS `tax_id`,`t_provider`.`registration_number` AS `registration_number`,`t_provider`.`os_service_manager_id` AS `os_service_manager_id`,`t_region`.`parent_region_id` AS `parent_management_region_id` from (`t_provider` left join `t_region` on(`t_region`.`region_id` = `t_provider`.`management_region_id`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_rate_plan_assignment`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_rate_plan_assignment` AS select `a`.`rate_plan_id` AS `rate_plan_id`,`a`.`assignee_id` AS `assignee_id`,`a`.`assignee_type` AS `assignee_type`,`a`.`assignment_start_date` AS `assignment_start_date`,`a`.`assignment_end_date` AS `assignment_end_date`,`a`.`assignment_type` AS `assignment_type`,`r`.`management_region_id` AS `management_region_id` from (`t_rate_plan_assignment` `a` left join `t_rate_plan` `r` on(`a`.`rate_plan_id` = `r`.`rate_plan_id`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_service`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_service` AS select `s`.`service_id` AS `service_id`,`s`.`service_type` AS `service_type`,`s`.`service_description` AS `service_description`,`s`.`service_manager_type_id` AS `service_manager_type_id`,`s`.`states` AS `states`,`s`.`externally_managed` AS `externally_managed`,`sm`.`service_manager_type` AS `service_manager_type` from (`t_service` `s` left join `t_service_manager_type` `sm` on(`s`.`service_manager_type_id` = `sm`.`service_manager_type_id`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_service_instance`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_service_instance` AS select `tsi`.`service_instance_id` AS `service_instance_id`,`tsi`.`service_id` AS `service_id`,`tsi`.`service_instance_name` AS `service_instance_name`,`tsi`.`service_manager_id` AS `service_manager_id`,`tsi`.`service_region_id` AS `service_region_id`,`tsi`.`service_instance_foreign_id` AS `service_instance_foreign_id`,`tsi`.`tenant_id` AS `tenant_id`,`tsi`.`current_attributes` AS `current_attributes`,`tt`.`tenant_name` AS `tenant_name`,`tt`.`tenant_foreign_id` AS `tenant_foreign_id`,`tt`.`customer_id` AS `customer_id`,`tc`.`customer_name` AS `customer_name`,`tc`.`management_region_id` AS `management_region_id`,`tsm`.`service_manager_name` AS `service_manager_name`,`tr`.`region_name` AS `service_region_name`,`tsmt`.`service_manager_type` AS `service_manager_type`,`ts`.`service_type` AS `service_type`,`tsis`.`start_date` AS `provisioned_date`,`tsis`.`end_date` AS `deprovisioned_date` from (((((((`t_service_instance` `tsi` left join `t_tenant` `tt` on(`tsi`.`tenant_id` = `tt`.`tenant_id`)) left join `t_customer` `tc` on(`tc`.`customer_id` = `tt`.`customer_id`)) left join `t_service` `ts` on(`tsi`.`service_id` = `ts`.`service_id`)) left join `t_service_manager_type` `tsmt` on(`ts`.`service_manager_type_id` = `tsmt`.`service_manager_type_id`)) left join `t_region` `tr` on(`tsi`.`service_region_id` = `tr`.`region_id`)) left join `t_service_manager` `tsm` on(`tsi`.`service_manager_id` = `tsm`.`service_manager_id`)) left join `t_service_instance_state` `tsis` on(`tsi`.`service_instance_id` = `tsis`.`service_instance_id` and `tsis`.`state` = 'In Existence')) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_service_instance_attributes`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_service_instance_attributes` AS select `tpsa`.`service_instance_id` AS `service_instance_id`,`tpsa`.`start_date` AS `start_date`,`tpsa`.`end_date` AS `end_date`,`tpsa`.`attributes` AS `attributes`,`tt`.`tenant_id` AS `tenant_id`,`tt`.`tenant_foreign_id` AS `tenant_foreign_id`,`tt`.`tenant_name` AS `tenant_name`,`tc`.`customer_id` AS `customer_id`,`tc`.`customer_name` AS `customer_name`,`tc`.`management_region_id` AS `management_region_id`,`tps`.`service_instance_name` AS `service_instance_name`,`tps`.`service_instance_foreign_id` AS `service_instance_foreign_id`,`tps`.`service_manager_id` AS `service_manager_id`,`tsm`.`service_manager_name` AS `service_manager_name`,`ts`.`service_id` AS `service_id`,`ts`.`service_type` AS `service_type`,`tsmt`.`service_manager_type` AS `service_manager_type`,`tr`.`region_id` AS `service_region_id`,`tr`.`region_name` AS `service_region_name` from (((((((`t_service_instance_attributes` `tpsa` left join `t_service_instance` `tps` on(`tps`.`service_instance_id` = `tpsa`.`service_instance_id`)) left join `t_service` `ts` on(`ts`.`service_id` = `tps`.`service_id`)) left join `t_service_manager` `tsm` on(`tsm`.`service_manager_id` = `tps`.`service_manager_id`)) left join `t_region` `tr` on(`tps`.`service_region_id` = `tr`.`region_id`)) left join `t_service_manager_type` `tsmt` on(`ts`.`service_manager_type_id` = `tsmt`.`service_manager_type_id`)) left join `t_tenant` `tt` on(`tps`.`tenant_id` = `tt`.`tenant_id`)) left join `t_customer` `tc` on(`tt`.`customer_id` = `tc`.`customer_id`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_service_instance_state`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_service_instance_state` AS select `tpss`.`service_instance_id` AS `service_instance_id`,`tpss`.`state` AS `state`,`tpss`.`start_date` AS `start_date`,`tpss`.`end_date` AS `end_date`,`tpss`.`interval_length_milliseconds` AS `interval_length_milliseconds`,`tt`.`tenant_id` AS `tenant_id`,`tt`.`tenant_foreign_id` AS `tenant_foreign_id`,`tt`.`tenant_name` AS `tenant_name`,`tc`.`customer_id` AS `customer_id`,`tc`.`customer_name` AS `customer_name`,`tc`.`management_region_id` AS `management_region_id`,`tps`.`service_instance_name` AS `service_instance_name`,`tps`.`service_instance_foreign_id` AS `service_instance_foreign_id`,`tps`.`service_manager_id` AS `service_manager_id`,`tsm`.`service_manager_name` AS `service_manager_name`,`ts`.`service_id` AS `service_id`,`ts`.`service_type` AS `service_type`,`tsmt`.`service_manager_type` AS `service_manager_type`,`tr`.`region_id` AS `service_region_id`,`tr`.`region_name` AS `service_region_name` from (((((((`t_service_instance_state` `tpss` left join `t_service_instance` `tps` on(`tps`.`service_instance_id` = `tpss`.`service_instance_id`)) left join `t_service` `ts` on(`ts`.`service_id` = `tps`.`service_id`)) left join `t_service_manager` `tsm` on(`tsm`.`service_manager_id` = `tps`.`service_manager_id`)) left join `t_region` `tr` on(`tps`.`service_region_id` = `tr`.`region_id`)) left join `t_service_manager_type` `tsmt` on(`ts`.`service_manager_type_id` = `tsmt`.`service_manager_type_id`)) left join `t_tenant` `tt` on(`tps`.`tenant_id` = `tt`.`tenant_id`)) left join `t_customer` `tc` on(`tt`.`customer_id` = `tc`.`customer_id`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_service_manager`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_service_manager` AS select `tsm`.`service_manager_id` AS `service_manager_id`,`tsm`.`service_manager_name` AS `service_manager_name`,`tsm`.`service_manager_description` AS `service_manager_description`,`tsm`.`metadata` AS `metadata`,`tsm`.`service_region_id` AS `service_region_id`,`tsm`.`service_manager_type_id` AS `service_manager_type_id`,`tsmt`.`service_manager_type` AS `service_manager_type` from (`t_service_manager` `tsm` left join `t_service_manager_type` `tsmt` on(`tsm`.`service_manager_type_id` = `tsmt`.`service_manager_type_id`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_tenant`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`openbook`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_tenant` AS select `t`.`tenant_id` AS `tenant_id`,`t`.`tenant_name` AS `tenant_name`,`t`.`tenant_foreign_id` AS `tenant_foreign_id`,`t`.`create_date` AS `create_date`,`t`.`deactivate_date` AS `deactivate_date`,`t`.`customer_id` AS `customer_id`,`t`.`service_manager_id` AS `service_manager_id`,`t`.`is_active` AS `is_active`,`c`.`customer_name` AS `customer_name`,`c`.`management_region_id` AS `management_region_id`,`tsmt`.`service_manager_type` AS `service_manager_type` from (((`t_tenant` `t` left join `t_customer` `c` on(`t`.`customer_id` = `c`.`customer_id`)) left join `t_service_manager` `tsm` on(`t`.`service_manager_id` = `tsm`.`service_manager_id`)) left join `t_service_manager_type` `tsmt` on(`tsm`.`service_manager_type_id` = `tsmt`.`service_manager_type_id`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v_users`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_users` AS select `u`.`user_id` AS `user_id`,`u`.`username` AS `username`,`u`.`first_name` AS `first_name`,`u`.`last_name` AS `last_name`,`u`.`email_address` AS `email_address`,`u`.`phone_number` AS `phone_number`,`u`.`password` AS `password`,`u`.`is_active` AS `is_active`,`u`.`password_change_token` AS `password_change_token`,`u`.`last_password_change_date` AS `last_password_change_date`,`u`.`password_change_token_expire_date` AS `password_change_token_expire_date`,`r`.`role_name` AS `role_name`,`r`.`role_context` AS `role_context` from (`t_users` `u` left join `t_user_roles` `r` on(`u`.`user_id` = `r`.`user_id`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +GRANT ALL PRIVILEGES ON openbook_jobs.* TO openbook_jobs@'%' IDENTIFIED BY '{{ openbook_database_password }}'; +GRANT ALL PRIVILEGES ON openbook_jobs.* TO openbook_jobs@localhost IDENTIFIED BY '{{ openbook_database_password }}'; +USE `openbook_jobs`; +GRANT ALL PRIVILEGES ON openbook_workflow.* TO openbook_workflow@'%' IDENTIFIED BY '{{ openbook_database_password }}'; +GRANT ALL PRIVILEGES ON openbook_workflow.* TO openbook_workflow@localhost IDENTIFIED BY '{{ openbook_database_password }}'; +USE `openbook_workflow`; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +use openbook; +CALL p_preallocate_partitions('t_metric_values', 'metric_datetime', CURDATE(), 31); +CALL p_preallocate_partitions('t_metric_aggregate_resource_hourly', 'aggregate_datetime', CURDATE(), 31); +CALL p_preallocate_partitions('t_metric_aggregate_tenant_hourly', 'aggregate_datetime', CURDATE(), 31); +CALL p_preallocate_partitions('t_metric_aggregate_customer_hourly', 'aggregate_datetime', CURDATE(), 31); +CALL p_preallocate_partitions('t_metric_aggregate_resource_daily', 'aggregate_datetime', CURDATE(), 31); +CALL p_preallocate_partitions('t_metric_aggregate_tenant_daily', 'aggregate_datetime', CURDATE(), 31); +CALL p_preallocate_partitions('t_metric_aggregate_customer_daily', 'aggregate_datetime', CURDATE(), 31); diff --git a/templates/database/etc/openbook/database/debian.cnf b/templates/database/etc/openbook/database/debian.cnf new file mode 100644 index 0000000..c4c3297 --- /dev/null +++ b/templates/database/etc/openbook/database/debian.cnf @@ -0,0 +1,11 @@ +[client] +host = localhost +user = debian-sys-maint +password = {{ openbook_database_password }} +socket = /var/run/mysqld/mysqld.sock +[mysql_upgrade] +host = localhost +user = debian-sys-maint +password = {{ openbook_database_password }} +socket = /var/run/mysqld/mysqld.sock +basedir = /usr -- cgit v1.3