Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/innfactory/bootstrap-play2
A scala bootstrap template for the play 2 framework to build real world applications.
https://github.com/innfactory/bootstrap-play2
akka docker firebase google-cloud play2 play2-bootstrap postgres sbt sbt-native-packager scala slick webservices
Last synced: 24 days ago
JSON representation
A scala bootstrap template for the play 2 framework to build real world applications.
- Host: GitHub
- URL: https://github.com/innfactory/bootstrap-play2
- Owner: innFactory
- License: apache-2.0
- Created: 2018-09-24T19:57:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-24T00:27:57.000Z (about 2 months ago)
- Last Synced: 2024-10-24T14:33:42.103Z (about 2 months ago)
- Topics: akka, docker, firebase, google-cloud, play2, play2-bootstrap, postgres, sbt, sbt-native-packager, scala, slick, webservices
- Language: Scala
- Homepage: https://innfactory.de
- Size: 1.2 MB
- Stars: 14
- Watchers: 4
- Forks: 2
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Play2-Bootstrap
### Status
[![codecov](https://codecov.io/gh/innFactory/bootstrap-play2/branch/master/graph/badge.svg)](https://codecov.io/gh/innFactory/bootstrap-play2) ![Run Tests](https://github.com/innFactory/bootstrap-play2/workflows/Run%20Tests/badge.svg) [![Mergify Status][mergify-status]][mergify]
[mergify]: https://mergify.io
[mergify-status]: https://img.shields.io/endpoint.svg?url=https://gh.mergify.io/badges/innFactory/bootstrap-play2&style=flat###### Scala, Akka, Play2, Slick, Flyway, Insomnia, Sangria, GraphQL, Firebase
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)
## Table of Contents:- [Play2-Bootstrap](#play2-bootstrap)
- [Status](#status)
- [Getting Started](#getting-started)
- [Quickstart Dev Guide](#see-quickstart-dev-guidedocquickstartdevguidemd)
- [MacOS/Linux/Unix](#macoslinuxunix)
- [Prerequisites](#prerequisites)
- [Run Locally](#run-locally)
- [Windows](#windows)
- [Documentation](#documentation)
- [Dependencies](#dependencies)
- [Service Accounts](#service-accounts)
- [Database](#database)
- [Miscellaneous](#miscellaneous)
- [Testing](#testing)
- [Database Migration](#database-migration)
- [Code Generation Slick](#slick-code-generation)
- [Running](#running)
- [Licenses](#licenses)
- [Changes](#changes)
- [Contributors](#contributors)## Getting Started
#### IMPORTANT:
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.#### See [Quickstart Dev Guide](./doc/QuickstartDevGuide.md)
#### Insomnia:
- [Download Insomnia](https://insomnia.rest/download) | [Docs](https://support.insomnia.rest/)
- Download and import to Insomnia:- Configure Environment in Insomnia to match with local or prod/staging services
#### MacOS/Linux/Unix:
##### Prerequisites:
- Install Docker
- Install sbt
- Install openJDK 11
- firebase.json (Firebase Service-Account-Access json with firebase-admin-sdk rights) in __./conf/__##### Run locally:
If prerequisites are met, the service can be started with:
```bash
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:
[RunForScriptDocs](local-runner/runForDoc.md)
#### Windows:
- Sorry, no out of the box solution
## Dependencies:
#### Service Accounts:
##### ./conf/firebase.json
Service Account from Google Cloud for the Firebase Admin Sdk. Needs **Editor** role.
#### Databases:
- **PostgresQl** Database with Password and User set. Needs Postgis Plugin fully installed.
## Documentation
###### Request Flow
- [1. Filter ()](./doc/FilterDoc.md)
- [AccessLoggingFilter](./doc/FilterDoc.md#AccessLoggingFilter)
- [RouteBlacklistFilter](./doc/FilterDoc.md#RouteBlacklistFilter)
- [2. Controller (Http Request Handling)](./doc/ControllerDoc.md)
- [3. Repository (Data handling)](./doc/RepositoryDoc.md)
- [4. DAOs (Database Access)](./doc/DaoDoc.md)
- [BaseDAO](./doc/DaoDoc.md#BaseSlickDAO)## Deployment and Environment
See here for [Deployment and Environment Documentation](./doc/Deployment.md)
## Authentication
- 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## Miscellaneous
### Database Migration
This has to be run first
```bash
sbt flyway/flywayMigrate
```### Slick Code Generation
You will need to run the flywayMigrate task first, and then you will be able to generate tables using slickGen.
```bash
sbt slickGen
```after that you will have to mark the folder target/scala-x.xx/scr_managed as "generated sources root"
### Setup
You can find a setup script in `.bin/setup`. Run it from your projects root with
```bash
.bin/setup/setup.sh
```It supports bootstrapping your project to rename the project and domain with
```bash
.bin/setup/setup.sh bootstrap
```As well as creating new packages with
```bash
.bin/setup/setup.sh package
```You need to repackage the setup application, located in `.bin/setup`, if you made some changes to it
```bash
# Assuming you are located in your applications root
cd .bin/setup
sbt assembly
cd ../..
```## Testing
You can run functional tests against an in memory database and Slick easily with Play from a clean slate:
For local Testing:
```bash
./deployment/runtest.sh
```#### For CI:
A Postgis Database has to be available to run:
```bash
sbt ciTests
```## Running
###### Before Running this you have to run: slickGen and ciTest
To run the project, start up Play:
```bash
sbt run
```And that's it!
The service locally aviable at:
## Licenses:
Liceses Markdown: [Last updated (18.06.2020)](doc/licenses.md)## Changes:
Changes Markdown: [Changes](doc/changes.md)## Contributors: