Added Swagger to monolithic deployment, Added mongodb-cli.sh
This commit is contained in:
14
README.md
14
README.md
@@ -94,7 +94,10 @@ First, you need to tell the query side code how to connect to MongoDB:
|
|||||||
```
|
```
|
||||||
|
|
||||||
[Docker Compose](https://docs.docker.com/compose/) is a great way to run MongoDB.
|
[Docker Compose](https://docs.docker.com/compose/) is a great way to run MongoDB.
|
||||||
You can run the `docker-compose up -d mongodb` to run MongoDB.
|
You can run the `docker-compose up -d mongodb` to run MongoDB and then set `SPRING_DATA_MONGODB_URI` as follows:
|
||||||
|
```
|
||||||
|
export SPRING_DATA_MONGODB_URI=mongodb://$(docker-machine ip default)/yourdb
|
||||||
|
```
|
||||||
|
|
||||||
Second, some of the tests in accounts-command-side-service, transactions-command-side-service, accounts-query-side-service and e2e-test need you need to set some environment variables that tell them how to connect to the Event Store server.
|
Second, some of the tests in accounts-command-side-service, transactions-command-side-service, accounts-query-side-service and e2e-test need you need to set some environment variables that tell them how to connect to the Event Store server.
|
||||||
But don't worry.
|
But don't worry.
|
||||||
@@ -117,6 +120,15 @@ Simply use this command:
|
|||||||
java -jar monolithic-service/build/libs/monolithic-service.jar
|
java -jar monolithic-service/build/libs/monolithic-service.jar
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This will start the service running on port 8080 (you can change using the --server.port=9999 option).
|
||||||
|
|
||||||
|
Once the service has started you can open the Swagger UI: http://localhost:8080/swagger-ui.html.
|
||||||
|
You can then:
|
||||||
|
|
||||||
|
1. Create two accounts (save the account ids)
|
||||||
|
2. Create a money transfer
|
||||||
|
3. View the updated account balances
|
||||||
|
|
||||||
## Running the microservices
|
## Running the microservices
|
||||||
|
|
||||||
The other option is to run the services separately.
|
The other option is to run the services separately.
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
docker run --link javaspring_mongodb_1:mongodb -i -t mongo:3.0.4 /usr/bin/mongo --host mongodb
|
docker run --rm --link javaspring_mongodb_1:mongodb -i -t mongo:3.0.4 /usr/bin/mongo --host mongodb
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ dependencies {
|
|||||||
compile "org.springframework.boot:spring-boot-starter-actuator"
|
compile "org.springframework.boot:spring-boot-starter-actuator"
|
||||||
|
|
||||||
compile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion"
|
compile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion"
|
||||||
|
compile project(":common-swagger")
|
||||||
|
|
||||||
testCompile project(":testutil")
|
testCompile project(":testutil")
|
||||||
testCompile "org.springframework.boot:spring-boot-starter-test"
|
testCompile "org.springframework.boot:spring-boot-starter-test"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.chrisrichardson.eventstore.javaexamples.banking.web;
|
package net.chrisrichardson.eventstore.javaexamples.banking.web;
|
||||||
|
|
||||||
|
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.accounts.CommandSideWebAccountsConfiguration;
|
import net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.accounts.CommandSideWebAccountsConfiguration;
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.transactions.CommandSideWebTransactionsConfiguration;
|
import net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.transactions.CommandSideWebTransactionsConfiguration;
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.web.queryside.QuerySideWebConfiguration;
|
import net.chrisrichardson.eventstore.javaexamples.banking.web.queryside.QuerySideWebConfiguration;
|
||||||
@@ -14,7 +15,8 @@ import org.springframework.http.converter.HttpMessageConverter;
|
|||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Import({CommandSideWebAccountsConfiguration.class, CommandSideWebTransactionsConfiguration.class, JdbcEventStoreConfiguration.class, QuerySideWebConfiguration.class})
|
@Import({CommandSideWebAccountsConfiguration.class, CommandSideWebTransactionsConfiguration.class, JdbcEventStoreConfiguration.class,
|
||||||
|
QuerySideWebConfiguration.class, CommonSwaggerConfiguration.class})
|
||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
public class BankingWebConfiguration {
|
public class BankingWebConfiguration {
|
||||||
|
|||||||
7
java-spring/show-urls.sh
Executable file
7
java-spring/show-urls.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
IP=$(docker-machine ip default)
|
||||||
|
|
||||||
|
echo Accounts command-side service = http://${IP}:8080/swagger-ui.html
|
||||||
|
echo Money Transfers command-side service = http://${IP}:8082/swagger-ui.html
|
||||||
|
echo Accounts query-side service = http://${IP}:8081/swagger-ui.html
|
||||||
Reference in New Issue
Block a user