Sample Scala http service demonstring use of Scala
Prototype for a quick Scala http4s with skunk service
- Java 11 or better
- docker-compose
- sbt
- Code
- Database
- Running the app
git clone [email protected]:kayvank/cb-proto.git
sbt compile
sbt \~test
- Start db
- Monitor logs
- Connect to DB
- Create the User table
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
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
To connect to Postgress instance:
docker inspect PSID ## extract the IP address
psql -h IPADDRESS -U q2io
psql -h IPADDRESS -U q2io < ./tables.sql
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
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
For sample payload and tests see the RestClient script Spec.http
tbd