This project was creates off various example projects to get Play 2.4 working with Bootstrap, Bootswatch and Slick (with PostgreSQL)
It can be run using either activator
or sbt
, packaged using the sbt-native-packager
, which includes zip, tarball and tar-gzip Java Applications, Docker Containers, Windows MSI installers and others.
- Git
- Scala and SBT
- You can also use Activator (included in this repo), but it adds a lot of bloat. Great for bootstrapping templates, but then just use
sbt
- You can also use Activator (included in this repo), but it adds a lot of bloat. Great for bootstrapping templates, but then just use
- Postgres
- Alternatively, Virtualbox and Vagrant
- The steps here will show how to setup the DB locally
- (Optional) Docker Toolbox for Mac and Windows, or Docker Engine for Linux
- (Optional) WIX Tool Set for Windows MSI
- From the root folder containing the
build.sbt
file, the code can be compiled and tested withsbt clean compile test
- Note: the application needs PostgreSQL running when using
sbt run
or when deploying the dist, but the unit test will use H2 In-Memory in PostreSQL compatability mode
- Note: the application needs PostgreSQL running when using
- Realtime development can be done using
sbt run
- this allows code to be hot-compiled and updated- Note: changes to config and build files should ideally be rebuilt by stopping the application
Ctrl + D
and runningsbt clean run
- Note: changes to config and build files should ideally be rebuilt by stopping the application
- You will need to update the
slick.dbs.default.db
entries inconf/application.conf
to point to your PostgreSQL installation
- Several methods are available thanks to the
sbt-native-packager
, the simplest beingsbt dist
, which will drop a self-contained zipped Java application in thetarget/universal
folder- The zip file can be extracted onto any system running Java 8 JRE and started using the appropriate script in the
bin
directory. On Windows, should the batch file give an error, there is an alternativestart.bat
in the root folder. - By default, the config from
conf/application.conf
will be used, so make sure the settings for deploy are correct - Alternatively, new config files for other environments can be added to the
conf
folder, and used by adding-Dconfig.resource=conf/prod.conf
to the command line when executing the packaged app
- The zip file can be extracted onto any system running Java 8 JRE and started using the appropriate script in the
- Another option is to use the
sbt docker:publishLocal
option if you have Docker installed. This will give you a container image to push to your Docker Hub Repo or Amazon ECR account- Using this option, the
docker-compose.yml
file is also useful for testing. - The
ENTRYPOINT
for the Dockerfile is the Java application, so parameters (such as conf override) can be passed in asCMD
s.
- Using this option, the
- You can create an installable MSI file for Windows using
sbt windows:packageBin
- This will install the zip package to a folder where the application can be run from. Running the MSI again allows an uninstall. This requires the WIX Toolset
- Note: Installing the project in the
C:\Program Files (x86)\
folder can cause issues where the application cannot create theRUNNING_PID file
; recommended to install on the root of a drive, eg.C:\play-scala-bootstrap-slick-psql\
- Following the config options here alternatives such as Debian PKG and Red-Hat RPM files can also be created