You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by ab...@apache.org on 2022/09/07 14:00:19 UTC

[druid] branch 24.0.0 updated: Add CTA and fix typo (#13009) (#13039)

This is an automated email from the ASF dual-hosted git repository.

abhishek pushed a commit to branch 24.0.0
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/24.0.0 by this push:
     new d9607a667b Add CTA and fix typo (#13009) (#13039)
d9607a667b is described below

commit d9607a667bf751eb217930c5a691ebf0f0fe6d83
Author: Vadim Ogievetsky <va...@ogievetsky.com>
AuthorDate: Wed Sep 7 07:00:11 2022 -0700

    Add CTA and fix typo (#13009) (#13039)
    
    * Add CTA and fix typo
    
    * resolve hostname better
---
 .gitignore                                         |  2 +-
 examples/bin/greet                                 | 32 ++++++++++++++++++++++
 examples/bin/supervise                             | 21 ++++++++++++--
 examples/conf/supervise/single-server/large.conf   |  1 +
 examples/conf/supervise/single-server/medium.conf  |  1 +
 .../supervise/single-server/micro-quickstart.conf  |  1 +
 .../supervise/single-server/nano-quickstart.conf   |  1 +
 examples/conf/supervise/single-server/small.conf   |  1 +
 examples/conf/supervise/single-server/xlarge.conf  |  1 +
 9 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index 89eabfcbdd..f906e24267 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,5 +25,5 @@ README
 .pmdruleset.xml
 .java-version
 integration-tests/gen-scripts/
-bin/
+/bin/
 *.hprof
diff --git a/examples/bin/greet b/examples/bin/greet
new file mode 100755
index 0000000000..94e0a26350
--- /dev/null
+++ b/examples/bin/greet
@@ -0,0 +1,32 @@
+#!/usr/bin/env perl
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+use strict;
+use warnings;
+use Sys::Hostname qw/hostname/;
+
+my $h = hostname;
+system("host \Q$h\E >/dev/null 2>&1");
+my $h_valid = !$?;
+
+print "Starting Apache Druid.\n";
+print "Open http://localhost:8888/" . 
+        ($h_valid ? " or http://$h:8888/" : "") . 
+        " in your browser to access the web console.\n";
+print "Or, if you have enabled TLS, use https on port 9088.\n"
diff --git a/examples/bin/supervise b/examples/bin/supervise
index aaccce6d18..81b7e57b04 100755
--- a/examples/bin/supervise
+++ b/examples/bin/supervise
@@ -55,12 +55,13 @@ sub read_config_file
 
   my @commands;
   my @verify;
+  my @notify;
   my $kill_timeout;
   while (my $line = <$config_fh>) {
     chomp $line;
     next if $line =~ /^(\s*\#.*|\s*)$/;
 
-    if ($line =~ /^(:verify|:kill-timeout|(?:\!p[0-9]+\s+)?[^:]\S+)\s+(.+)$/) {
+    if ($line =~ /^(:verify|:notify|:kill-timeout|(?:\!p[0-9]+\s+)?[^:]\S+)\s+(.+)$/) {
       my $name = $1;
       my $order = 50;
       my $command = $2;
@@ -72,6 +73,8 @@ sub read_config_file
 
       if ($name eq ':verify') {
         push @verify, $command;
+      } elsif ($name eq ':notify') {
+        push @notify, $command;
       } elsif ($name eq ':kill-timeout') {
         $kill_timeout = int($command);
       } else {
@@ -92,7 +95,7 @@ sub read_config_file
   }
 
   close $config_fh;
-  return { commands => \@commands, verify => \@verify, 'kill-timeout' => $kill_timeout };
+  return { commands => \@commands, verify => \@verify, notify => \@notify, 'kill-timeout' => $kill_timeout };
 }
 
 sub stringify_exit_status
@@ -136,6 +139,8 @@ sub pretty
       return "\x1b[1m$text\x1b[0m";
     } elsif ($color eq 'red') {
       return "\x1b[31m\x1b[1m$text\x1b[0m";
+    } elsif ($color eq 'green') {
+      return "\x1b[32m\x1b[1m$text\x1b[0m";
     } else {
       return $text;
     }
@@ -236,8 +241,18 @@ $SIG{TERM} = sub { if (!$killed) { $killed = 15; $killkill = time + $opt{'kill-t
 # Build up control fifo command over multiple sysreads, potentially
 my $fifobuffer = '';
 
+# Run notification commands and print their output
+for my $notify_cmd (@{$config->{notify}}) {
+  my $notify_output = qx[$notify_cmd 2>&1];
+  if (!$?) {
+    for my $notify_line (split /\n/, $notify_output) {
+      logit pretty($notify_line, 'green');
+    }
+  }
+}
+
 if (defined $opt{svlogd}) {
-  logit "Staring services with log directory [svdir].";
+  logit "Starting services with log directory [$svdir].";
 } else {
   logit "Starting services with log directory [$logdir].";
 }
diff --git a/examples/conf/supervise/single-server/large.conf b/examples/conf/supervise/single-server/large.conf
index 2f7baf6fa5..9dde5eaa33 100644
--- a/examples/conf/supervise/single-server/large.conf
+++ b/examples/conf/supervise/single-server/large.conf
@@ -1,5 +1,6 @@
 :verify bin/verify-java
 :verify bin/verify-default-ports
+:notify bin/greet
 :kill-timeout 10
 
 !p10 zk bin/run-zk conf
diff --git a/examples/conf/supervise/single-server/medium.conf b/examples/conf/supervise/single-server/medium.conf
index 84d15caba9..78d43ac526 100644
--- a/examples/conf/supervise/single-server/medium.conf
+++ b/examples/conf/supervise/single-server/medium.conf
@@ -1,5 +1,6 @@
 :verify bin/verify-java
 :verify bin/verify-default-ports
+:notify bin/greet
 :kill-timeout 10
 
 !p10 zk bin/run-zk conf
diff --git a/examples/conf/supervise/single-server/micro-quickstart.conf b/examples/conf/supervise/single-server/micro-quickstart.conf
index de1c0f8d68..78d43a3fd8 100644
--- a/examples/conf/supervise/single-server/micro-quickstart.conf
+++ b/examples/conf/supervise/single-server/micro-quickstart.conf
@@ -1,5 +1,6 @@
 :verify bin/verify-java
 :verify bin/verify-default-ports
+:notify bin/greet
 :kill-timeout 10
 
 !p10 zk bin/run-zk conf
diff --git a/examples/conf/supervise/single-server/nano-quickstart.conf b/examples/conf/supervise/single-server/nano-quickstart.conf
index 8baf769802..918b368340 100644
--- a/examples/conf/supervise/single-server/nano-quickstart.conf
+++ b/examples/conf/supervise/single-server/nano-quickstart.conf
@@ -1,5 +1,6 @@
 :verify bin/verify-java
 :verify bin/verify-default-ports
+:notify bin/greet
 :kill-timeout 10
 
 !p10 zk bin/run-zk conf
diff --git a/examples/conf/supervise/single-server/small.conf b/examples/conf/supervise/single-server/small.conf
index ef4cad54da..ef88416949 100644
--- a/examples/conf/supervise/single-server/small.conf
+++ b/examples/conf/supervise/single-server/small.conf
@@ -1,5 +1,6 @@
 :verify bin/verify-java
 :verify bin/verify-default-ports
+:notify bin/greet
 :kill-timeout 10
 
 !p10 zk bin/run-zk conf
diff --git a/examples/conf/supervise/single-server/xlarge.conf b/examples/conf/supervise/single-server/xlarge.conf
index dbec43f4e7..e0d6c638b7 100644
--- a/examples/conf/supervise/single-server/xlarge.conf
+++ b/examples/conf/supervise/single-server/xlarge.conf
@@ -1,5 +1,6 @@
 :verify bin/verify-java
 :verify bin/verify-default-ports
+:notify bin/greet
 :kill-timeout 10
 
 !p10 zk bin/run-zk conf


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org