From ffa2a169ea98fb54a29d90ca158059e79e2816ba Mon Sep 17 00:00:00 2001 From: Carlos Konstanski Date: Mon, 13 Nov 2017 16:50:55 -0700 Subject: initial commit --- .../admin-api-server/admin-api-server.json | 21 + templates/admin_api_server/run.sh | 4 + .../etc/openbook/admin-web-ui/admin-web-ui.json | 9 + templates/admin_web_ui/run.sh | 4 + templates/ci/openbook.gentoo | 25 + templates/ci/openbook.redhat | 29 + templates/ci/openbook.ubuntu | 25 + templates/ci/openbookctl | 114 + .../customer-api-server/customer-api-server.json | 21 + templates/customer_api_server/run.sh | 4 + .../openbook/customer-web-ui/customer-web-ui.json | 9 + templates/customer_web_ui/run.sh | 4 + .../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 + templates/database/root/.my.cnf | 6 + templates/database/run.sh | 23 + .../job-scheduler-server/job-scheduler-server.json | 19 + templates/job_scheduler_server/run.sh | 4 + templates/registry.conf | 39 + .../openbook/workflow-server/workflow-server.json | 19 + templates/workflow_server/run.sh | 4 + 25 files changed, 3003 insertions(+) create mode 100644 templates/admin_api_server/etc/openbook/admin-api-server/admin-api-server.json create mode 100755 templates/admin_api_server/run.sh create mode 100644 templates/admin_web_ui/etc/openbook/admin-web-ui/admin-web-ui.json create mode 100755 templates/admin_web_ui/run.sh create mode 100755 templates/ci/openbook.gentoo create mode 100755 templates/ci/openbook.redhat create mode 100755 templates/ci/openbook.ubuntu create mode 100755 templates/ci/openbookctl create mode 100644 templates/customer_api_server/etc/openbook/customer-api-server/customer-api-server.json create mode 100755 templates/customer_api_server/run.sh create mode 100644 templates/customer_web_ui/etc/openbook/customer-web-ui/customer-web-ui.json create mode 100755 templates/customer_web_ui/run.sh 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 create mode 100644 templates/database/root/.my.cnf create mode 100755 templates/database/run.sh create mode 100644 templates/job_scheduler_server/etc/openbook/job-scheduler-server/job-scheduler-server.json create mode 100755 templates/job_scheduler_server/run.sh create mode 100644 templates/registry.conf create mode 100644 templates/workflow_server/etc/openbook/workflow-server/workflow-server.json create mode 100755 templates/workflow_server/run.sh (limited to 'templates') diff --git a/templates/admin_api_server/etc/openbook/admin-api-server/admin-api-server.json b/templates/admin_api_server/etc/openbook/admin-api-server/admin-api-server.json new file mode 100644 index 0000000..2faa9c8 --- /dev/null +++ b/templates/admin_api_server/etc/openbook/admin-api-server/admin-api-server.json @@ -0,0 +1,21 @@ + +{% set ips = openbook_gcomm_addresses.split(",") %} +{% if ips|length > 1 %} +{% set failover = "failover:" %} +{% else %} +{% set failover = "" %} +{% endif %} + + +{ + "log.path": "/var/log/openbook/admin-api-server/admin-api-server.log" + +{% if "True" == openbook_install_admin_api_server|string() %} + ,"entityDS.url": "jdbc:mariadb:{{ failover }}//{{ openbook_gcomm_addresses }}/openbook" + ,"workflowDS.url": "jdbc:mariadb:{{ failover }}//{{ openbook_gcomm_addresses }}/openbook_workflow" + ,"jobsDS.url": "jdbc:mariadb:{{ failover }}//{{ openbook_gcomm_addresses }}/openbook_jobs" + ,"application.port": {{ openbook_admin_api_server_port }} + ,"cluster.interfaces": ["{{ ansible_default_ipv4.address }}"] +{% endif %} + +} diff --git a/templates/admin_api_server/run.sh b/templates/admin_api_server/run.sh new file mode 100755 index 0000000..8270ff3 --- /dev/null +++ b/templates/admin_api_server/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker run -d --rm --net=host -p {{ openbook_admin_api_server_port }}:8083 -p 5701:5701 -p 5702:5702 -v /etc/openbook/admin-api-server:/etc/openbook/admin-api-server -v /var/log/openbook/admin-api-server:/var/log/openbook/admin-api-server --name admin_api_server_unstable openbook-docker-registry.verizoncloudplatform.com/openbook_admin_api_server_unstable +exit 0 diff --git a/templates/admin_web_ui/etc/openbook/admin-web-ui/admin-web-ui.json b/templates/admin_web_ui/etc/openbook/admin-web-ui/admin-web-ui.json new file mode 100644 index 0000000..c05e4f8 --- /dev/null +++ b/templates/admin_web_ui/etc/openbook/admin-web-ui/admin-web-ui.json @@ -0,0 +1,9 @@ +{ + "log.path": "/var/log/openbook/admin-web-ui/admin-web-ui.log" + +{% if "True" == openbook_install_admin_web_ui|string() %} + ,"application.port": {{ openbook_admin_web_ui_port }} + ,"cluster.interfaces": ["{{ ansible_default_ipv4.address }}"] +{% endif %} + +} diff --git a/templates/admin_web_ui/run.sh b/templates/admin_web_ui/run.sh new file mode 100755 index 0000000..51082d4 --- /dev/null +++ b/templates/admin_web_ui/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker run -d --rm --net=host -p {{ openbook_admin_web_ui_port }}:8082 -p 5701:5701 -p 5702:5702 -v /etc/openbook/admin-web-ui:/etc/openbook/admin-web-ui -v /var/log/openbook/admin-web-ui:/var/log/openbook/admin-web-ui --name admin_web_ui_unstable openbook-docker-registry.verizoncloudplatform.com/openbook_admin_web_ui_unstable +exit 0 diff --git a/templates/ci/openbook.gentoo b/templates/ci/openbook.gentoo new file mode 100755 index 0000000..430d70d --- /dev/null +++ b/templates/ci/openbook.gentoo @@ -0,0 +1,25 @@ +#!/sbin/openrc-run + +extra_commands=test_database + +depend() { + need docker +} + +start() { + ebegin "Starting Openbook" + /opt/openbook/openbookctl start + eend $? +} + +stop() { + ebegin "Stopping Openbook" + /opt/openbook/openbookctl stop + eend $? +} + +test_database() { + ebegin "Testing database" + /opt/openbook/openbookctl test_database + eend $? +} diff --git a/templates/ci/openbook.redhat b/templates/ci/openbook.redhat new file mode 100755 index 0000000..c4d3040 --- /dev/null +++ b/templates/ci/openbook.redhat @@ -0,0 +1,29 @@ +#!/bin/bash + +# openbook +# +# chkconfig: 2345 10 90 +# description: Manage the Openbook application +# +### BEGIN INIT INFO +# Provides: openbook +# Required-Start: docker +# Required-Stop: docker +# Short-Description: Bring up/down networking +# Description: Manage the Openbook application +### END INIT INFO + +case $1 in + start*) + /opt/openbook/openbookctl start + ;; + stop*) + /opt/openbook/openbookctl stop + ;; + test_database*) + /opt/openbook/openbookctl test_database + ;; + *) + /opt/openbook/openbookctl help + ;; +esac diff --git a/templates/ci/openbook.ubuntu b/templates/ci/openbook.ubuntu new file mode 100755 index 0000000..02900fa --- /dev/null +++ b/templates/ci/openbook.ubuntu @@ -0,0 +1,25 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: openbook +# Required-Start: docker +# Required-Stop: docker +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Manage the Openbook application +### END INIT INFO + +case $1 in + start*) + /opt/openbook/openbookctl start + ;; + stop*) + /opt/openbook/openbookctl stop + ;; + test_database*) + /opt/openbook/openbookctl test_database + ;; + *) + /opt/openbook/openbookctl help + ;; +esac diff --git a/templates/ci/openbookctl b/templates/ci/openbookctl new file mode 100755 index 0000000..0563a16 --- /dev/null +++ b/templates/ci/openbookctl @@ -0,0 +1,114 @@ +#!/bin/bash + +echo 'mysql root password: {{ openbook_database_password }}' +echo 'wsrep_node_address: {{ ansible_default_ipv4.address }}' +echo 'wsrep_cluster_address: gcomm://{{ openbook_gcomm_addresses }}' + +{% if "True" == openbook_install_database|string() %} +wait_for_database() { + echo "Waiting for database to start..." + started=1 + for i in {120..0}; do + if echo 'SELECT 1' | mysql -h 127.0.0.1 -u root --password='{{ openbook_database_password }}' &>/dev/null; then + started=0 + break + fi + sleep 1 + done + if [ $started -eq 1 ]; then + echo "Error: database did not start." + exit 1 + fi +} + +ensure_openbook_databases_created() { + if ! echo "SHOW DATABASES;" | mysql -h 127.0.0.1 -u root --password='{{ openbook_database_password }}' 2>/dev/null | fgrep 'openbook'; then + echo "Creating Openbook schema..." + mysql -h 127.0.0.1 -u root --password='{{ openbook_database_password }}' &>/dev/null < /etc/openbook/database/create_openbook_schemas.sql + fi +} +{% endif %} + +do_start() { +{% if "True" == openbook_install_database|string() %} + chmod 777 /var/lib/mysql + chmod 777 /var/log/mysql + /opt/openbook/database/run.sh + wait_for_database + ensure_openbook_databases_created +{% endif %} +{% if "True" == openbook_install_job_scheduler_server|string() %} + /opt/openbook/job_scheduler_server/run.sh +{% endif %} +{% if "True" == openbook_install_workflow_server|string() %} + /opt/openbook/workflow_server/run.sh +{% endif %} +{% if "True" == openbook_install_admin_api_server|string() %} + /opt/openbook/admin_api_server/run.sh +{% endif %} +{% if "True" == openbook_install_customer_api_server|string() %} + /opt/openbook/customer_api_server/run.sh +{% endif %} +{% if "True" == openbook_install_admin_web_ui|string() %} + /opt/openbook/admin_web_ui/run.sh +{% endif %} +{% if "True" == openbook_install_customer_web_ui|string() %} + /opt/openbook/customer_web_ui/run.sh +{% endif %} + echo + echo "Openbook started. All components may not be fully initialized and available." +} + +do_stop() { +{% if "True" == openbook_install_customer_web_ui|string() %} + docker stop customer_web_ui_unstable +{% endif %} +{% if "True" == openbook_install_admin_web_ui|string() %} + docker stop admin_web_ui_unstable +{% endif %} +{% if "True" == openbook_install_customer_api_server|string() %} + docker stop customer_api_server_unstable +{% endif %} +{% if "True" == openbook_install_admin_api_server|string() %} + docker stop admin_api_server_unstable +{% endif %} +{% if "True" == openbook_install_workflow_server|string() %} + docker stop workflow_server_unstable +{% endif %} +{% if "True" == openbook_install_job_scheduler_server|string() %} + docker stop job_scheduler_server_unstable +{% endif %} +{% if "True" == openbook_install_database|string() %} + docker stop database +{% endif %} + docker container prune -f +} + +do_help() { + echo "Usage:" + echo " $0 start" + echo " $0 stop" +{% if "True" == openbook_install_database|string() %} + echo " $0 test_database" +{% endif %} +} + +case $1 in + start*) + do_start + ;; + stop*) + do_stop + ;; +{% if "True" == openbook_install_database|string() %} + test_database*) + wait_for_database + echo "Database is up." + ;; +{% endif %} + *) + do_help + ;; +esac + +exit 0 diff --git a/templates/customer_api_server/etc/openbook/customer-api-server/customer-api-server.json b/templates/customer_api_server/etc/openbook/customer-api-server/customer-api-server.json new file mode 100644 index 0000000..caa52eb --- /dev/null +++ b/templates/customer_api_server/etc/openbook/customer-api-server/customer-api-server.json @@ -0,0 +1,21 @@ + +{% set ips = openbook_gcomm_addresses.split(",") %} +{% if ips|length > 1 %} +{% set failover = "failover:" %} +{% else %} +{% set failover = "" %} +{% endif %} + + +{ + "log.path": "/var/log/openbook/customer-api-server/customer-api-server.log" + +{% if "True" == openbook_install_customer_api_server|string() %} + ,"entityDS.url": "jdbc:mariadb:{{ failover }}//{{ openbook_gcomm_addresses }}/openbook" + ,"workflowDS.url": "jdbc:mariadb:{{ failover }}//{{ openbook_gcomm_addresses }}/openbook_workflow" + ,"jobsDS.url": "jdbc:mariadb:{{ failover }}//{{ openbook_gcomm_addresses }}/openbook_jobs" + ,"application.port": {{ openbook_customer_api_server_port }} + ,"cluster.interfaces": ["{{ ansible_default_ipv4.address }}"] + {% endif %} + +} diff --git a/templates/customer_api_server/run.sh b/templates/customer_api_server/run.sh new file mode 100755 index 0000000..f773510 --- /dev/null +++ b/templates/customer_api_server/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker run -d --rm --net=host -p {{ openbook_customer_api_server_port }}:8081 -p 5701:5701 -p 5702:5702 -v /etc/openbook/customer-api-server:/etc/openbook/customer-api-server -v /var/log/openbook/customer-api-server:/var/log/openbook/customer-api-server --name customer_api_server_unstable openbook-docker-registry.verizoncloudplatform.com/openbook_customer_api_server_unstable +exit 0 diff --git a/templates/customer_web_ui/etc/openbook/customer-web-ui/customer-web-ui.json b/templates/customer_web_ui/etc/openbook/customer-web-ui/customer-web-ui.json new file mode 100644 index 0000000..e743a7d --- /dev/null +++ b/templates/customer_web_ui/etc/openbook/customer-web-ui/customer-web-ui.json @@ -0,0 +1,9 @@ +{ + "log.path": "/var/log/openbook/customer-web-ui/customer-web-ui.log" + +{% if "True" == openbook_install_customer_web_ui|string() %} + ,"application.port": {{ openbook_customer_web_ui_port }} + ,"cluster.interfaces": ["{{ ansible_default_ipv4.address }}"] +{% endif %} + +} diff --git a/templates/customer_web_ui/run.sh b/templates/customer_web_ui/run.sh new file mode 100755 index 0000000..afd0e86 --- /dev/null +++ b/templates/customer_web_ui/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker run -d --rm --net=host -p {{ openbook_customer_web_ui_port }}:8080 -p 5701:5701 -p 5702:5702 -v /etc/openbook/customer-web-ui:/etc/openbook/customer-web-ui -v /var/log/openbook/customer-web-ui:/var/log/openbook/customer-web-ui --name customer_web_ui_unstable openbook-docker-registry.verizoncloudplatform.com/openbook_customer_web_ui_unstable +exit 0 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 diff --git a/templates/database/root/.my.cnf b/templates/database/root/.my.cnf new file mode 100644 index 0000000..269e0ba --- /dev/null +++ b/templates/database/root/.my.cnf @@ -0,0 +1,6 @@ +[mysql] +user=root +password={{ openbook_database_password }} +[mysqldump] +user=root +password={{ openbook_database_password }} diff --git a/templates/database/run.sh b/templates/database/run.sh new file mode 100755 index 0000000..9a61648 --- /dev/null +++ b/templates/database/run.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# find other running nodes +other_nodes_found=1 +for i in $(echo "{{ openbook_gcomm_addresses }}" | sed -e 's|,| |g'); do + if [ "${i}" != "{{ ansible_default_ipv4.address }}" ]; then + nc ${i} 4567 /dev/null + if [ "${?}" == "0" ]; then + other_nodes_found=0 + fi + fi +done + +# bootstrap or cluster join depending on whether other nodes were found +if [ "${other_nodes_found}" == "0" ]; then + mysql_args="" +else + mysql_args="--wsrep-new-cluster" +fi + +docker run -d --rm --net=host -p 3306:3306 -p 4444:4444 -p 4567:4567 -p 4567:4567/udp -p 4568:4568 -p 9200:9200 -v /etc/openbook/database:/etc/mysql -v /var/lib/mysql:/var/lib/mysql -v /var/log/mysql:/var/log/mysql --name database openbook-docker-registry.verizoncloudplatform.com/openbook_database ${mysql_args} + +exit 0 diff --git a/templates/job_scheduler_server/etc/openbook/job-scheduler-server/job-scheduler-server.json b/templates/job_scheduler_server/etc/openbook/job-scheduler-server/job-scheduler-server.json new file mode 100644 index 0000000..59c1694 --- /dev/null +++ b/templates/job_scheduler_server/etc/openbook/job-scheduler-server/job-scheduler-server.json @@ -0,0 +1,19 @@ + +{% set ips = openbook_gcomm_addresses.split(",") %} +{% if ips|length > 1 %} +{% set failover = "failover:" %} +{% else %} +{% set failover = "" %} +{% endif %} + + +{ + "log.path": "/var/log/openbook/job-scheduler-server/job-scheduler-server.log" + +{% if "True" == openbook_install_job_scheduler_server|string() %} + ,"entityDS.url": "jdbc:mariadb:{{ failover }}//{{ openbook_gcomm_addresses }}/openbook" + ,"jobsDS.url": "jdbc:mariadb:{{ failover }}//{{ openbook_gcomm_addresses }}/openbook_jobs" + ,"cluster.interfaces": ["{{ ansible_default_ipv4.address }}"] +{% endif %} + +} diff --git a/templates/job_scheduler_server/run.sh b/templates/job_scheduler_server/run.sh new file mode 100755 index 0000000..25d5f60 --- /dev/null +++ b/templates/job_scheduler_server/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker run -d --rm --net=host -p 5701:5701 -p 5702:5702 -v /etc/openbook/job-scheduler-server:/etc/openbook/job-scheduler-server -v /var/log/openbook/job-scheduler-server:/var/log/openbook/job-scheduler-server --name job_scheduler_server_unstable openbook-docker-registry.verizoncloudplatform.com/openbook_job_scheduler_server_unstable +exit 0 diff --git a/templates/registry.conf b/templates/registry.conf new file mode 100644 index 0000000..e47e032 --- /dev/null +++ b/templates/registry.conf @@ -0,0 +1,39 @@ +upstream docker-registry { + server registry:5000; +} + +server { + listen 443; + server_name {{ cn }}; + + # SSL + ssl on; + ssl_certificate /etc/nginx/conf.d/{{ cn }}.crt; + ssl_certificate_key /etc/nginx/conf.d/{{ cn }}.key; + + # disable any limits to avoid HTTP 413 for large image uploads + client_max_body_size 0; + + # required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486) + chunked_transfer_encoding on; + + location /v2/ { + # Do not allow connections from docker 1.5 and earlier + # docker pre-1.6.0 did not properly set the user agent on ping, catch "Go *" user agents + if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) { + return 404; + } + + # To add basic authentication to v2 use auth_basic setting plus add_header + auth_basic "registry.localhost"; + auth_basic_user_file /etc/nginx/conf.d/registry.password; + add_header 'Docker-Distribution-Api-Version' 'registry/2.0' always; + + proxy_pass http://docker-registry; + proxy_set_header Host $http_host; # required for docker client's sake + proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 900; + } +} diff --git a/templates/workflow_server/etc/openbook/workflow-server/workflow-server.json b/templates/workflow_server/etc/openbook/workflow-server/workflow-server.json new file mode 100644 index 0000000..8ddd571 --- /dev/null +++ b/templates/workflow_server/etc/openbook/workflow-server/workflow-server.json @@ -0,0 +1,19 @@ + +{% set ips = openbook_gcomm_addresses.split(",") %} +{% if ips|length > 1 %} +{% set failover = "failover:" %} +{% else %} +{% set failover = "" %} +{% endif %} + + +{ + "log.path": "/var/log/openbook/workflow-server/workflow-server.log" + +{% if "True" == openbook_install_workflow_server|string() %} + ,"entityDS.url": "jdbc:mariadb:{{ failover }}//{{ openbook_gcomm_addresses }}/openbook" + ,"workflowDS.url": "jdbc:mariadb:{{ failover }}//{{ openbook_gcomm_addresses }}/openbook_workflow" + ,"cluster.interfaces": ["{{ ansible_default_ipv4.address }}"] +{% endif %} + +} diff --git a/templates/workflow_server/run.sh b/templates/workflow_server/run.sh new file mode 100755 index 0000000..e744cc9 --- /dev/null +++ b/templates/workflow_server/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker run -d --rm --net=host -p 5701:5701 -p 5702:5702 -v /etc/openbook/workflow-server:/etc/openbook/workflow-server -v /var/log/openbook/workflow-server:/var/log/openbook/workflow-server --name workflow_server_unstable openbook-docker-registry.verizoncloudplatform.com/openbook_workflow_server_unstable +exit 0 -- cgit v1.3