kids-first / riff

:construction: A Microservice for URL Shortening and sharing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Riff


A Microservice for URL shortening and sharing.

Release Candidate

Table of Contents

Introduction

License: AGPL v3 Codacy Badge CircleCI Slack

Features

See: https://kf-strides-riff.kidsfirstdrc.org/swagger-ui.html for API documentation

Requirements

The application can be run locally or in a docker container, the requirements for each setup are listed below.

Keycloak

A running instance of Keycloak is required to generate the Authorization tokens and to verify the tokens.

Keycloak can be run locally in a docker container see here or you can use the QA instance.

Local

Docker

PostgreSQL

Easy to run in a docker container:

docker run --name Riff_PostgreSQL -e POSTGRES_PASSWORD=postgres -e POSTGRES_USERNAME=postgres -p 5432:5432 -d postgres

Make sure to create database and the schema (see flyway migration scripts).

Database Migrations with Flyway

Database migrations and versioning is managed by flyway.

  1. Download the flyway cli client here: flyway-commandline
  2. Unpack the client in a directory of your choosing
  3. Execute the flyway client pointing it to the configuration and migration directories in this repository.

Get current version information:

./flyway -configFiles=<path_to_riff>/riff/src/main/resources/flyway/conf/flyway.conf -locations=filesystem:<path_to_riff>/riff/src/main/resources/flyway/sql info

Run outstanding migrations:

./flyway -configFiles=<path_to_riff>/riff/src/main/resources/flyway/conf/flyway.conf -locations=filesystem:<path_to_riff>/riff/src/main/resources/flyway/sql migrate

To see the migration naming convention, click here.

Run Local

$ mvn spring-boot:run

Application will run by default on port 1234

Configure the port by changing server.port in application.yml

Run Docker

First build the image:

$ docker-compose build

When ready, run it:

$ docker-compose up

Application will run by default on port 1234

Configure the port by changing services.api.ports in docker-compose.yml. Port 1234 was used by default so the value is easy to identify and change in the configuration file.

Testing

The easiest way to test your dev is to run RiffIntregrationTest, it starts a DB postgres and a keycloak server.

It also starts a riff server and send some requests to it.

Feel free to add integration tests in it if needed.

API

See https://kf-strides-riff.kidsfirstdrc.org/swagger-ui.html

Acknowledgements

TODO: Show folks some love.

About

:construction: A Microservice for URL Shortening and sharing.

License:GNU Affero General Public License v3.0


Languages

Language:Java 93.4%Language:HTML 2.4%Language:Shell 2.1%Language:Dockerfile 2.0%