Skip to content

Commit

Permalink
Fixes for monitoring instance
Browse files Browse the repository at this point in the history
  • Loading branch information
alincalinciuc committed Nov 20, 2016
1 parent ad80ac8 commit 7b4ebc4
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 42 deletions.
18 changes: 10 additions & 8 deletions images_configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@
OPENSTACK_PASSWORD_DEFAULT="OPENSTACK_PASSWORD"
OPENSTACK_KEY_PAIR_DEFAULT="OPENSTACK_KEY_PAIR"
OPENSTACK_TENANT_DEFAULT="OPENSTACK_TENANT"
NUBOMEDIA_DEFAULT_ADMIN_PASS="NUBOMEDIA_DEFAULT_ADMIN_PASS"
NUBOMEDIA_STUN_SERVER_ADDRESS="NUBOMEDIA_STUN_SERVER_ADDRESS"
NUBOMEDIA_TURN_SERVER_ADDRESS="NUBOMEDIA_TURN_SERVER_ADDRESS"
NUBOMEDIA_MONITORING_IP="NUBOMEDIA_MONITORING_IP"
NUBOMEDIA_DEFAULT_ADMIN_PASS_DEFAULT="NUBOMEDIA_DEFAULT_ADMIN_PASS"
NUBOMEDIA_STUN_SERVER_ADDRESS_DEFAULT="NUBOMEDIA_STUN_SERVER_ADDRESS"
NUBOMEDIA_TURN_SERVER_ADDRESS_DEFAULT="NUBOMEDIA_TURN_SERVER_ADDRESS"
NUBOMEDIA_MONITORING_IP_DEFAULT="NUBOMEDIA_MONITORING_IP"
KURENTO_MEDIA_SERVER_DEFAULT="nubomedia/kurento-media-server-dev"
OPENSHIFT_IP=%s
OPENSHIFT_DOMAIN=%s
Expand All @@ -150,6 +150,7 @@
MONITORING_IP=%s
TURN_SERVER_IP=%s
STUN_SERVER_IP=%s
KURENTO_MEDIA_SERVER=%s
sed -i "s/${PUBLIC_IP}/${EXTERNAL_IP}/g" /etc/nubomedia/paas.properties
sed -i "s/${OPENSHIFT_IP_DEFAULT}/${OPENSHIFT_IP}/g" /etc/nubomedia/paas.properties
Expand All @@ -160,15 +161,16 @@
sed -i "s/${OPENSTACK_TENANT_DEFAULT}/${OPENSTACK_TENANT}/g" /etc/nubomedia/paas.properties
sed -i "s/${OPENSTACK_KEY_PAIR_DEFAULT}/${OPENSTACK_KEY_PAIR}/g" /etc/nubomedia/paas.properties
sed -i "s/${NUBOMEDIA_DEFAULT_ADMIN_PASS}/${NUBOMEDIA_DEFAULT_ADMIN_PASS}/g" /etc/nubomedia/paas.properties
sed -i "s/${KURENTO_MEDIA_SERVER_DEFAULT}/${KURENTO_MEDIA_SERVER}/g" /etc/nubomedia/paas.properties
# Hardcoded values that need to be updated on the NUBOMEDIA PaaS backend
sed -i "s/${MONITORING_IP}/${MONITORING_IP}/g" /opt/nubomedia/nubomedia-paas/src/main/resources/static/js/controllers/applicationController.js
sed -i "s/${PUBLIC_IP}/${EXTERNAL_IP}/g" /opt/nubomedia/nubomedia-paas/src/main/resources/static/js/services/authService.js
# Update the Kurento Media Server USER DATA on nubomedia-msvnfm/src/main/resources/scripts/monitoring.sh
sed -i "s/${NUBOMEDIA_MONITORING_IP}/${MONITORING_IP}/g" /opt/nubomedia/nubomedia-msvnfm/src/main/resources/scripts/monitoring.sh
sed -i "s/${NUBOMEDIA_TURN_SERVER_ADDRESS}/${TURN_SERVER_IP}/g" /opt/nubomedia/nubomedia-msvnfm/src/main/resources/scripts/monitoring.sh
sed -i "s/${NUBOMEDIA_STUN_SERVER_ADDRESS}/${STUN_SERVER_IP}/g" /opt/nubomedia/nubomedia-msvnfm/src/main/resources/scripts/monitoring.sh
sed -i "s/${NUBOMEDIA_MONITORING_IP_DEFAULT}/${MONITORING_IP}/g" /opt/nubomedia/nubomedia-msvnfm/src/main/resources/scripts/monitoring.sh
sed -i "s/${NUBOMEDIA_TURN_SERVER_ADDRESS_DEFAULT}/${TURN_SERVER_IP}/g" /opt/nubomedia/nubomedia-msvnfm/src/main/resources/scripts/monitoring.sh
sed -i "s/${NUBOMEDIA_STUN_SERVER_ADDRESS_DEFAULT}/${STUN_SERVER_IP}/g" /opt/nubomedia/nubomedia-msvnfm/src/main/resources/scripts/monitoring.sh
mysql -u admin -pchangeme --execute='create database openbaton;'
mysql -u admin -pchangeme --execute='create database nubomedia;'
Expand Down
67 changes: 33 additions & 34 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,10 @@ def autoinstall():
openStackManager = OpenStackManager()
nubomediaManager = NubomediaManager()

