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
This commit is contained in:
raigax9 2017-09-11 22:19:39 -04:00
parent 50756599b5
commit 729705ead0
37 changed files with 198 additions and 144 deletions

2
etc/localrc Normal file
View File

@ -0,0 +1,2 @@
[[local|localrc]]

View File

@ -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

View File

@ -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')
}

View File

@ -1,9 +1,9 @@
Listen 8776
Listen ${AUDIT_SERVER_PORT}
<VirtualHost *:8776>
<VirtualHost *:${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
<Location /v1/audit/logs>
Order deny,allow
@ -17,7 +17,7 @@ Listen 8776
Allow from localhost
</Location>
<Directory /opt/app/orm/audit_server/>
<Directory ${ORM_BASE}/orm/services/audit_trail_manager/>
WSGIProcessGroup audit_server
WSGIApplicationGroup %{GLOBAL}
Require all granted

View File

@ -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')

View File

@ -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': {

View File

@ -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!

View File

@ -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!

View File

@ -1,9 +1,9 @@
Listen 7080
Listen ${CMS_PORT}
<VirtualHost *:7080>
<VirtualHost *:${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
<Location /v1/orm/logs>
Order deny,allow
@ -17,7 +17,7 @@ Listen 7080
Allow from localhost
</Location>
<Directory /opt/app/orm/cms_rest/>
<Directory ${ORM_BASE}/orm/services/customer_manager/>
WSGIProcessGroup cms_rest
WSGIApplicationGroup %{GLOBAL}
Require all granted

View File

@ -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')

View File

@ -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"
}

View File

@ -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!

View File

@ -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!

View File

@ -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'
}
},

View File

@ -1,9 +1,9 @@
Listen 8082
Listen ${FMS_PORT}
<VirtualHost *:8082>
<VirtualHost *:${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
<Location /v1/orm/logs>
Order deny,allow
@ -17,7 +17,7 @@ Listen 8082
Allow from localhost
</Location>
<Directory /opt/app/orm/fms_rest/>
<Directory ${ORM_BASE}/orm/services/flavor_manager/>
WSGIProcessGroup fms_rest
WSGIApplicationGroup %{GLOBAL}
Require all granted

View File

@ -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')

View File

@ -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!

View File

@ -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!

View File

@ -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!

View File

@ -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!

View File

@ -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'
}
},

View File

@ -1,9 +1,9 @@
Listen 8084
Listen ${IMS_PORT}
<VirtualHost *:8084>
<VirtualHost *:${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
<Location /v1/orm/logs>
Order deny,allow
@ -17,7 +17,7 @@ Listen 8084
Allow from localhost
</Location>
<Directory /opt/app/orm/ims/>
<Directory ${ORM_BASE}/orm/services/image_manager/>
WSGIProcessGroup ims
WSGIApplicationGroup %{GLOBAL}
Require all granted

View File

@ -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')

View File

@ -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!

View File

@ -1,7 +1,4 @@
#!/bin/bash
echo Creating database: orm_ims_db
mysql -uroot -pstack < ../db_scripts/update_db.sql
echo Done !

View File

@ -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"
}

View File

@ -1,9 +1,9 @@
Listen 8080
Listen ${RMS_PORT}
<VirtualHost *:8080>
<VirtualHost *:${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
<Location /logs>
Order deny,allow
@ -17,7 +17,7 @@ Listen 8080
Allow from localhost
</Location>
<Directory /opt/app/orm/rms/>
<Directory ${ORM_BASE}/orm/services/region_manager/>
WSGIProcessGroup rms
WSGIApplicationGroup %{GLOBAL}
Require all granted

View File

@ -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')

View File

@ -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
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

1 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
2 SNA1 LOCAL SNA 1 LOCAL CAL NY US LA FIL n/a 1111 3333 functional ranger_agent1.0 kilo n/a n/a n/a n/a SNA1 lcp in CAL DPK lcp in FIL http://identity1.com http://127.0.0.1:5000/v2.0 http://horizon1.com http://horizon3.com http://ord1.com http://127.0.0.1:9010
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

View File

@ -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!

View File

@ -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 !

View File

@ -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'
}
},

View File

@ -1,9 +1,9 @@
Listen 8777
Listen ${RDS_PORT}
<VirtualHost *:8777>
<VirtualHost *:${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
<Location /v1/rds/logs>
Order deny,allow
@ -17,7 +17,7 @@ Listen 8777
Allow from localhost
</Location>
<Directory /opt/app/orm/rds/>
<Directory ${ORM_BASE}/orm/services/resource_distributor/>
WSGIProcessGroup rds
WSGIApplicationGroup %{GLOBAL}
Require all granted

View File

@ -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')

View File

@ -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!

View File

@ -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!

32
tools/ranger_create_db.sh Executable file
View File

@ -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