Lupapisteen tiedonohjausjärjestelmä (TOJ) / sähköinen arkistonmuodostusssuunnitelma (eAMS)
Run it like this:
$ java -jar lupapiste-toj.jar [args]
Choose option 1 or 2 (whatever is easier for you).
Install MongoDB >= 5.0 and create a database called toj
. Your MongoDB should not enforce authentication.
See config.edn
for the default configuration. Currently there are no facilities for overriding the settings in
config.edn
in an another file, so if you change the config, make sure not to accidentally commit the changes.
Lupapiste MongoDB container requires authentication, while in this project MongoDB is accessed by default without authentication.
As a workaround, modify connection strings in lupapiste-toj.test-helpers
and in config.edn
as follows:
mongodb://<mongo user name>:<mongo user pwd>@localhost/<default database>?authSource=<db where users are stored>
You can use existing lupapiste user for authentication: It has sufficient access rights by default. If you do so, check
username and password from user.properties
file in lupapiste repository root and use lupapiste
as authSource.
In the end, connection string should be something like this: mongodb://user:pwd@localhost/toj?authSource=lupapiste
in config.edn or mongodb://user:pwd@localhost/test-db?authSource=lupapiste
for tests, where user
and pwd
are same
as in user.properties
file in Lupapiste repository.
Alternatively you can create own user(s) for TOJ development and tests using MongoDB's db.createUser function and setup
them accordingly in lupapiste-toj.test-helpers
and in config.edn
.
When connecting with SSL/TLS encryption, add ssl=true
to the end of the connection string, e.g.:
mongodb://toj:<mongo user pwd>@server.domain.tld/toj?ssl=true
NOTE: DO NOT commit your configs into GitHub remote repository.
Link (or checkout) lupapiste-commons to checkouts/lupapiste-commons. This is required for running Figwheel.
mkdir checkouts
cd checkouts
# *nix:
ln -s /path/to/lupapiste/commons lupapiste-commons
# Windows, Command Prompt run as administrator:
mklink /j lupapiste-commons \path\to\lupapiste\commons\
Install Karma and dependencies (required only for JS tests)
$ lein npm install
Create a file named sessionkey
that contains 16 bytes of random data.
Copy or link the file in lupapiste-toj and lupapiste projects' root directory
(working directory when running the servers).
Session key must be same as in Lupapiste and in TOJ!
Start figwheel to compile ClojureScript on the background and to provide a CLJS REPL. Figwheel also takes care of reloading CSS.
$ lein figwheel
The classic figwheel seems to work poorly with at least Apple Silicon Macs though, so automatic reloading is currently disabled, and you need to reload the page manually after changes.
If you are going to edit LESS style files, start the LESS compiler in watch mode with
$ npm run less-watch
The latest compiled main.css should be committed to Git.
Run a repl
$ lein repl
Start server in repl, following Stuart Sierra's Reloaded Workflow
user=> (go)
Browse to http://localhost:8010
To log in to TOJ you need to:
- Start Lupapiste dev server
- Start TOJ dev server (see above)
- Log in as a user in Lupapiste app (http://localhost:8000)
- After successful login navigate to TOJ dev site in http://localhost:8010 (This works because the session is shared.)
Run (tests once)
$ lein test
NOTE: Tests are in fact integration tests and you need to have working MondoDB instance (see above). There have also been capability to run tests automatically, but at the moment (2022-08-29) it does not work.
Compile CLJS tests
$ lein cljsbuild test
Run ClojureScripts tests ion Chrome:
$ npm run test-cljs
Or on CI with JUnit report:
$ npm run test-cljs:ci
This is slightly involved now, here are steps for adding a new test:
- Add test namespace under
test/cljs/
folder using conventionlupapiste-toj.bar-test
- Edit
karma.adapter
namespace (undertest/cljs/karma
folder): - Require the new namespace in the
ns
form- This is needed to actually load the test namespace
Copyright © 2024 Cloudpermit Oy
Distributed under the European Union Public Licence (EUPL) version 1.2.