- JDK 1.8
- node
MacOS users install docker with command brew cask install dockertoolbox
.
- Create new docker-machine
docker-machine create --driver virtualbox dockerVM
- Run
docker-machine env dockerVM
and check DOCKER_HOST variable - Edit /etc/hosts. Add line
<docker-host-ip-goes-here> hakuperusteetdb
docker run -d -p 5432:5432 postgres
psql -hhakuperusteetdb -p5432 -Upostgres postgres -c "CREATE ROLE OPH;"
psql -hhakuperusteetdb -p5432 -Upostgres postgres -c "CREATE DATABASE hakuperusteet;"
psql -hhakuperusteetdb -p5432 -Upostgres postgres -c "CREATE DATABASE hakuperusteettest;"
To start docker again (e.g. after boot), run the following command and continue from step 2 above.
docker-machine start dockerVM
To start hakuperusteet after Postgres is up, run the following commands:
npm install
./sbt run
- Access hakuperusteet at https://localhost:18080/hakuperusteet/
npm run watch
on separate console to enable front auto compile
By default hakuperusteet uses services from Luokka-environment.
Mock configuration does not have any external dependencies (except Google Authentication, but email one can be used). This setup needs a running mock server, which should be started with following commands first:
cd mockserver
npm install
node server.js
or use nodemon to auto reload on changes
npm install -g nodemon
nodemon server.js
Mock configuration is enabled when running the following command:
./sbt run -J-Dmock=true
This project has multiple configuration files, which are used for following purposes.
- Development time configuration file, which uses luokka-environment
- Development time configuration file, which uses mock server (see below).
- This file is the configuration template used with real environments.
- This file is used during unit and UI-tests, uses mock server and Postgres. Both mock server and Posgres has different ports than in reference.conf above. Unit tests do not use mock server, hence their port numbers are irrelevant.
- This optional config files is used to enable in-memory HSQLDB. Used with UI-tests, because Bamboo does not have Postgres.
To create assembly jars (app and admin), run the following commands
npm install
./sbt assembly
./sbt admin:assembly
Currently we store generated Postgres-client classes in git, and hence it is not necessary to run this normally. During development, after schema changes you must regenerate db-classes with command:
./sbt "run-main fi.vm.sade.hakuperusteet.db.CodeGenerator"
Remember to create separate schema migration script for HSQLDB also, and ensure that UI-tests continue to work.
./sbt "test:run-main fi.vm.sade.hakuperusteet.db.CodeGeneratorTest"
./sbt "test:run-main fi.vm.sade.hakuperusteet.HakuperusteetTestServer" -J-DuseHsql=true
./node_modules/.bin/mocha-phantomjs --ignore-resource-errors --ssl-protocol=any --ignore-ssl-errors=true https://localhost:18081/hakuperusteet/spec/testRunner.html
To run tests in browser, open following url after steps 1. and 2. above.
Remember to remove HSQLD-client classes after tests, because their existence breaks unit tests
rm -r src/test/scala/fi/vm/sade/hakuperusteet/db/generated/