Skip to content

Commit

Permalink
Adding Debian configuration to have a clean Upstart and Systemd boot
Browse files Browse the repository at this point in the history
	new file:   .debian.build.conf.example
	modified:   .gitignore
	new file:   Makefile
	modified:   build.sbt
	new file:   project/DebianProperties.scala
  • Loading branch information
Francois Bayart committed Apr 5, 2016
1 parent d838c0d commit 1e773ad
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .debian.build.conf.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
debian {
maintainer = "Francois Bayart <[email protected]>"
server_loading = "Upstart"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.akka-cookie
.main.build.conf
.docker.build.conf
.debian.build.conf
project/target/
target/
logs/
Expand Down
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
25 changes: 24 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand Down Expand Up @@ -142,7 +166,6 @@ dependencyOverrides += log4j

dependencyOverrides += guava

enablePlugins(DebianPlugin)

sharedSettings

Expand Down
15 changes: 15 additions & 0 deletions project/DebianProperties.scala
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>")

val serverLoading = getString("debian.server_loading", "Systemd") match {
case "Systemd" => Systemd
case "SystemV" => SystemV
case "Upstart" => Upstart
}

}

0 comments on commit 1e773ad

Please sign in to comment.