~nchohan/appscale/CassandraMapReduce

« back to all changes in this revision

Viewing changes to AppController/djinn.rb

  • Committer: Jonathan Kupferman
  • Date: 2010-04-21 20:53:02 UTC
  • Revision ID: jkupferman@cs.ucsb.edu-20100421205302-2bab6ftq0tua2knb
Integrated AppMonitoring so that it starts up automatically with AppScale.

Show diffs side-by-side

added added

removed removed

Lines of Context:
848
848
    @state = "Starting up Load Balancer"
849
849
    Djinn.log_debug("Starting up Load Balancer")
850
850
 
851
 
    # This is the port nginx will use to proxy requests to haproxy
852
 
    proxy_port = 8060
853
851
    my_ip = @djinn_locations[@my_index].public_ip
854
 
    HAProxy.create_app_load_balancer_config(my_ip, proxy_port)
855
 
    Nginx.create_app_load_balancer_config(my_ip, proxy_port)
856
 
    Kernel.system "service appscale-loadbalancer start"
 
852
    HAProxy.create_app_load_balancer_config(my_ip, LoadBalancer.proxy_port)
 
853
    Nginx.create_app_load_balancer_config(my_ip, LoadBalancer.proxy_port)
 
854
    LoadBalancer.start
857
855
    Nginx.restart
858
856
    Collectd.restart
859
857
 
860
 
    HAProxy.app_load_balancer_ports.each do |port|
 
858
    head_node_ip = get_public_ip(@database_credentials['hostname'])
 
859
    if my_ip == head_node_ip
 
860
      # Only start monitoring on the head node
 
861
      HAProxy.create_app_monitoring_config(my_ip, Monitoring.proxy_port)
 
862
      Nginx.create_app_monitoring_config(my_ip, Monitoring.proxy_port)
 
863
      Monitoring.start
 
864
    end
 
865
 
 
866
    LoadBalancer.server_ports.each do |port|
861
867
      HelperFunctions.sleep_until_port_is_open("localhost", port)
862
868
      `curl http://localhost:#{port}`
863
869
    end
906
912
 
907
913
  def stop_load_balancer()
908
914
    Djinn.log_debug("Shutting down Load Balancer")
909
 
    Kernel.system "service appscale-loadbalancer stop"
 
915
    LoadBalancer.stop
910
916
  end
911
917
 
912
918
  def start_appengine()