No description, website, or topics provided.
Shell Batchfile Ruby
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.mvn Adding spring profile to maven config Aug 30, 2017
authserver @ eab8075 Update submodules May 8, 2017
aws @ 9108de9 Reseting for Edgware branch Mar 27, 2018
brewery @ 4ce00f3 Reseting for Edgware branch Mar 27, 2018
build @ 09317bb Reseting for Edgware branch Mar 27, 2018
bus @ 83cfefa Reseting for Edgware branch Mar 27, 2018
cli @ 2ced66f Reseting for Edgware branch Mar 27, 2018
cloudfoundry @ dcfa2e0 Reseting for Edgware branch Mar 27, 2018
cluster @ 8a1f549 Update submodules May 8, 2017
commons @ 0e259ea Update some gitignores May 21, 2018
config @ 1c12b23 Update some gitignores May 21, 2018
config-repo @ a611374 Reseting for Edgware branch Mar 27, 2018
configserver @ 911f79d Update submodules May 8, 2017
consul @ 98f9214 Reseting for Edgware branch Mar 27, 2018
contract @ 663c6aa Update some gitignores May 21, 2018
customers-stores @ 4619015 Reseting for Edgware branch Mar 27, 2018
demo Add link to github in rendered docs Mar 20, 2015
docs Updated config props Aug 1, 2018
eureka @ ff513fe Update submodules May 8, 2017
function @ 8e9a550 Add Spring Cloud Function May 21, 2018
gateway @ f910065 Reseting for Edgware branch Mar 27, 2018
hystrix-dashboard @ e89c345 Change repo URLs to https Aug 17, 2016
locks @ ab3bbe4 Update submodules May 8, 2017
netflix @ fe3f020 Update some submodules May 22, 2018
openfeign @ 92cccca Adding openfeign and gateway to documentation Feb 27, 2018
security @ 414effd Update some gitignores May 21, 2018
sleuth @ cdace45 Reseting for Edgware branch Mar 27, 2018
sso @ b23b980 Update submodules May 8, 2017
starters @ f254fac Update some submodules May 22, 2018
stream @ 2dd6ca7 Reseting for Edgware branch Mar 27, 2018
stream-core @ f1dbea9 Update some gitignores May 21, 2018
task @ 15acc0c Reseting for Edgware branch Mar 27, 2018
tests @ 67bb051 Reseting for Edgware branch Mar 27, 2018
turbine @ b2ecae2 Update submodules May 8, 2017
vault @ c639c95 Reseting for Edgware branch Mar 27, 2018
zookeeper @ 99307b1 Reseting for Edgware branch Mar 27, 2018
.gitignore Update submodules Oct 30, 2014
.gitmodules Add Spring Cloud Function May 21, 2018
.mrconfig Add stream-core and put release train in stream Oct 21, 2016
.travis.yml Added release train script (#15) Aug 23, 2016
Guardfile Add link to github in rendered docs Mar 20, 2015
README.adoc The release train documentation will consist of single and multi HTML… Aug 31, 2017
build.sh Update readmes Aug 14, 2015
demo_deploy.sh Update submodules Jun 2, 2015
demo_undeploy.sh Use PREFIX from environment if set Oct 10, 2014
docker-compose.yml Use management plugin for rabbit Oct 20, 2015
kill.sh Fix port test and add runner for customersui May 13, 2015
mvnw Updated mvnw to set proper spring profiles Aug 30, 2017
mvnw.bat Add Maven wrapper Aug 14, 2015
mvnw.cmd Add Maven wrapper Aug 14, 2015
pom.xml The release train documentation will consist of single and multi HTML… Aug 31, 2017
release_train.sh Removing offline option when retrieving versions Aug 1, 2018
run.sh Fix port test and add runner for customersui May 13, 2015
services_deploy.sh Fix deploy scripts (now that sources/javadocs may be present) Nov 5, 2014
services_undeploy.sh Use PREFIX from environment if set Oct 10, 2014

README.adoc

The spring-cloud-samples can be run as a demo locally by just cloning the individual projects and running them. This project can be used to manage updating and deploying the sample apps to cloudfoundry.

Running Locally

Pre-requisites: Maven (3) and Java (1.7). To run the Customers UI you also need the Spring Boot CLI. Clone the repository and initialize submodules:

$ git clone https://github.com/spring-cloud-samples/scripts
$ cd scripts
$ ./build.sh

(You can add `-DskipTests' if you like, or just use `./mvnw' directly, once the submodules are initialized. If you are starting from scratch, the build'' module needs to be installed first, followed by the starters''.)

You also nee Mongodb and RabbitMQ and Redis. If you don’t have those, and you do have Docker, you can run them in Docker (via docker-compose):

$ docker-compose up
...
<mongo starts up>
<rabbit starts up>
<redis starts up>

the containers for the server processes write their data locally in ./data_*. Those files will be owned by root, so watch out when it comes to remove them.

NOTE: Docker version 1.5 and Compose version 1.1.0 are confirmed to work. The latest versions have not been tested and may have problems.

Docker on a mac

Docker on a mac requires boot2docker. Because docker is running in a virtual machine, The ip addresses of mongo, rabbit and redis are not 127.0.0.1. You can use virtualbox port forwarding to address this issue with the following commands (from here):

# vm must be powered off
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port27017,tcp,,27017,,27017"
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port6379,tcp,,6379,,6379"
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port15672,tcp,,15672,,15672"
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port5672,tcp,,5672,,5672"

Docker alternative on a mac

If you prefer not to use docker-compose you can install mongo, rabbit and redis:

brew install mongodb rabbitmq redis

To run the apps (each in a different terminal)

$ rabbitmq-server
$ mongod --config /usr/local/etc/mongod.conf
$ redis-server /usr/local/etc/redis.conf

Run the apps:

$ ./run.sh

You can kill the processes using ./kill.sh, and both scripts know how to operate on individual apps or subsets, e.g. (the default):

$ ./run.sh configserver eureka customers stores

To run the UI with the maps, get the Spring Boot CLI, and install the platform CLI plugin, e.g. with GVM:

$ gvm install springboot 1.2.0.RC1
$ gvm use springboot 1.2.0.RC1

and finally install the Spring Cloud plugin:

$ spring install org.springframework.cloud:spring-cloud-cli:1.0.0.BUILD-SNAPSHOT

Then run the app

$ (cd customers-stores/customers-ui; spring run app.groovy)

Running on Cloud Foundry

Pre-requisites:

  • Maven (3)

  • Java (1.8)

  • the cf CLI

  • Cloud Foundry with Java buildpack version 2.5 or greater (for Java 1.8 support)

Clone the repository and initialize submodules:

$ git clone https://github.com/spring-cloud-samples/scripts
$ cd scripts
$ ./build.sh
$ ./services_deploy.sh
$ ./demo_deploy.sh

The result should be a bunch of apps running in the default space for your default org, with names prefixed by your local userid, e.g.

$ cf apps
...
dsyerconfigserver      started  1/1  512M  1G    dsyerconfigserver.cfapps.io
dsyereureka            started  1/1  512M  1G    dsyereureka.cfapps.io
dsyercustomers         started  1/1  512M  1G    dsyercustomers.cfapps.io
dsyerstores            started  1/1  512M  1G    dsyerstores.cfappps.io
...

The configserver and eureka apps will have been registered as user provided services, and bound to the other apps:

$ cf services
...
name                 service        plan  bound apps
dsyerconfigserver   user-provided        dsyercustomers, dsyereureka, dsyerstores
dsyereureka         user-provided        dsyerconfigserver, dsyercustomers, dsyerstores
...

You can check that it is all working by pinging the eureka app endpoints and seeing the other apps registered. E.g. visit http://dsyereureka.cfapps.io/eureka/apps in a browser. Other useful links for diagnosis and investigating what’s going on:

The stores app comes pre-populated with a Mongo database full of Starbucks locations. The customers app is empty to start (and uses an in-memory database) so you have to POST some data into it, e.g.

$ curl -i -H "Content-Type: application/json" http://dsyercustomers.cfapps.io/customers -d @customers-stores/rest-microservices-customers/src/test/resources/customers.json

Then when you visit the customers app at http://dsyercustomers.cfapps.io/customers you should see a customer (Ollie) and a link to nearby stores. If the stores app did not register with eureka, or if you stop the the stores app intentionally (cf stop …​), then the stores link will be missing in the customers app (simple example of a circuit breaker).

Sometimes it is also useful to undeploy the services (and unbind them from apps etc.), and redeploy them:

$ ./services_undeploy.sh
$ ./services_deploy.sh
$ ./demo_deploy.sh

It should all work on Pivotal Web Services, by default, or on any Cloudfoundry instance (e.g. PCF or a local single VM instance) if you set the DOMAIN environment variable to the DNS domain that the service is running in.

To run on bosh-lite

export DOMAIN=10.244.0.34.xip.io
export PLATFORM_HOME=/Users/sgibb/workspace/spring/spring-cloud-samples #where all spring-cloud-samples are checked out
export MONGO_URI=mongodb://192.168.50.1/stores #mongo running on host #TODO install mongo as a service

Build documentation

You can easily create the documentation for a particular release train using the release_train.sh script. You can run it in an interactive mode - then you’ll get prompted for all entries, or you can provide the values of the name of the release train together with the names and versions of modules. You can run ./release_train -h for more information.