diff --git a/common/lib/idds/common/utils.py b/common/lib/idds/common/utils.py index 3e391805..428fde66 100644 --- a/common/lib/idds/common/utils.py +++ b/common/lib/idds/common/utils.py @@ -146,6 +146,8 @@ def get_rest_host(): """ Function to get rest host """ + if "IDDS_HOST" in os.environ: + return os.environ.get("IDDS_HOST") host = config_get('rest', 'host') url_prefix = get_rest_url_prefix() while host.endswith("/"): diff --git a/main/lib/idds/agents/conductor/plugins/messaging.py b/main/lib/idds/agents/conductor/plugins/messaging.py index cce41a02..191830fa 100644 --- a/main/lib/idds/agents/conductor/plugins/messaging.py +++ b/main/lib/idds/agents/conductor/plugins/messaging.py @@ -90,17 +90,22 @@ def connect_to_messaging_brokers(self): broker_addresses = [] for b in self.brokers: try: + if ":" in b: + b, port = b.split(":") + else: + port = self.port + addrinfos = socket.getaddrinfo(b, 0, socket.AF_INET, 0, socket.IPPROTO_TCP) for addrinfo in addrinfos: b_addr = addrinfo[4][0] - broker_addresses.append(b_addr) + broker_addresses.append((b_addr, port)) except socket.gaierror as error: self.logger.error('Cannot resolve hostname %s: %s' % (b, str(error))) self.logger.info("Resolved broker addresses: %s" % broker_addresses) - for broker in broker_addresses: - conn = stomp.Connection12(host_and_ports=[(broker, self.port)], + for broker, port in broker_addresses: + conn = stomp.Connection12(host_and_ports=[(broker, port)], vhost=self.vhost, keepalive=True, timeout=self.broker_timeout) @@ -157,17 +162,22 @@ def subscribe(self): broker_addresses = [] for b in self.brokers: try: + if ":" in b: + b, port = b.split(":") + else: + port = self.port + addrinfos = socket.getaddrinfo(b, 0, socket.AF_INET, 0, socket.IPPROTO_TCP) for addrinfo in addrinfos: b_addr = addrinfo[4][0] - broker_addresses.append(b_addr) + broker_addresses.append((b_addr, port)) except socket.gaierror as error: self.logger.error('Cannot resolve hostname %s: %s' % (b, str(error))) self.logger.info("Resolved broker addresses: %s" % broker_addresses) - for broker in broker_addresses: - conn = stomp.Connection12(host_and_ports=[(broker, self.port)], + for broker, port in broker_addresses: + conn = stomp.Connection12(host_and_ports=[(broker, port)], vhost=self.vhost, keepalive=True) conn.set_listener('message-receiver', self.get_listener(conn.transport._Transport__host_and_ports[0])) diff --git a/start-daemon.sh b/start-daemon.sh index 43a0dd86..c37769b3 100755 --- a/start-daemon.sh +++ b/start-daemon.sh @@ -10,10 +10,10 @@ export IDDS_HOME=/opt/idds if [ -f /etc/grid-security/hostkey.pem ]; then echo "host certificate is already created." chmod 600 /etc/grid-security/hostkey.pem -elif [ -f /opt/idds/configmap/hostkey.pem ]; then - echo "mount /opt/idds/configmap/hostkey.pem to /etc/grid-security/hostkey.pem" - ln -fs /opt/idds/configmap/hostkey.pem /etc/grid-security/hostkey.pem - ln -fs /opt/idds/configmap/hostcert.pem /etc/grid-security/hostcert.pem +elif [ -f /opt/idds/certs/hostkey.pem ]; then + echo "mount /opt/idds/certs/hostkey.pem to /etc/grid-security/hostkey.pem" + ln -fs /opt/idds/certs/hostkey.pem /etc/grid-security/hostkey.pem + ln -fs /opt/idds/certs/hostcert.pem /etc/grid-security/hostcert.pem chmod 600 /etc/grid-security/hostkey.pem fi