Play seed project setups

PSPS is a regular Play application. As such, it does not need much setup beyond an available JVM. This page shows how to set up PSPS, or relevant external systems. If you want to start playing with it, we recommend downloading the source, setting up a database (see below) and running it using sbt.

Database

PSPS uses PostgreSQL for storing user data. To set up a database in PostgreSQL, open the psql console ant type the following commands.

  • create role base_app_user with password 'base_app_pass';

  • create database base_app with template=template0 LC_COLLATE='C';

  • grant ALL PRIVILEGES on DATABASE base_app TO base_app_user;

  • ALTER ROLE base_app_user WITH LOGIN;

  • On some configurations, you also need to adjust user authentication

    • Need to edit the permission file. See where it’s located by typing: SHOW hba_file;

    • from local using password by adding the below line at the top:

      host base_app base_app_user md5

      (for local unix sockets, use local rather than host)

    • Now reload the configuration by typing in psql console: select pg_reload_conf();

Adding users

Add first user by POSTing the following json to $SERVER/bkofc/api/users:

NOTE: This endpoint is available from localhost only.

{
  username: "<username>",
  password: "<password>",
  email: "<email>"
}
The add-user script in the scripts allows adding users from the command-line (using this API behind the scenes).
The bkofc part of the endpoint URL stands for "back office".

Email Setup

PSPS sends emails in certain events (forgotten password, user invitations etc.). To allow this, you must update the play.mailer part of the configuration with the details of the sending email account.

Setting up

When running the application from the commandline, don’t forget to point it to the correct configuration file. the command below does that, and allows forward0only evolutions (only !Ups, no !Downs).

./current/bin/base-app -Dconfig.file=./current/conf/server.conf -Dplay.evolutions.db.default.autoApply=true