Skip to content

itk-dev/borgerdata

Repository files navigation

borgerdata

Proxy service for looking up citizen data stored in a SQL server.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Installing

# Make a .env file based on .env.dist
cp .env.dist .env

docker-compose pull
docker-compose up --detach

docker-compose exec node yarn install

# THE FOLLOWING IS ONLY FOR TEST/DEVELOPMENT - DO NOT RUN IN PRODUCTION

# Make sure there is a database created on the server before running the following commands
docker-compose exec node node createdb.js

# Migrations and seeds are only needed in a test/development context so don't run them in production.
docker-compose exec node yarn knex migrate:latest
docker-compose exec node yarn knex seed:run

You should now be able to send a request and get some data back:

curl http://$(docker-compose port node 8081)/citizen/1234567891

Expected result:

{
  "CPR": "1234567891",
  "Fornavn": "Hans",
  "Mellemnavn": null,
  "Efternavn": "Hansen",
  "Adresseringsnavn": null,
  "Vejnavn": "Testvej",
  "HusNr": "11",
  "Etage": null,
  "Side": null,
  "Adresseringsadresse": null,
  "Bynavn": "Roskilde",
  "Postnummer": "4000",
  "Postdistrikt": null,
  "PostnummerOgBy": null
}

Release

This software does not follow a versioning scheme, instead the latest production ready version is the one in the master branch.

Whenever changes is merged in to the master branch, minimum two things should happen:

The changelog should be updated

All the entries in the [Unreleased] section should be moved to a new entry with the date of the merge as headline. See the changelog for examples.

A docker image should be build and pushed to the package repository:

docker build -t itkdev/borgerdata .
docker tag <DOCKER_IMAGE> docker.pkg.github.com/itk-dev/borgerdata/app:latest
docker push docker.pkg.github.com/itk-dev/borgerdata/app:latest

Deployment

You will need an environment where the following is present:

Place the code in the environment and create a .env file with the following contents:

###> node ###
NODE_ENV=production
###< node ###

###> APP ###
APP_PORT=8081
###< APP ###

SQL_SERVER=<URL-TO-SQL-SERVER>
SQL_PORT=<PORT>
SQL_USER=<USER>
SQL_PASSWORD=<PASSWORD>
SQL_DATABASE=<DATABASE>
SQL_SCHEMA=<SCHEMA>
SQL_TABLE=<TABLE>
#SQL_DOMAIN=<DOMAIN>

Install the dependencies:

yarn install --production

Run the app:

yarn serve

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages