Scala training project
- play json
- jdbc (used by Scala in the Play Framework)
- evolutions
- postgres
- doobie
- Install Docker and postgresql on your machine, if not installed already.
- Launch Docker (this app expects the latest postgres alpine)
- Run the database through terminal commands
- Create the docker container (after creation you can run/press play on the container inside the desktop app):
docker run --name pass-bakery-postgres -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass -e POSTGRES_DB=pass_bakery_db -p 5432:5432 -d postgres:alpine
- Access the docker postgres database (enter
pass
when promtped): psql -h localhost -p 5432 -d pass_bakery_db -U user
- Launch the app on a separate terminal tab (command+T), navigate to the project root, and run with
sbt run
- Apply evolutions when prompted at any endpoint connection
- ONE TIME! Download latest postgres alpine image:
docker pull postgres:alpine
- Create/start the Docker container:
docker run --name pass-bakery-postgres -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass -e POSTGRES_DB=pass_bakery_db -p 5432:5432 -d postgres:alpine
- Access the db:
psql -h localhost -p 5432 -d pass_bakery_db -U user
and enterpass
when prompted for the password- IMPORTANT: if you cannot access the container from the terminal with this command, stop the docker container (easy through the desktop app), delete the container, then start from step 2 again (docker run...)
- Additional Notes:
- Check if
pass_bakery_db
exists by listing databases with\l
- If needed, connect to the database with
\c pass_bakery_db
- View tables with
\d
- Check if