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:
mvn clean install
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.
- Download & Install Cassandra onto your machine
- 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
*** Note - this section is still WIP
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
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