An open API service indexing awesome lists of open source software.

https://github.com/colinbut/user-service

A microservice that provides user functionality
https://github.com/colinbut/user-service

activemq cassandra cassandra-driver docker docker-compose java jetty jetty-server microservice spring spring-framework spring-jms spring-web spring-web-mvc springframework

Last synced: 3 months ago
JSON representation

A microservice that provides user functionality

Awesome Lists containing this project

README

        

# User Service

[![Build Status](https://travis-ci.org/colinbut/user-service.svg?branch=master)](https://travis-ci.org/colinbut/user-service)

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](etc/diagram.png)

### Build

```bash
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.

```bash
./cassandra
```

Lastly, run the microservice

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

### Deployment

*** Note - this section is still WIP

#### using Docker Compose

```bash
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__

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

__User Service__

```bash
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.

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