# Connect to Cinder
# Connect to Cinder and create disk
cinderManager = CinderManager(**kwargs)
cinderManager.get_volumes_list()
monitoring_disk = cinderManager.create_volume("monitoring_disk", 10)

# Create a floating IP if there is no floating IP on that tenant
print novaManager.create_floating_ip()
Expand Down Expand Up @@ -521,13 +522,15 @@ def autoinstall():
####################################
# Upload NUBOMEDIA Images if needed
####################################

kms_image = kms_image_name
if upload_images:
# Upload Kurento Media Server Docker Image on Glance
glanceManager.upload_docker_image(kms_docker_img, kms_docker_image_description)

# Upload Kurento Media Server KVM Image on Glance
glanceManager.upload_docker_image(kms_image_name, kms_image_description)
# Upload Kurento Media Server on KVM or Docker depending on what you've chosen on the variables.py file
if not use_kurento_on_docker:
glanceManager.upload_docker_image(kms_image_name, kms_image_description)
kms_image = kms_image_name
else:
glanceManager.upload_docker_image(kms_docker_img, kms_docker_image_description)
kms_image = kms_docker_img

# Upload Monitoring machine Image on Glance
glanceManager.upload_remote_image(monitoring_image_name, monitoring_remote_img, monitoring_image_description)
Expand All @@ -543,10 +546,10 @@ def autoinstall():
# Upload Controller Image on Glance
glanceManager.upload_remote_image(controller_image_name, controller_remote_img, controller_image_description)

# Log time needed to upload NUBOMEDIA Images
upload_time = time.time() - start_time
print "Time needed for uploading of the NUBOMEDIA images was %s seconds " % upload_time
upload_time = time.time()
# Log time needed to upload NUBOMEDIA Images
upload_time = time.time() - start_time
print "Time needed for uploading of the NUBOMEDIA images was %s seconds " % upload_time
upload_time = time.time()

#######################################
# Start NUBOMEDIA platform instances
Expand All @@ -557,39 +560,30 @@ def autoinstall():
glanceManager.get_image_id(monitoring_image_name),
novaManager.get_flavor_id(monitoring_flavor),
private_key,
monitoring_user_data)
'')
instance_monitoring_ip = novaManager.associate_floating_ip(instance_monitoring)
print "Monitoring instance name=%s , id=%s , public_ip=%s" % (monitoring_image_name,
instance_monitoring,
instance_monitoring_ip)

# Start TURN Server instance
instance_turn = novaManager.start_kvm_instance(turn_image_name,
glanceManager.get_image_id(turn_image_name),
novaManager.get_flavor_id(turn_flavor),
private_key,
turn_user_data)
instance_turn_ip = novaManager.associate_floating_ip(instance_turn)
print "TURN instance name=%s , id=%s , public_ip=%s" % (turn_image_name,
instance_turn,
instance_turn_ip)
# instance_turn = novaManager.start_kvm_instance(turn_image_name,
# glanceManager.get_image_id(turn_image_name),
# novaManager.get_flavor_id(turn_flavor),
# private_key,
# turn_user_data)
# instance_turn_ip = novaManager.associate_floating_ip(instance_turn)
# print "TURN instance name=%s , id=%s , public_ip=%s" % (turn_image_name,
# instance_turn,
# instance_turn_ip)
instance_turn_ip = '80.96.122.61'

# Start Controller instance
instance_controller = novaManager.start_kvm_instance(controller_image_name,
glanceManager.get_image_id(controller_image_name),
novaManager.get_flavor_id(controller_flavor),
private_key,
controller_user_data % (openshift_ip,
openshift_domain,
iaas_ip,
username,
password,
tenant_name,
private_key,
nubomedia_admin_paas,
instance_monitoring_ip,
instance_turn_ip,
instance_turn_ip))
'')
instance_controller_ip = novaManager.associate_floating_ip(instance_controller)
print "Controller instance name=%s , id=%s , public_ip=%s" % (controller_image_name,
instance_controller,
Expand All @@ -609,11 +603,15 @@ def autoinstall():
# properly provisioned and booted
time.sleep(240)

cinderManager.attach_volume(monitoring_disk, instance_monitoring, '/dev/vdb')

# Delay for allowing the volume to get attached to the monitoring instance
time.sleep(60)
# Configure the Monitoring instance
nubomediaManager.run_user_data(instance_monitoring_ip, "ubuntu", private_key, monitoring_user_data)

# Configure the TURN server instance
nubomediaManager.run_user_data(instance_turn_ip, "ubuntu", private_key, turn_user_data)
# nubomediaManager.run_user_data(instance_turn_ip, "ubuntu", private_key, turn_user_data)

# Configuring the Controller instance
# Upload the OpenShift Keystore first
Expand All @@ -636,7 +634,8 @@ def autoinstall():
nubomedia_admin_paas,
instance_monitoring_ip,
instance_turn_ip,
instance_turn_ip))
instance_turn_ip,
kms_image))

# Log time needed to boot NUBOMEDIA instances
cfg_time = time.time() - boot_time
Expand Down
1 change: 1 addition & 0 deletions variables-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
openshift_domain = 'apps.nubomedia-paas.eu'

nubomedia_admin_paas = 'nubomediapaas'
use_kurento_on_docker = False

0 comments on commit 7b4ebc4

Please sign in to comment.