Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
webapp
bootiful-couchbase.yml
couchbase-service.yml
readme.adoc

readme.adoc

Spring Boot + Couchbase + Docker + Kubernetes

Using CLI

  1. Start Couchbase Docker container: docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 arungupta/oreilly-couchbase

  2. Run the application: mvn -f webapp/pom.xml spring-boot:run

  3. Optionally

    1. Generate a fat jar: mvn -f webapp/pom.xml clean package

    2. Run app (default host): mvn spring-boot:run or java -jar target/bootiful-couchbase.jar

    3. Run app (explicit host): java -Dspring.couchbase.bootstrap-hosts=localhost -jar target/bootiful-couchbase.jar

Using Docker

  1. Start Couchbase Docker container: docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 arungupta/oreilly-couchbase

  2. Ceate Docker image of the application: mvn -f webapp/pom.xml clean package

  3. Find IP address of the database: docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' db

  4. Run the application: docker run -it -e spring.couchbase.bootstrap-hosts=<IP> arungupta/bootiful-couchbase

  5. Push the image to Docker Hub: mvn install

Using Kubernetes

  1. Start Kubernetes: NUM_NODES=2 NODE_SIZE=m3.medium KUBERNETES_PROVIDER=aws kube-up.sh

  2. Create Couchbase service: kubectl.sh create -f couchbase-service.yml

  3. Run application: kubectl.sh create -f bootiful-couchbase.yml

Expected flow (with maven plugin)

  1. Create Kubernetes artifacts for service + RC for arungupta/oreilly-couchbase - How can the name of this service be customized to be “couchbase”? This is used in bootiful-couchbase.yml.

  2. Create Kubernetes artifacts for arungupta/bootiful-couchbase

  3. Deploy all artifacts to Kubernetes: mvn fabric8:deploy

Expected Output

  1. Look for output:

    Book{isbn=978-1-4919-1889-0, name=Minecraft Modding with Forge, cost=29.99}
You can’t perform that action at this time.