Skip to content

colinbut/user-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Service

Build Status

Microservice for user functionality.

Technologies:

  • Java 7
  • Spring Framework 4
  • Jetty
  • Datastax Cassandra Driver
  • Apache Cassandra

Built using Java with the Spring framework. It runs inside a Jetty server (a lightweight web container/server). Application connects to Cassandra datastore (NoSQL)

Below:

Image of technology diagram

Build

mvn clean install

Run locally

This method runs user-service locally in your own development machine with the use of a deployment facility in Docker.

Pre-requisite set up

User Service microservice depends on the Cassandra DataStore.

  1. Download & Install Cassandra onto your machine
  2. Run the init-db.cql setup script contents under src/main/resources/db/scripts

Assuming the artifact is built from the Build section then do the following:

Go to Cassandra installed directory location and run the following script to start up Cassandra server.

./cassandra

Lastly, run the microservice

java -jar target/user-service-1.0-SNAPSHOT-with-dependencies.jar

Deployment

*** Note - this section is still WIP

using Docker Compose

rm docker/user-service-1.0-SNAPSHOT-with-dependencies.jar
cp target/user-service-1.0-SNAPSHOT-with-dependencies.jar docker/
cd docker;
docker-compose up

Bringing User Service + Cassandra DB up individually

Cassandra needs to be startup first as the microservice will try to connect to it on startup.

Cassandra DB

cd docker;
docker build -f dockerfiles/cassandra.db -t cassandra-db:1.0-SNAPSHOT .
docker run cassandra-db:1.0-SNAPSHOT

User Service

rm docker/user-service-1.0-SNAPSHOT-with-dependencies.jar
cp target/user-service-1.0-SNAPSHOT-with-dependencies.jar docker/
cd docker;
docker build -f dockerfiles/userservice.app -t user-service:1.0-SNAPSHOT .
docker run user-service:1.0-SNAPSHOT

then link the two containers together so the User Service microservice can talk to the Cassandra db.

docker run --link cassandra-db:1.0-SNAPSHOT --name user-service:1.0-SNAPSHOT -p 8080:8080 user-service:1.0-SNAPSHOT