Skip to content

Latest commit

 

History

History
93 lines (74 loc) · 1.97 KB

README.md

File metadata and controls

93 lines (74 loc) · 1.97 KB

cb-proto

Sample Scala http service demonstring use of Scala

Description

Prototype for a quick Scala http4s with skunk service

Prerequisite

Usage

  • Code
  • Database
  • Running the app

Code

git clone [email protected]:kayvank/cb-proto.git
sbt compile
sbt \~test

Database

  • Start db
  • Monitor logs
  • Connect to DB
  • Create the User table

Start database

We use Postgress for this project. My dev machine is Archlinux. To avoid file permission issues:

cd db
mkdir pg_data ## required 
CURRENT_UID=$(id -u):$(id -g) docker-compose up

Database logs

Docker compose is set to log the queries. To tail the queries:

docker ps ## to get the docker PS id o 
docker logs -f PSID

Connect to DB

To connect to Postgress instance:

docker inspect PSID ## extract the IP address 
psql -h IPADDRESS -U q2io 

Creat the User table

psql -h IPADDRESS -U q2io  < ./tables.sql

Running the app

Prerequisites for running the app:

  • environment variables, as described in next section
  • postgreSql instance, as described in previous sections

Next to execute the app:

sbt clean compile bootstrap/run

Environment variables

export APP_ENV=dev
export GOOGLE_API_KEY='some-key'
export PASSWORD_SALT='SAL123'
export POSTGRES_HOST='172.18.0.1'
export POSTGRES_USER_NAME=q2io
export POSTGRES_PASSWORD=password
export POSTGRES_DATABASE=q2io

PostgreSql

For sample payload and tests see the RestClient script Spec.http

Reference

tbd