From 1e773ad5baf803ca1bb73f97b23a87e277dc8c19 Mon Sep 17 00:00:00 2001 From: Francois Bayart Date: Tue, 5 Apr 2016 15:15:30 +0000 Subject: [PATCH] Adding Debian configuration to have a clean Upstart and Systemd boot new file: .debian.build.conf.example modified: .gitignore new file: Makefile modified: build.sbt new file: project/DebianProperties.scala --- .debian.build.conf.example | 4 ++++ .gitignore | 1 + Makefile | 37 ++++++++++++++++++++++++++++++++++ build.sbt | 25 ++++++++++++++++++++++- project/DebianProperties.scala | 15 ++++++++++++++ 5 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 .debian.build.conf.example create mode 100644 Makefile create mode 100644 project/DebianProperties.scala diff --git a/.debian.build.conf.example b/.debian.build.conf.example new file mode 100644 index 00000000..0633bd60 --- /dev/null +++ b/.debian.build.conf.example @@ -0,0 +1,4 @@ +debian { + maintainer = "Francois Bayart " + server_loading = "Upstart" +} diff --git a/.gitignore b/.gitignore index 228fa1b1..cda0800d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ .akka-cookie .main.build.conf .docker.build.conf +.debian.build.conf project/target/ target/ logs/ diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..103e8c21 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +SHELL=/bin/bash + +help: ## This help dialog. + @IFS=$$'\n' ; \ + help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \ + printf "%-30s %s\n" "target" "help" ; \ + printf "%-30s %s\n" "------" "----" ; \ + for help_line in $${help_lines[@]}; do \ + IFS=$$':' ; \ + help_split=($$help_line) ; \ + help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \ + help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \ + printf '\033[36m'; \ + printf "%-30s %s" $$help_command ; \ + printf '\033[0m'; \ + printf "%s\n" $$help_info; \ + done + +all: help + +run: ## start server with mode DEV on port 9002 + sbt ~run -Dhttp.port=9000 # -Dconfig.file=/FULL PATH TO YOUR LOCAL DEV CONF FILE/dev.conf + +console: ## start console + sbt console + +package: ## create Debian package + sbt debian:packageBin + +secret: ## Get a new secret key (not saved) + sbt playGenerateSecret + +check: ## check Scala style + sbt scalastyle + +scalastyleconfig: ## Generate configuration for scalastyle + sbt scalastyleGenerateConfig diff --git a/build.sbt b/build.sbt index a2013fea..265ac05c 100644 --- a/build.sbt +++ b/build.sbt @@ -32,6 +32,8 @@ net.virtualvoid.sbt.graph.Plugin.graphSettings import com.typesafe.sbt.SbtNativePackager.autoImport.NativePackagerHelper._ +import com.typesafe.sbt.packager.archetypes.ServerLoader.{SystemV, Upstart, Systemd} + import com.typesafe.sbt.packager.docker._ dockerBaseImage := DockerProperties.baseImage @@ -46,6 +48,28 @@ dockerRepository := DockerProperties.registry //Docker packageName in Docker := "spark-notebook" + +// DEBIAN PACKAGE +enablePlugins(DebianPlugin) + +name in Debian := MainProperties.name + +maintainer in Debian := DebianProperties.maintainer + +packageSummary in Debian := "Data Fellas Spark-notebook" + +packageDescription := "Interactive and Reactive Data Science using Scala and Spark. http://spark-notebook.io/" + +debianPackageDependencies in Debian += "java7-runtime" + +serverLoading in Debian := DebianProperties.serverLoading + +daemonUser := MainProperties.name + +daemonGroup := (daemonUser in Debian).value + +version := sys.props.get("deb-version").getOrElse(version.value) + ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) } @@ -142,7 +166,6 @@ dependencyOverrides += log4j dependencyOverrides += guava -enablePlugins(DebianPlugin) sharedSettings diff --git a/project/DebianProperties.scala b/project/DebianProperties.scala new file mode 100644 index 00000000..105d3352 --- /dev/null +++ b/project/DebianProperties.scala @@ -0,0 +1,15 @@ + +import com.typesafe.sbt.packager.archetypes.ServerLoader.{SystemV, Upstart, Systemd} + +object DebianProperties extends BuildConf { + val fileName = ".debian.build.conf" + + val maintainer = getString("debian.maintainer", "Andy Petrella ") + + val serverLoading = getString("debian.server_loading", "Systemd") match { + case "Systemd" => Systemd + case "SystemV" => SystemV + case "Upstart" => Upstart + } + +}