Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/willis7/invader-zim

Simple spring boot application using MongoDB
https://github.com/willis7/invader-zim

Last synced: 1 day ago
JSON representation

Simple spring boot application using MongoDB

Awesome Lists containing this project

README

        

== Demo Spring Boot Groovy app

This application demonstrates how easy it is to build a Groovy Spring Boot application, using Cucumber to test. It uses embedded server and mongo during functional tests.

==== To run tests

[source]
----
gradle clean check
----

==== Set up MongoDB

Make sure that you have MongoDB installed and running. Once the `mongod` process is up and running, insert some test data into the database by running:

[source]
----
mongo invasion src/main/resources/mongo/quotes.js
----

==== To run the app from Gradle using local Mongo

[source]
----
gradle run
----

==== To run up the fat jar

[source]
----
java -jar build/libs/invader-zim
----

== Docker

If you want the easy way of running this build simply build the microservice with `gradlew clean assemble` followed by:

==== Start a mongodb container

[source]
----
docker run -d --name zim-mongo mongo
----

==== Seed the DB

The following command starts another mongo container instance and runs the mongo command line client against your original mongo container, allowing you to execute statements against your database instance:

[source]
----
docker run -it -v $PWD/docker/db/quote.js:/src/quote.js:ro --link zim-mongo:mongo --rm mongo sh -c 'exec mongo "$MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT/invasion" /src/quote.js'
----

==== Build the Zim service image

[source]
-----
docker build -t zim-svc .
-----

==== Start zim-svc container linked to zim-mongo container

[source]
----
docker run -d -p 8080:8080 --link zim-mongo:mongo --name zim-svc zim-svc
----