Home

Awesome

play-heroku-seed README

You can try a deployed instance of the app here: https://afternoon-wildwood-5782.herokuapp.com/

This application is meant to make it easier to create a Play application with basic Create, Read, Update and Delete functionality and get it up onto Heroku. Database manipulation is handled by Slick connected to PostgreSQL.

Getting started

You can deploy your own copy of the app on Heroku using this button:

Deploy to Heroku

Local development on OSX

Database Setup

Run the application

Development

Common database tasks
  1. Open psql, connect to the database: \c play_heroku_seed;
  2. View user table data: SELECT * FROM "user";

Note: "user" is also a keyword in PostgreSQL, if you enter this command without quotation marks, it will not select from the play_heroku_seed user table, but instead will output from PostgreSQL's internal database users table and you will get something like this:

play_heroku_seed=# SELECT * FROM user;
 current_user
--------------
 Mashallah
(1 row)
Introducing model changes to the database

If you modify the models, and you do not care about current production data (still before launch):

  1. Stop the application
  2. Delete conf/evolutions/default/1.sql
  3. Open psql, reset the database by doing the following: DROP DATABASE play_heroku_seed; CREATE DATABASE play_heroku_seed;
  4. Run the application, visit localhost:9000

A 1.sql file reflecting the current state of the application models will be auto-generated by slick, auto-applied by play, and now running. If a 1.sql file was not generated, you have likely introduced a change to the model that slick cannot interpret.

Slick is currently unable to generate incremental database evolution files to make those changes. It can only generate a complete snapshot of the application models at any point. If you want to introduce incremental changes to the models, you will need to manually write the SQL database evolutions.

Procfile

The app will run without a Procfile, as the necessary settings have been put in application.conf, are read by Heroku's default Procfile settings in the scala buildpack and are applied.

The Procfile is included in this app for reference and best practices.Heroku reads the Procfile and attempts to initialize the app in build.sbt with the same name.

Procfile:

web: target/universal/stage/bin/play-heroku-seed

build.sbt:

name := """play-heroku-seed"""

If you modify the application name in the Procfile, make sure you update the application name in build.sbt. If the names do not match, the web process will fail to start on Heroku.

Requests for contribution