From 729705ead0c8869fef0e7f911dd9b744049680ff Mon Sep 17 00:00:00 2001 From: raigax9 Date: Mon, 11 Sep 2017 22:19:39 -0400 Subject: [PATCH] Added and edited files to run ranger Created scripts for setting up ranger as well as modifying the service files as part of the setup. Change-Id: Ic1d77dd03fa2287097f35f3de5e890cfb768f71b --- etc/localrc | 2 ++ etc/orm.conf | 31 ++++++++++++++++++ orm/base_config.py | 25 ++++++++++++++- .../audit_trail_manager/audit_server.conf | 10 +++--- .../audit_trail_manager/audit_server.wsgi | 3 +- orm/services/audit_trail_manager/config.py | 9 +++--- .../scripts/shell_scripts/create_db.sh | 23 ++----------- .../scripts/shell_scripts/update_db.sh | 4 +++ orm/services/customer_manager/cms_rest.conf | 10 +++--- orm/services/customer_manager/cms_rest.wsgi | 3 +- orm/services/customer_manager/config.py | 10 +++--- .../scripts/shell_scripts/create_db.sh | 7 ++-- .../scripts/shell_scripts/update_db.sh | 4 +++ orm/services/flavor_manager/config.py | 8 ++--- orm/services/flavor_manager/fms_rest.conf | 10 +++--- orm/services/flavor_manager/fms_rest.wsgi | 3 +- .../scripts/shell_scripts/create_db.sh | 10 ++---- .../scripts/shell_scripts/update_db.sh | 4 +++ .../scripts/shell_scripts/create_db.sh | 10 ++---- .../scripts/shell_scripts/update_db.sh | 4 +++ orm/services/image_manager/config.py | 8 ++--- orm/services/image_manager/ims.conf | 10 +++--- orm/services/image_manager/ims.wsgi | 3 +- .../scripts/shell_scripts/create_db.sh | 7 ++-- .../scripts/shell_scripts/update_db.sh | 3 -- orm/services/region_manager/config.py | 16 +++++----- orm/services/region_manager/rms.conf | 10 +++--- orm/services/region_manager/rms.wsgi | 3 +- .../region_manager/rms/resources/regions.csv | 4 +-- .../scripts/shell_scripts/create_db.sh | 14 ++------ .../scripts/shell_scripts/update_db.sh | 4 +-- orm/services/resource_distributor/config.py | 7 ++-- orm/services/resource_distributor/rds.conf | 10 +++--- orm/services/resource_distributor/rds.wsgi | 3 +- .../scripts/shell_scripts/create_db.sh | 14 ++------ .../scripts/shell_scripts/update_db.sh | 4 +++ tools/ranger_create_db.sh | 32 +++++++++++++++++++ 37 files changed, 198 insertions(+), 144 deletions(-) create mode 100644 etc/localrc create mode 100644 orm/services/audit_trail_manager/scripts/shell_scripts/update_db.sh create mode 100755 orm/services/customer_manager/scripts/shell_scripts/update_db.sh create mode 100644 orm/services/flavor_manager/scripts/shell_scripts/update_db.sh create mode 100644 orm/services/id_generator/scripts/shell_scripts/update_db.sh create mode 100644 orm/services/resource_distributor/scripts/shell_scripts/update_db.sh create mode 100755 tools/ranger_create_db.sh diff --git a/etc/localrc b/etc/localrc new file mode 100644 index 00000000..08803db1 --- /dev/null +++ b/etc/localrc @@ -0,0 +1,2 @@ +[[local|localrc]] + diff --git a/etc/orm.conf b/etc/orm.conf index e69de29b..a310146f 100644 --- a/etc/orm.conf +++ b/etc/orm.conf @@ -0,0 +1,31 @@ +[DEFAULT] +api_workers = 1 +debug = True +verbose = True +pecan_debug = True +region = local +#Log files location +log_dir = /var/log/ranger +local_repo = ranger_repo +cms_log_file: /var/log/orm/cms_rest.log +fms_log_file: /var/log/orm/fms_rest.log +ims_log_file: /var/log/orm/ims.log +rds_log_file: /var/log/orm/rds.log +uuidgen_log_file: /var/log/orm/uuidgen.log +audit_log_file: /var/log/orm/audit_server.log +rms_log_file: /var/log/orm/rms.log +orm_base_url: https://127.0.0.1 +cms_listen_port: 7080 +rms_listen_port: 8080 +rds_http_listen_port: 8777 +rds_listen_port: 8778 +fms_listen_port: 8082 +ims_listen_port: 8084 +uuidgen_listen_port: 8090 +audit_server_listen_port: 8776 + +[api] +# Address to bind the API server to +host = 0.0.0.0 +# Port the bind the API server to +port = 9010 diff --git a/orm/base_config.py b/orm/base_config.py index 4093fb7f..6f30c5cd 100644 --- a/orm/base_config.py +++ b/orm/base_config.py @@ -3,8 +3,31 @@ orm_host = '0.0.0.0' log_location = '{}' ranger_base = os.path.dirname(os.path.abspath('orm')) log_location = ranger_base + '/logs/{}' - uuid = { 'port': '7001', 'log': log_location.format('uuidgen.log') } +cms = { + 'port': '7080', + 'log': log_location.format('cms.log') +} +fms = { + 'port': '8082', + 'log': log_location.format('fms.log') +} +audit_server = { + 'port': '8776', + 'log': log_location.format('audit_server.log') +} +ims = { + 'port': '8084', + 'log': log_location.format('ims.log') +} +rms = { + 'port': '8080', + 'log': log_location.format('rms.log') +} +rds = { + 'port': '8778', + 'log': log_location.format('rds.log') +} diff --git a/orm/services/audit_trail_manager/audit_server.conf b/orm/services/audit_trail_manager/audit_server.conf index 230988de..10ccd5be 100644 --- a/orm/services/audit_trail_manager/audit_server.conf +++ b/orm/services/audit_trail_manager/audit_server.conf @@ -1,9 +1,9 @@ -Listen 8776 +Listen ${AUDIT_SERVER_PORT} - + - WSGIDaemonProcess audit_server user=orm group=orm threads=5 - WSGIScriptAlias / /opt/app/orm/audit_server/audit_server.wsgi + WSGIDaemonProcess audit_server user=stack group=stack threads=5 + WSGIScriptAlias / ${ORM_BASE}/orm/services/audit_trail_manager/audit_server.wsgi Order deny,allow @@ -17,7 +17,7 @@ Listen 8776 Allow from localhost - + WSGIProcessGroup audit_server WSGIApplicationGroup %{GLOBAL} Require all granted diff --git a/orm/services/audit_trail_manager/audit_server.wsgi b/orm/services/audit_trail_manager/audit_server.wsgi index eede3814..1b9e75dd 100644 --- a/orm/services/audit_trail_manager/audit_server.wsgi +++ b/orm/services/audit_trail_manager/audit_server.wsgi @@ -1,2 +1,3 @@ from pecan.deploy import deploy -application = deploy('/opt/app/orm/audit_server/config.py') +from orm.base_config import ranger_base +application = deploy(ranger_base+'/orm/services/audit_trail_manager/config.py') diff --git a/orm/services/audit_trail_manager/config.py b/orm/services/audit_trail_manager/config.py index 98ad0be6..15b4f577 100644 --- a/orm/services/audit_trail_manager/config.py +++ b/orm/services/audit_trail_manager/config.py @@ -1,10 +1,9 @@ """config module.""" - - +import orm.base_config as config # Server Specific Configurations server = { - 'port': '8776', - 'host': '0.0.0.0' + 'port': config.audit_server['port'], + 'host': config.orm_host } # DB configurations @@ -47,7 +46,7 @@ logging = { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'formatter': 'color', - 'filename': '/opt/app/orm/audit_server/audit_server.log' + 'filename': config.audit_server['log'] } }, 'formatters': { diff --git a/orm/services/audit_trail_manager/scripts/shell_scripts/create_db.sh b/orm/services/audit_trail_manager/scripts/shell_scripts/create_db.sh index d462b787..ea5e9b59 100644 --- a/orm/services/audit_trail_manager/scripts/shell_scripts/create_db.sh +++ b/orm/services/audit_trail_manager/scripts/shell_scripts/create_db.sh @@ -1,24 +1,5 @@ #!/bin/bash - echo Creating database: orm_audit echo Creating table: transactions - -mysql -uroot -pstack < ../db_scripts/create_db.sql - -echo Done ! - - - - - - - - - - - - - - - - +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/create_db.sql &> /dev/null +echo Done! diff --git a/orm/services/audit_trail_manager/scripts/shell_scripts/update_db.sh b/orm/services/audit_trail_manager/scripts/shell_scripts/update_db.sh new file mode 100644 index 00000000..0615d7bf --- /dev/null +++ b/orm/services/audit_trail_manager/scripts/shell_scripts/update_db.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo Updating database: orm_audit +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/update_db.sql &> /dev/null +echo Done! diff --git a/orm/services/customer_manager/cms_rest.conf b/orm/services/customer_manager/cms_rest.conf index 56a429d9..a4cc90ff 100644 --- a/orm/services/customer_manager/cms_rest.conf +++ b/orm/services/customer_manager/cms_rest.conf @@ -1,9 +1,9 @@ -Listen 7080 +Listen ${CMS_PORT} - + - WSGIDaemonProcess cms_rest user=orm group=orm threads=5 - WSGIScriptAlias / /opt/app/orm/cms_rest/cms_rest.wsgi + WSGIDaemonProcess cms_rest user=stack group=stack threads=5 + WSGIScriptAlias / ${ORM_BASE}/orm/services/customer_manager/cms_rest.wsgi Order deny,allow @@ -17,7 +17,7 @@ Listen 7080 Allow from localhost - + WSGIProcessGroup cms_rest WSGIApplicationGroup %{GLOBAL} Require all granted diff --git a/orm/services/customer_manager/cms_rest.wsgi b/orm/services/customer_manager/cms_rest.wsgi index ed375b2e..25c5d0da 100644 --- a/orm/services/customer_manager/cms_rest.wsgi +++ b/orm/services/customer_manager/cms_rest.wsgi @@ -1,2 +1,3 @@ from pecan.deploy import deploy -application = deploy('/opt/app/orm/cms_rest/config.py') +from orm.base_config import ranger_base +application = deploy(ranger_base+'/orm/services/customer_manager/config.py') diff --git a/orm/services/customer_manager/config.py b/orm/services/customer_manager/config.py index 5a12ad75..3cb9ec80 100755 --- a/orm/services/customer_manager/config.py +++ b/orm/services/customer_manager/config.py @@ -1,15 +1,15 @@ +import orm.base_config as config from orm_common.hooks.api_error_hook import APIErrorHook from orm_common.hooks.security_headers_hook import SecurityHeadersHook from orm_common.hooks.transaction_id_hook import TransactionIdHook - global TransactionIdHook global APIErrorHook global SecurityHeadersHook # Server Specific Configurations server = { - 'port': '7080', - 'host': '0.0.0.0', + 'port': config.cms['port'], + 'host': config.orm_host, 'name': 'cms', 'host_ip': '0.0.0.0' } @@ -49,7 +49,7 @@ logging = { 'class': 'logging.handlers.RotatingFileHandler', 'maxBytes': 50000000, 'backupCount': 10, - 'filename': '/opt/app/orm/cms_rest/cms_rest.log', + 'filename': config.cms['log'], 'formatter': 'simple' } }, @@ -120,5 +120,5 @@ authentication = { "role_location": {"tenant": "admin"}, # The Keystone version currently in use. Can be either "2.0" or "3". "keystone_version": "2.0", - "policy_file": "/opt/app/orm/cms_rest/cms_rest/etc/policy.json" + "policy_file": "/opt/stack/ranger/orm/services/customer_manager/cms_rest/etc/policy.json" } diff --git a/orm/services/customer_manager/scripts/shell_scripts/create_db.sh b/orm/services/customer_manager/scripts/shell_scripts/create_db.sh index 705b2182..386f01e4 100755 --- a/orm/services/customer_manager/scripts/shell_scripts/create_db.sh +++ b/orm/services/customer_manager/scripts/shell_scripts/create_db.sh @@ -1,7 +1,4 @@ #!/bin/bash - echo Creating database: orm_cms_db - -mysql -uroot -pstack < ../db_scripts/ranger_cms_create_db.sql - -echo Done ! +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/ranger_cms_create_db.sql &> /dev/null +echo Done! diff --git a/orm/services/customer_manager/scripts/shell_scripts/update_db.sh b/orm/services/customer_manager/scripts/shell_scripts/update_db.sh new file mode 100755 index 00000000..76358c84 --- /dev/null +++ b/orm/services/customer_manager/scripts/shell_scripts/update_db.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo Updating database: orm_cms_db +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/ranger_update_db.sql &> /dev/null +echo Done! diff --git a/orm/services/flavor_manager/config.py b/orm/services/flavor_manager/config.py index 1ecf0abd..fa6940c4 100755 --- a/orm/services/flavor_manager/config.py +++ b/orm/services/flavor_manager/config.py @@ -1,15 +1,15 @@ +import orm.base_config as config from orm.common.orm_common.hooks.api_error_hook import APIErrorHook from orm.common.orm_common.hooks.security_headers_hook import SecurityHeadersHook from orm.services.flavor_manager.fms_rest.hooks.service_hooks import TransIdHook - global TransIdHook global APIErrorHook global SecurityHeadersHook # Server Specific Configurations server = { - 'port': '8082', - 'host': '0.0.0.0', + 'port': config.fms['port'], + 'host': config.orm_host, 'name': 'fms' } @@ -50,7 +50,7 @@ logging = { 'class': 'logging.handlers.RotatingFileHandler', 'maxBytes': 50000000, 'backupCount': 10, - 'filename': '/opt/app/orm/fms_rest/fms_rest.log', + 'filename': config.fms['log'], 'formatter': 'simple' } }, diff --git a/orm/services/flavor_manager/fms_rest.conf b/orm/services/flavor_manager/fms_rest.conf index 7a1ff7fe..c4b7a2ff 100644 --- a/orm/services/flavor_manager/fms_rest.conf +++ b/orm/services/flavor_manager/fms_rest.conf @@ -1,9 +1,9 @@ -Listen 8082 +Listen ${FMS_PORT} - + - WSGIDaemonProcess fms_rest user=orm group=orm threads=5 - WSGIScriptAlias / /opt/app/orm/fms_rest/fms_rest.wsgi + WSGIDaemonProcess fms_rest user=stack group=stack threads=5 + WSGIScriptAlias / ${ORM_BASE}/orm/services/flavor_manager/fms_rest.wsgi Order deny,allow @@ -17,7 +17,7 @@ Listen 8082 Allow from localhost - + WSGIProcessGroup fms_rest WSGIApplicationGroup %{GLOBAL} Require all granted diff --git a/orm/services/flavor_manager/fms_rest.wsgi b/orm/services/flavor_manager/fms_rest.wsgi index 07efe2d5..82708eb7 100644 --- a/orm/services/flavor_manager/fms_rest.wsgi +++ b/orm/services/flavor_manager/fms_rest.wsgi @@ -1,2 +1,3 @@ from pecan.deploy import deploy -application = deploy('/opt/app/orm/fms_rest/config.py') +from orm.base_config import ranger_base +application = deploy(ranger_base+'/orm/services/flavor_manager/config.py') diff --git a/orm/services/flavor_manager/scripts/shell_scripts/create_db.sh b/orm/services/flavor_manager/scripts/shell_scripts/create_db.sh index 3dc4e379..0e06382e 100644 --- a/orm/services/flavor_manager/scripts/shell_scripts/create_db.sh +++ b/orm/services/flavor_manager/scripts/shell_scripts/create_db.sh @@ -1,8 +1,4 @@ #!/bin/bash - -echo Creating database: orm_rds -echo Creating table: resource_status - -mysql -uroot -pstack < ../db_scripts/ranger_fms_create_db.sql - -echo Done ! +echo Creating database: orm_fms +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/ranger_fms_create_db.sql &> /dev/null +echo Done! diff --git a/orm/services/flavor_manager/scripts/shell_scripts/update_db.sh b/orm/services/flavor_manager/scripts/shell_scripts/update_db.sh new file mode 100644 index 00000000..b2481dba --- /dev/null +++ b/orm/services/flavor_manager/scripts/shell_scripts/update_db.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo Updating database: orm_fms +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/ranger_fms_update_db.sql &> /dev/null +echo Done! diff --git a/orm/services/id_generator/scripts/shell_scripts/create_db.sh b/orm/services/id_generator/scripts/shell_scripts/create_db.sh index a7d51793..11a21240 100755 --- a/orm/services/id_generator/scripts/shell_scripts/create_db.sh +++ b/orm/services/id_generator/scripts/shell_scripts/create_db.sh @@ -1,8 +1,4 @@ #!/bin/bash - -echo Creating database: orm_rds -echo Creating table: resource_status - -mysql -uroot -pstack < ../db_scripts/db_create.sql - -echo Done ! +echo Creating database: orm_id +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/db_create.sql &> /dev/null +echo Done! diff --git a/orm/services/id_generator/scripts/shell_scripts/update_db.sh b/orm/services/id_generator/scripts/shell_scripts/update_db.sh new file mode 100644 index 00000000..2468bc99 --- /dev/null +++ b/orm/services/id_generator/scripts/shell_scripts/update_db.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo Update database: orm_id +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/update_db.sql &> /dev/null +echo Done! diff --git a/orm/services/image_manager/config.py b/orm/services/image_manager/config.py index 4ac9f014..ccfe1f86 100755 --- a/orm/services/image_manager/config.py +++ b/orm/services/image_manager/config.py @@ -1,15 +1,15 @@ from ims.hooks.service_hooks import TransIdHook +import orm.base_config as config from orm_common.hooks.api_error_hook import APIErrorHook from orm_common.hooks.security_headers_hook import SecurityHeadersHook - global TransIdHook global APIErrorHook global SecurityHeadersHook # Server Specific Configurations server = { - 'port': '8084', - 'host': '0.0.0.0', + 'port': config.ims['port'], + 'host': config.orm_host, 'name': 'ims' } @@ -51,7 +51,7 @@ logging = { 'class': 'logging.handlers.RotatingFileHandler', 'maxBytes': 50000000, 'backupCount': 10, - 'filename': '/opt/app/orm/ims/ims.log', + 'filename': config.ims['log'], 'formatter': 'simple' } }, diff --git a/orm/services/image_manager/ims.conf b/orm/services/image_manager/ims.conf index 35d71ad2..34b389dd 100644 --- a/orm/services/image_manager/ims.conf +++ b/orm/services/image_manager/ims.conf @@ -1,9 +1,9 @@ -Listen 8084 +Listen ${IMS_PORT} - + - WSGIDaemonProcess ims user=orm group=orm threads=5 - WSGIScriptAlias / /opt/app/orm/ims/ims.wsgi + WSGIDaemonProcess ims user=stack group=stack threads=5 + WSGIScriptAlias / ${ORM_BASE}/orm/services/image_manager/ims.wsgi Order deny,allow @@ -17,7 +17,7 @@ Listen 8084 Allow from localhost - + WSGIProcessGroup ims WSGIApplicationGroup %{GLOBAL} Require all granted diff --git a/orm/services/image_manager/ims.wsgi b/orm/services/image_manager/ims.wsgi index 91e0f31a..e5109c8f 100644 --- a/orm/services/image_manager/ims.wsgi +++ b/orm/services/image_manager/ims.wsgi @@ -1,2 +1,3 @@ from pecan.deploy import deploy -application = deploy('/opt/app/orm/ims/config.py') +from orm.base_config import ranger_base +application = deploy(ranger_base+'/orm/services/image_manager/config.py') diff --git a/orm/services/image_manager/scripts/shell_scripts/create_db.sh b/orm/services/image_manager/scripts/shell_scripts/create_db.sh index 4f93fc8c..30b2e929 100644 --- a/orm/services/image_manager/scripts/shell_scripts/create_db.sh +++ b/orm/services/image_manager/scripts/shell_scripts/create_db.sh @@ -1,7 +1,4 @@ #!/bin/bash - echo Creating database: orm_ims_db - -mysql -uroot -pstack < ../db_scripts/create_db.sql - -echo Done ! +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/create_db.sql &> /dev/null +echo Done! diff --git a/orm/services/image_manager/scripts/shell_scripts/update_db.sh b/orm/services/image_manager/scripts/shell_scripts/update_db.sh index 79ca5c57..35b047ab 100755 --- a/orm/services/image_manager/scripts/shell_scripts/update_db.sh +++ b/orm/services/image_manager/scripts/shell_scripts/update_db.sh @@ -1,7 +1,4 @@ #!/bin/bash - echo Creating database: orm_ims_db - mysql -uroot -pstack < ../db_scripts/update_db.sql - echo Done ! diff --git a/orm/services/region_manager/config.py b/orm/services/region_manager/config.py index 4474beac..bf5b584c 100755 --- a/orm/services/region_manager/config.py +++ b/orm/services/region_manager/config.py @@ -1,15 +1,15 @@ -from orm_common.hooks.api_error_hook import APIErrorHook -from orm_common.hooks.security_headers_hook import SecurityHeadersHook -from orm_common.hooks.transaction_id_hook import TransactionIdHook - +import orm.base_config as config +from orm.common.orm_common.hooks.api_error_hook import APIErrorHook +from orm.common.orm_common.hooks.security_headers_hook import SecurityHeadersHook +from orm.common.orm_common.hooks.transaction_id_hook import TransactionIdHook global TransactionIdHook global APIErrorHook global SecurityHeadersHook # Server Specific Configurations server = { - 'port': '8080', - 'host': '0.0.0.0', + 'port': config.rms['port'], + 'host': config.orm_host, 'name': 'rms' } @@ -51,7 +51,7 @@ logging = { 'class': 'logging.handlers.RotatingFileHandler', 'maxBytes': 50000000, 'backupCount': 10, - 'filename': '/opt/app/orm/rms/rms.log', + 'filename': config.rms['log'], 'formatter': 'simple' } }, @@ -115,5 +115,5 @@ authentication = { "tenant_name": "admin", # The Keystone version currently in use. Can be either "2.0" or "3" "keystone_version": "2.0", - "policy_file": "/opt/app/orm/rms/rms/etc/policy.json" + "policy_file": "/stack/orm/services/region_manager/rms/etc/policy.json" } diff --git a/orm/services/region_manager/rms.conf b/orm/services/region_manager/rms.conf index 7912de6a..462a5096 100644 --- a/orm/services/region_manager/rms.conf +++ b/orm/services/region_manager/rms.conf @@ -1,9 +1,9 @@ -Listen 8080 +Listen ${RMS_PORT} - + - WSGIDaemonProcess rms user=orm group=orm threads=5 - WSGIScriptAlias / /opt/app/orm/rms/rms.wsgi + WSGIDaemonProcess rms user=stack group=stack threads=5 + WSGIScriptAlias / ${ORM_BASE}/orm/services/region_manager/rms.wsgi Order deny,allow @@ -17,7 +17,7 @@ Listen 8080 Allow from localhost - + WSGIProcessGroup rms WSGIApplicationGroup %{GLOBAL} Require all granted diff --git a/orm/services/region_manager/rms.wsgi b/orm/services/region_manager/rms.wsgi index dc62cf7e..d1f740f1 100644 --- a/orm/services/region_manager/rms.wsgi +++ b/orm/services/region_manager/rms.wsgi @@ -1,2 +1,3 @@ from pecan.deploy import deploy -application = deploy('/opt/app/orm/rms/config.py') +from orm.base_config import ranger_base +application = deploy(ranger_base+'/orm/services/region_manager/config.py') diff --git a/orm/services/region_manager/rms/resources/regions.csv b/orm/services/region_manager/rms/resources/regions.csv index b63a9e01..208153c8 100644 --- a/orm/services/region_manager/rms/resources/regions.csv +++ b/orm/services/region_manager/rms/resources/regions.csv @@ -1,4 +1,2 @@ region_id,region_name,address_state,address_country,address_city,address_street,address_zip,region_status,ranger_agent_version,open_stack_version,design_type,location_type,vlcp_name,clli,description,keystone_url,horizon_url,ord_url -SNA1,SNA 1,CAL,US,LA,n/a,1111,functional,ranger_agent1.0,kilo,n/a,n/a,n/a,n/a,SNA1 lcp in CAL,http://identity1.com,http://horizon1.com,http://ord1.com -SNA2,SNA 2,NY,US,NY City,n/a,2222,functional,ranger_agent1.5,kilo,n/a,n/a,n/a,n/a,SNA2 lcp in NYC,http://identity2.com,http://horizon2.com,http://ord2.com -DPK,DPK,NY,US,FIL,n/a,3333,functional,ranger_agent1.0,kilo,n/a,n/a,n/a,n/a,DPK lcp in FIL,http://identity3.com,http://horizon3.com,http://ord3.com \ No newline at end of file +LOCAL,LOCAL,NY,US,FIL,n/a,3333,functional,ranger_agent1.0,kilo,n/a,n/a,n/a,n/a,DPK lcp in FIL,http://127.0.0.1:5000/v2.0,http://horizon3.com,http://127.0.0.1:9010 diff --git a/orm/services/region_manager/scripts/shell_scripts/create_db.sh b/orm/services/region_manager/scripts/shell_scripts/create_db.sh index 5dee4fcb..42d56a75 100644 --- a/orm/services/region_manager/scripts/shell_scripts/create_db.sh +++ b/orm/services/region_manager/scripts/shell_scripts/create_db.sh @@ -1,15 +1,5 @@ #!/bin/bash - echo Creating database: orm_rms_db echo Creating tables: rms_groups, region, group_region, region_end_point, region_meta_data - -mysql -uroot -pstack < ../db_scripts/create_db.sql - -echo Done ! - - - - - - - +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/create_db.sql &> /dev/null +echo Done! diff --git a/orm/services/region_manager/scripts/shell_scripts/update_db.sh b/orm/services/region_manager/scripts/shell_scripts/update_db.sh index 024a1287..ed139f34 100644 --- a/orm/services/region_manager/scripts/shell_scripts/update_db.sh +++ b/orm/services/region_manager/scripts/shell_scripts/update_db.sh @@ -1,5 +1,3 @@ #!/bin/bash - -mysql -uroot -pstack < ../db_scripts/update_db.sql - +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/update_db.sql echo Done ! diff --git a/orm/services/resource_distributor/config.py b/orm/services/resource_distributor/config.py index 53154e1f..59c0dfda 100755 --- a/orm/services/resource_distributor/config.py +++ b/orm/services/resource_distributor/config.py @@ -1,3 +1,4 @@ +import orm.base_config as config # Pecan Application configurations app = { 'root': 'rds.controllers.root.RootController', @@ -6,8 +7,8 @@ app = { } server = { - 'port': '8777', - 'host': '0.0.0.0' + 'port': config.rds['port'], + 'host': config.orm_host } # DB configurations @@ -148,7 +149,7 @@ logging = { 'class': 'logging.handlers.RotatingFileHandler', 'maxBytes': 50000000, 'backupCount': 10, - 'filename': '/tmp/rds.log', + 'filename': config.rds['log'], 'formatter': 'simple' } }, diff --git a/orm/services/resource_distributor/rds.conf b/orm/services/resource_distributor/rds.conf index a7bba7d1..3fafd184 100644 --- a/orm/services/resource_distributor/rds.conf +++ b/orm/services/resource_distributor/rds.conf @@ -1,9 +1,9 @@ -Listen 8777 +Listen ${RDS_PORT} - + - WSGIDaemonProcess rds user=orm group=orm threads=5 - WSGIScriptAlias / /opt/app/orm/rds/rds.wsgi + WSGIDaemonProcess rds user=stack group=stack threads=5 + WSGIScriptAlias / ${ORM_BASE}/orm/services/resource_distributor/rds.wsgi Order deny,allow @@ -17,7 +17,7 @@ Listen 8777 Allow from localhost - + WSGIProcessGroup rds WSGIApplicationGroup %{GLOBAL} Require all granted diff --git a/orm/services/resource_distributor/rds.wsgi b/orm/services/resource_distributor/rds.wsgi index f5259e20..9a36d9fc 100644 --- a/orm/services/resource_distributor/rds.wsgi +++ b/orm/services/resource_distributor/rds.wsgi @@ -1,2 +1,3 @@ from pecan.deploy import deploy -application = deploy('/opt/app/orm/rds/config.py') +from orm.base_config import ranger_base +application = deploy(ranger_base+'/orm/services/resource_distributor/config.py') diff --git a/orm/services/resource_distributor/scripts/shell_scripts/create_db.sh b/orm/services/resource_distributor/scripts/shell_scripts/create_db.sh index 904ab727..352a6ebe 100755 --- a/orm/services/resource_distributor/scripts/shell_scripts/create_db.sh +++ b/orm/services/resource_distributor/scripts/shell_scripts/create_db.sh @@ -1,15 +1,5 @@ #!/bin/bash - echo Creating database: orm_rds echo Creating table: resource_status - -mysql -uroot -pstack < ../db_scripts/create_db.sql - -echo Done ! - - - - - - - +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/create_db.sql &> /dev/null +echo Done! diff --git a/orm/services/resource_distributor/scripts/shell_scripts/update_db.sh b/orm/services/resource_distributor/scripts/shell_scripts/update_db.sh new file mode 100644 index 00000000..3211d61f --- /dev/null +++ b/orm/services/resource_distributor/scripts/shell_scripts/update_db.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo Updating database: orm_rds +mysql -uroot -p$MYSQL_PASSWORD < ../db_scripts/update_db.sql &> /dev/null +echo Done! diff --git a/tools/ranger_create_db.sh b/tools/ranger_create_db.sh new file mode 100755 index 00000000..f77b7076 --- /dev/null +++ b/tools/ranger_create_db.sh @@ -0,0 +1,32 @@ +root_dir=/opt/stack/ranger +tools_dir=/opt/stack/ranger/tools +cd .. +cd orm/services/audit_trail_manager/scripts/shell_scripts/ +bash create_db.sh +bash update_db.sh +cd $root_dir +cd orm/services/customer_manager/scripts/shell_scripts/ +bash create_db.sh +bash update_db.sh +cd $root_dir +cd orm/services/flavor_manager/scripts/shell_scripts/ +bash create_db.sh +bash update_db.sh +cd $root_dir +cd orm/services/id_generator/scripts/shell_scripts/ +bash create_db.sh +bash update_db.sh +cd $root_dir +cd orm/services/image_manager/scripts/shell_scripts/ +bash create_db.sh +bash update_db.sh +cd $root_dir +cd orm/services/region_manager/scripts/shell_scripts/ +bash create_db.sh +bash update_db.sh +cd $root_dir +cd orm/services/resource_distributor/scripts/shell_scripts/ +bash create_db.sh +bash update_db.sh +echo "Databases Created!" +cd $tools_dir