|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# If anything goes wrong, fail |
| 4 | +exit_err () { |
| 5 | + echo "There was an error, please review the output above and, if appropriate, report a bug on https://github.com/oracle/big-data-lite with the full output of the script." |
| 6 | + exit 1 |
| 7 | +} |
| 8 | +trap 'exit_err' ERR |
| 9 | + |
| 10 | +dir=$(dirname "$(readlink -f $0)") |
| 11 | +thirdparty_root=$dir/inst/ |
| 12 | +zeppelin_version=0.7.0 |
| 13 | +zeppelin_pkg_url=https://archive.apache.org/dist/zeppelin/zeppelin-${zeppelin_version}/zeppelin-${zeppelin_version}-bin-all.tgz |
| 14 | +pgx_interpreter_version=2.3.2 |
| 15 | +pgx_interpreter_pkg_url=http://pgx.us.oracle.com/releases/stable/otn/${pg_interpreter_version}/pgx-${pgx_interpreter_version}-zeppelin-interpreter.zip |
| 16 | + |
| 17 | +cd $dir |
| 18 | + |
| 19 | +if [ "$1" == "install" ]; then |
| 20 | + mkdir -p $thirdparty_root |
| 21 | + zeppelin_pkg=$thirdparty_root/$(basename $zeppelin_pkg_url) |
| 22 | + echo "Setting up Zeppelin, including the PGX interpreter..." |
| 23 | + |
| 24 | + echo "Getting Zeppelin version ${zeppelin_version}..." |
| 25 | + [ -f $zeppelin_pkg ] || |
| 26 | + curl $zeppelin_pkg_url -o $zeppelin_pkg |
| 27 | + echo "Unpacking Zeppelin..." |
| 28 | + tar xf $zeppelin_pkg -C $thirdparty_root |
| 29 | + |
| 30 | + ( |
| 31 | + pgx_interpreter_pkg=$thirdparty_root/$(basename $pgx_interpreter_pkg_url) |
| 32 | + echo "Getting the PGX interpreter version ${pgx_interpreter_version}..." |
| 33 | + [ -f $pgx_interpreter_pkg ] || |
| 34 | + curl $pgx_interpreter_pkg_url -o $pgx_interpreter_pkg |
| 35 | + if [ ! -f $pgx_interpreter_pkg ]; then |
| 36 | + echo "Error: can't download the PGX interpreter; you need to be connected to the Oracle Network (or on VPN)." |
| 37 | + echo "Please connect to the Oracle VPN and run this script again." |
| 38 | + echo "In alternative, download $pgx_interpreter_pkg_url from the Oracle Network and save this archive to $pgx_interpreter_pkg." |
| 39 | + exit 1 |
| 40 | + fi |
| 41 | + echo "Unpacking the PGX interpreter.." |
| 42 | + zeppelin_root=$(find . -maxdepth 2 -type d | grep zeppelin-${zeppelin_version} ) |
| 43 | + unzip $pgx_interpreter_pkg -d $zeppelin_root/interpreter/pgx |
| 44 | + # Do not use https to conect to the PGX server; NB: may need to update the patch |
| 45 | + # when updating the PGX interpreter version |
| 46 | + ( |
| 47 | + cd $dir/$zeppelin_root/interpreter/pgx |
| 48 | + patch -p0 <<EOP |
| 49 | +--- interpreter-setting.json 2017-03-06 11:58:48.000000000 -0500 |
| 50 | ++++ interpreter-setting.json.http 2017-03-07 08:05:20.683000001 -0500 |
| 51 | +@@ -7,7 +7,7 @@ |
| 52 | + "pgx.baseUrl": { |
| 53 | + "envName": "PGX_SERVER_BASEURL", |
| 54 | + "propertyName": "pgx.baseUrl", |
| 55 | +- "defaultValue": "https://localhost:7007", |
| 56 | ++ "defaultValue": "http://localhost:7007", |
| 57 | + "description": "Base URL of a running PGX server this interpreter should connect to" |
| 58 | + }, |
| 59 | + "pgx.trustStore": { |
| 60 | +EOP |
| 61 | + ) |
| 62 | + |
| 63 | + # Register the %pgx interpreter; NB: may need to update the patch |
| 64 | + # when updating the zeppelin version |
| 65 | + cd $zeppelin_root |
| 66 | + rm -f conf/zeppelin-site.xml |
| 67 | + cp conf/zeppelin-site.xml.template conf/zeppelin-site.xml |
| 68 | + patch -p0 <<EOP |
| 69 | +--- conf/zeppelin-site.xml 2017-03-06 08:24:17.617000000 -0500 |
| 70 | ++++ conf/zeppelin-site.xml.pgx 2017-03-06 08:24:01.189000000 -0500 |
| 71 | +@@ -200,7 +200,7 @@ |
| 72 | +
|
| 73 | + <property> |
| 74 | + <name>zeppelin.interpreters</name> |
| 75 | +- <value>org.apache.zeppelin.spark.SparkInterpreter,org.apache.zeppelin.spark.PySparkInterpreter,org.apache.zeppelin.rinterpreter.RRepl,org.apache.zeppelin.rinterpreter.KnitR,org.apache.zeppelin.spark.SparkRInterpreter,org.apache.zeppelin.spark.SparkSqlInterpreter,org.apache.zeppelin.spark.DepInterpreter,org.apache.zeppelin.markdown.Markdown,org.apache.zeppelin.angular.AngularInterpreter,org.apache.zeppelin.shell.ShellInterpreter,org.apache.zeppelin.file.HDFSFileInterpreter,org.apache.zeppelin.flink.FlinkInterpreter,,org.apache.zeppelin.python.PythonInterpreter,org.apache.zeppelin.python.PythonInterpreterPandasSql,org.apache.zeppelin.python.PythonCondaInterpreter,org.apache.zeppelin.python.PythonDockerInterpreter,org.apache.zeppelin.lens.LensInterpreter,org.apache.zeppelin.ignite.IgniteInterpreter,org.apache.zeppelin.ignite.IgniteSqlInterpreter,org.apache.zeppelin.cassandra.CassandraInterpreter,org.apache.zeppelin.geode.GeodeOqlInterpreter,org.apache.zeppelin.postgresql.PostgreSqlInterpreter,org.apache.zeppelin.jdbc.JDBCInterpreter,org.apache.zeppelin.kylin.KylinInterpreter,org.apache.zeppelin.elasticsearch.ElasticsearchInterpreter,org.apache.zeppelin.scalding.ScaldingInterpreter,org.apache.zeppelin.alluxio.AlluxioInterpreter,org.apache.zeppelin.hbase.HbaseInterpreter,org.apache.zeppelin.livy.LivySparkInterpreter,org.apache.zeppelin.livy.LivyPySparkInterpreter,org.apache.zeppelin.livy.LivyPySpark3Interpreter,org.apache.zeppelin.livy.LivySparkRInterpreter,org.apache.zeppelin.livy.LivySparkSQLInterpreter,org.apache.zeppelin.bigquery.BigQueryInterpreter,org.apache.zeppelin.beam.BeamInterpreter,org.apache.zeppelin.pig.PigInterpreter,org.apache.zeppelin.pig.PigQueryInterpreter,org.apache.zeppelin.scio.ScioInterpreter</value> |
| 76 | ++ <value>org.apache.zeppelin.spark.SparkInterpreter,org.apache.zeppelin.spark.PySparkInterpreter,org.apache.zeppelin.rinterpreter.RRepl,org.apache.zeppelin.rinterpreter.KnitR,org.apache.zeppelin.spark.SparkRInterpreter,org.apache.zeppelin.spark.SparkSqlInterpreter,org.apache.zeppelin.spark.DepInterpreter,org.apache.zeppelin.markdown.Markdown,org.apache.zeppelin.angular.AngularInterpreter,org.apache.zeppelin.shell.ShellInterpreter,org.apache.zeppelin.file.HDFSFileInterpreter,org.apache.zeppelin.flink.FlinkInterpreter,,org.apache.zeppelin.python.PythonInterpreter,org.apache.zeppelin.python.PythonInterpreterPandasSql,org.apache.zeppelin.python.PythonCondaInterpreter,org.apache.zeppelin.python.PythonDockerInterpreter,org.apache.zeppelin.lens.LensInterpreter,org.apache.zeppelin.ignite.IgniteInterpreter,org.apache.zeppelin.ignite.IgniteSqlInterpreter,org.apache.zeppelin.cassandra.CassandraInterpreter,org.apache.zeppelin.geode.GeodeOqlInterpreter,org.apache.zeppelin.postgresql.PostgreSqlInterpreter,org.apache.zeppelin.jdbc.JDBCInterpreter,org.apache.zeppelin.kylin.KylinInterpreter,org.apache.zeppelin.elasticsearch.ElasticsearchInterpreter,org.apache.zeppelin.scalding.ScaldingInterpreter,org.apache.zeppelin.alluxio.AlluxioInterpreter,org.apache.zeppelin.hbase.HbaseInterpreter,org.apache.zeppelin.livy.LivySparkInterpreter,org.apache.zeppelin.livy.LivyPySparkInterpreter,org.apache.zeppelin.livy.LivyPySpark3Interpreter,org.apache.zeppelin.livy.LivySparkRInterpreter,org.apache.zeppelin.livy.LivySparkSQLInterpreter,org.apache.zeppelin.bigquery.BigQueryInterpreter,org.apache.zeppelin.beam.BeamInterpreter,org.apache.zeppelin.pig.PigInterpreter,org.apache.zeppelin.pig.PigQueryInterpreter,org.apache.zeppelin.scio.ScioInterpreter,oracle.pgx.zeppelin.PgxInterpreter</value> |
| 77 | + <description>Comma separated interpreter configurations. First interpreter become a default</description> |
| 78 | + </property> |
| 79 | +
|
| 80 | +EOP |
| 81 | + ) |
| 82 | + |
| 83 | + echo "Done; you can run $0 {start | stop} to start / stop the Zeppelin service" |
| 84 | + exit 0 |
| 85 | + |
| 86 | +elif [ "$1" == "start" ]; then |
| 87 | + ( |
| 88 | + cd $thirdparty_root |
| 89 | + zeppelin_root=$(find . -maxdepth 1 -type d | grep zeppelin ) |
| 90 | + unset CLASSPATH |
| 91 | + $zeppelin_root/bin/zeppelin-daemon.sh start |
| 92 | + echo "Remember to start the PGX server in order to be able to use the %pgx interpreter" |
| 93 | + ) |
| 94 | + exit 0 |
| 95 | + |
| 96 | +elif [ "$1" == "stop" ]; then |
| 97 | + ( |
| 98 | + cd $thirdparty_root |
| 99 | + zeppelin_root=$(find . -maxdepth 1 -type d | grep zeppelin ) |
| 100 | + unset CLASSPATH |
| 101 | + $zeppelin_root/bin/zeppelin-daemon.sh stop |
| 102 | + ) |
| 103 | + |
| 104 | + exit 0 |
| 105 | + |
| 106 | +fi |
| 107 | + |
| 108 | +echo "Usage: $0 {install | start | stop}" |
| 109 | +exit -1 |
| 110 | + |
0 commit comments