Skip to content

Dev Backend & datastore

Stig Norland edited this page Oct 2, 2018 · 18 revisions

Pre requirements for running backend

  • An instance of a sql server, this project is configured to run on Postgres, this can be changed in the project configuration file application.properties, if another brand of server is required
    • You will need to configure database name, server name and login details.
    • And create an empty database for Qddt, with a user capable of doing insert, updates and selects
    • You also need to create a schema, audit so that all revision tables have a place to be. If you for some reason cannot or will not keep live data and revisions into 2 seperate schemas, you can configure this in application.properties (read spring documentation, if you are uncertain on how to do that)
  • java openJDK 1.8
  • gradle +4.4

Installation

After fetching the sourcecode ZIP or via git, build the solution with gradlew build and run with gradlew bootRun

After you have started the server, but before login in to the solution for the first time, it is best to run initsqlscript on the database you want to contain qddt data. initSql-script. This will populate the database with default Users, Groups, Agency & lookup tables. All default users have password set to password

Deployment

  • Check which configuration is active, application.properties
    • spring.profiles.active=local|stage|production
  • Build with commando gradle -x test build
  • Copy resulting jar file to a server and run it as a service.

application.properties

server.port=5002
spring.jpa.hibernate.ddl-auto=validate
spring.datasource.url=jdbc:postgresql://sofia.nsd.lan:5432/qddt-prod
spring.datasource.username=qddt
spring.datasource.password=e3nd9fndDS3.

#management.endpoints.web.cors.allowed-origins=https://qddt.nsd.no
api.origin=https://qddt.nsd.no,https://qddt.nsd.no/api

fileroot=/home/deploy/deployment/prod/uploads-to-qddt/`

fileroot needs to be configured, this is a directory for uploaded attachments server.port is the port that this application listen to for requests.