Bootstrap a REST and/or GraphQL(Sangria) service with Play2, isolated Slick and isolated Flyway
This project is built with:
- Play Framework 2.8.X
- Slick 3.3.X
- Flyway-sbt & Flyway-Core 7.1.X
- Akka 2.6.X
- Sangria 2.0 for GraphQL
- Scala 2.13.X
A PostgreSQL Database with activated postgis extensions is needed (for geolocation queries)
- Play2-Bootstrap
- Status
- Getting Started
- Documentation
- Dependencies
- Miscellaneous
- Licenses
- Changes
- Contributors
To load innFactory-scala-utils a Github-Personal-Access-Token with package:read has to be exported as GITHUB_TOKEN. This is necessary to load the packages from Github-Package-Registry.
-
Configure Environment in Insomnia to match with local or prod/staging services
- Install Docker
- Install sbt
- Install openJDK 11
- firebase.json (Firebase Service-Account-Access json with firebase-admin-sdk rights) in ./conf/
If prerequisites are met, the service can be started with:
cd ./local-runner
./runFor.sh
- Name mentioned in logs:
./local-runner/runFor.sh -n Name
- Remove docker container volume mounted at ./local-runner/postigs:
./local-runner/runFor.sh -r
Service is then locally available at: http://localhost:9000
- Sorry, no out of the box solution
Service Account from Google Cloud for the Firebase Admin Sdk. Needs Editor role.
- PostgresQl Database with Password and User set. Needs Postgis Plugin fully installed.
- 1. Filter ()
- 2. Controller (Http Request Handling)
- 3. Repository (Data handling)
- 4. DAOs (Database Access)
See here for Deployment and Environment Documentation
- Some requests will require a Firebase JWT Token in the Authorization Header
- The Firebase.json file has to be present and filled at ./conf/firebase.json
This has to be run first
sbt flyway/flywayMigrate
You will need to run the flywayMigrate task first, and then you will be able to generate tables using slickGen.
sbt slickGen
after that you will have to mark the folder target/scala-x.xx/scr_managed as "generated sources root"
You can find a setup script in .bin/setup
. Run it from your projects root with
.bin/setup/setup.sh
It supports bootstrapping your project to rename the project and domain with
.bin/setup/setup.sh bootstrap
As well as creating new packages with
.bin/setup/setup.sh package
You need to repackage the setup application, located in .bin/setup
, if you made some changes to it
# Assuming you are located in your applications root
cd .bin/setup
sbt assembly
cd ../..
You can run functional tests against an in memory database and Slick easily with Play from a clean slate:
For local Testing:
./deployment/runtest.sh
A Postgis Database has to be available to run:
sbt ciTests
To run the project, start up Play:
sbt run
And that's it!
The service locally aviable at: http://localhost:9000
Liceses Markdown: Last updated (18.06.2020)
Changes Markdown: Changes