Repository: incubator-zeppelin Updated Branches: refs/heads/master 9b72c8940 -> d2f9e6475
allows zeppelin to be run and managed as a service. ZEPPELIN-641 ### What is this PR for? allows zeppelin to be run and managed as a service, does not start in background via nohup the service manager handles process instead ### What type of PR is it? Improvement ### Todos * None, should work as is ### Is there a relevant Jira issue? ZEPPELIN-641 ### How should this be tested? bin/zeppelin-daemon.sh upstart ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? updated Author: Jeff Steinmetz <[email protected]> Closes #722 from jeffsteinmetz/ZEPPELIN-641 and squashes the following commits: 205f8f0 [Jeff Steinmetz] add zeppelin.conf example to docs 1aab016 [Jeff Steinmetz] allows zeppelin to be run and managed as a service. Jira Ticket ZEPPELIN-641 06ed0a3 [Jeff Steinmetz] allows zeppelin to be run and managed as a service. Jira Ticket ZEPPELIN-641 Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/d2f9e647 Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/d2f9e647 Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/d2f9e647 Branch: refs/heads/master Commit: d2f9e6475e69e0c493e53a00918e0b78780db52c Parents: 9b72c89 Author: Jeff Steinmetz <[email protected]> Authored: Wed Feb 17 14:37:34 2016 -0800 Committer: Felix Cheung <[email protected]> Committed: Sun Feb 21 12:59:08 2016 -0800 ---------------------------------------------------------------------- bin/zeppelin-daemon.sh | 15 ++++++++++++++- docs/install/install.md | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/d2f9e647/bin/zeppelin-daemon.sh ---------------------------------------------------------------------- diff --git a/bin/zeppelin-daemon.sh b/bin/zeppelin-daemon.sh index 041c7a4..56b3c9b 100755 --- a/bin/zeppelin-daemon.sh +++ b/bin/zeppelin-daemon.sh @@ -19,7 +19,7 @@ # description: Start and stop daemon script for. # -USAGE="Usage: zeppelin-daemon.sh [--config <conf-dir>] {start|stop|restart|reload|status}" +USAGE="Usage: zeppelin-daemon.sh [--config <conf-dir>] {start|stop|upstart|restart|reload|status}" if [[ "$1" == "--config" ]]; then shift @@ -152,6 +152,16 @@ function check_if_process_is_alive() { fi } +function upstart() { + + # upstart() allows zeppelin to be run and managed as a service + # for example, this could be called from an upstart script in /etc/init + # where the service manager starts and stops the process + initialize_default_directories + + $ZEPPELIN_RUNNER $JAVA_OPTS -cp $ZEPPELIN_CLASSPATH_OVERRIDES:$CLASSPATH $ZEPPELIN_MAIN >> "${ZEPPELIN_OUTFILE}" +} + function start() { local pid @@ -234,6 +244,9 @@ case "${1}" in stop) stop ;; + upstart) + upstart + ;; reload) stop start http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/d2f9e647/docs/install/install.md ---------------------------------------------------------------------- diff --git a/docs/install/install.md b/docs/install/install.md index 409ee51..38752f5 100644 --- a/docs/install/install.md +++ b/docs/install/install.md @@ -235,3 +235,39 @@ After successful start, visit [http://localhost:8080](http://localhost:8080) wit ``` bin/zeppelin-daemon.sh stop ``` + +#### Start Zeppelin with a service manager such as upstart + +Zeppelin can auto start as a service with an init script, such as services managed by upstart. + +The following is an example upstart script to be saved as `/etc/init/zeppelin.conf` +This example has been tested with Ubuntu Linux. +This also allows the service to be managed with commands such as + +`sudo service zeppelin start` +`sudo service zeppelin stop` +`sudo service zeppelin restart` + +Other service managers could use a similar approach with the `upstart` argument passed to the zeppelin-daemon.sh script: `bin/zeppelin-daemon.sh upstart` + +##### zeppelin.conf + +``` +description "zeppelin" + +start on (local-filesystems and net-device-up IFACE!=lo) +stop on shutdown + +# Respawn the process on unexpected termination +respawn + +# respawn the job up to 7 times within a 5 second period. +# If the job exceeds these values, it will be stopped and marked as failed. +respawn limit 7 5 + +# zeppelin was installed in /usr/share/zeppelin in this example +chdir /usr/share/zeppelin +exec bin/zeppelin-daemon.sh upstart +``` + +
