Skip to content

Commit

Permalink
Merge pull request jhipster#496 from tchlyah/couchbase
Browse files Browse the repository at this point in the history
Add Couchbase documentation
  • Loading branch information
jdubois authored Nov 27, 2017
2 parents afc32f1 + 1437bcc commit 4169d52
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 5 deletions.
1 change: 1 addition & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
<li {% if '/using-cache/' == page.url %}class="active" {% endif %}><a href="{{ site.url }}/using-cache/"><i class="fa fa-fw fa-line-chart"></i> Using a cache</a></li>
<li {% if '/using-oracle/' == page.url %}class="active" {% endif %}><a href="{{ site.url }}/using-oracle/"><i class="fa fa-fw fa-archive"></i> Using Oracle</a></li>
<li {% if '/using-mongodb/' == page.url %}class="active" {% endif %}><a href="{{ site.url }}/using-mongodb/"><i class="fa fa-fw fa-leaf"></i> Using MongoDB</a></li>
<li {% if '/using-couchbase/' == page.url %}class="active" {% endif %}><a href="{{ site.url }}/using-couchbase/"><i class="fa fa-fw fa-leaf"></i> Using Couchbase</a></li>
<li {% if '/using-cassandra/' == page.url %}class="active" {% endif %}><a href="{{ site.url }}/using-cassandra/"><i class="fa fa-fw fa-eye"></i> Using Cassandra</a></li>
<li {% if '/using-kafka/' == page.url %}class="active" {% endif %}><a href="{{ site.url }}/using-kafka/"><i class="fa fa-fw fa-envelope"></i> Using Kafka</a></li>
</ul>
Expand Down
Binary file added images/logo/icons/couchbase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ <h2 class="heading">Server side options</h2>
<img src="images/logo/icons/mongo.png" />
<span class="title_sub_tech">MongoDB</span>
</li>
<li class="clip img-circle new">
<img src="images/logo/icons/couchbase.png" />
<span class="title_sub_tech">Couchbase</span>
</li>
<li class="clip img-circle new">
<img src="images/logo/svg//cassandra.svg" class="invert-hover-white" />
<span class="title_sub_tech">Cassandra</span>
Expand Down
3 changes: 2 additions & 1 deletion pages/creating_an_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ You can choose between:
- An SQL database (H2, MySQL, MariaDB, PostgreSQL, MSSQL, Oracle), which you will access with Spring Data JPA
- [MongoDB]({{ site.url }}/using-mongodb/)
- [Cassandra]({{ site.url }}/using-cassandra/)
- [Couchbase]({{ site.url }}/using-couchbase/)

### Which *production* database would you like to use?

Expand Down Expand Up @@ -122,7 +123,7 @@ This is a multi-select answer, to add one or several other technologies to the a

#### Social login (Google, Facebook, Twitter)

This option is only available if you selected an SQL database or a MongoDB database. It adds [Spring Social](http://projects.spring.io/spring-social/) support to JHipster, so end-users can log-in using their Google, Facebook or Twitter account.
This option is only available if you selected an SQL, MongoDB, or Couchbase database. It adds [Spring Social](http://projects.spring.io/spring-social/) support to JHipster, so end-users can log-in using their Google, Facebook or Twitter account.

#### API first development using swagger-codegen

Expand Down
2 changes: 1 addition & 1 deletion pages/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Those tasks are the same whether you use Yarn or NPM, we use the `yarn` command

### Running a database

If you use a non-embedded database, like MySQL, MariaDB, PostgreSQL, MSSQL, MongoDB or Cassandra, you will need to install and configure that database.
If you use a non-embedded database, like MySQL, MariaDB, PostgreSQL, MSSQL, MongoDB, Cassandra or Couchbase, you will need to install and configure that database.

The easiest and recommended way with JHipster is to use Docker Compose. [Follow our Docker Compose guide here.]({{ site.url }}/docker-compose/)

Expand Down
12 changes: 12 additions & 0 deletions pages/docker_compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ If you just want to start your database, and not the other services, use the Doc
- With Oracle: `docker-compose -f src/main/docker/oracle.yml up`
- With MongoDB: `docker-compose -f src/main/docker/mongodb.yml up`
- With Cassandra: `docker-compose -f src/main/docker/cassandra.yml up`
- With Couchbase: `docker-compose -f src/main/docker/couchbase.yml up`

### MongoDB Cluster Mode

Expand All @@ -149,6 +150,17 @@ Follow these steps to do so:

If you want to add or remove some MongoDB nodes, just repeat step 3 and 4.

### Couchbase Cluster Mode

If you want to use Couchbase with multiple nodes, you need to build and set up manually Couchbase images.
Follow these steps to do so:

- Build the image: `docker-compose -f src/main/docker/couchbase-cluster.yml build`
- Run the database: `docker-compose -f src/main/docker/couchbase-cluster.yml up -d`
- Scale the Couchbase node service (you have to choose an odd number of nodes): `docker-compose -f src/main/docker/couchbase-cluster.yml scale <name_of_your_app>-couchbase-node=<X>`
- Build a Docker image of your application: `./mvnw package -Pprod dockerfile:build`
- Start your application: `docker-compose -f src/main/docker/app.yml up -d <name_of_your_app>-app`

### Cassandra

Unlike the other databases, where the schema migrations are executed by the application itself, Cassandra schema migrations are executed by a dedicated Docker container.
Expand Down
2 changes: 1 addition & 1 deletion pages/managing_relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ When JPA is used, the [entity sub-generator]({{ site.url }}/creating-an-entity/)

## Presentation

Relationships only work when JPA is used. If you choose to use [Cassandra]({{ site.url }}/using-cassandra/) or [MongoDB]({{ site.url }}/using-mongodb/), they won't be available.
Relationships only work when JPA is used. If you choose to use [Cassandra]({{ site.url }}/using-cassandra/), [MongoDB]({{ site.url }}/using-mongodb/) of [Couchbase]({{ site.url }}/using-couchbase/), they won't be available.

A relationship works between two entities, and JHipster will generate the code for:

Expand Down
1 change: 1 addition & 0 deletions pages/running_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ This Spring test context will use a specific test database to execute its tests:
* If you use Cassandra, JHipster will launch an in-memory Cassandra instance using [CassandraUnit](https://github.com/jsevellec/cassandra-unit).
* If you use MongoDB, JHipster will launch an in-memory MongoDB instance using [de.flapdoodle.embed.mongo](https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo).
* If you use Elasticsearch, JHipster will launch an in-memory Elasticsearch instance using Spring Data Elasticsearch.
* If you use Couchbase, JHipster will launch a containerized version of Couchbase with Docker using [Couchbase TestContainers](https://github.com/differentway/testcontainers-java-module-couchbase).

Those tests can be run directly in your IDE, by right-clicking on each test class, or by running `./mvnw clean test` (or `./gradlew test` if you run Gradle).

Expand Down
2 changes: 1 addition & 1 deletion pages/tech_stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ A complete [Spring application](http://spring.io/):
* [Spring Data JPA](http://projects.spring.io/spring-data-jpa/) + Bean Validation
* Database updates with [Liquibase](http://www.liquibase.org/)
* [Elasticsearch](https://github.com/elastic/elasticsearch) support if you want to have search capabilities on top of your database
* [MongoDB](http://www.mongodb.org) support if you'd rather use a document-oriented NoSQL database instead of JPA
* [MongoDB](http://www.mongodb.org) and [Couchbase](https://www.couchbase.com) support if you'd rather use a document-oriented NoSQL database instead of JPA
* [Cassandra](http://cassandra.apache.org/) support if you'd rather use a column-oriented NoSQL database instead of JPA
* [Kafka](http://kafka.apache.org/) support if you want to use a publish-subscribe messaging system

Expand Down
21 changes: 21 additions & 0 deletions pages/using_couchbase.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
layout: default
title: Using Couchbase
permalink: /using-couchbase/
redirect_from:
- /using_couchbase.html
sitemap:
priority: 0.7
lastmod: 2015-02-24T00:00:00-00:00
---

# <i class="fa fa-leaf"></i> Using Couchbase

Couchbase is one of the supported databases that can be selected when your application is being generated.

When Couchbase is selected:

* Spring Data Couchbase will be used to access the database. This is very close to Spring Data JPA, and this is why Couchbase support is very close to the (default) JPA support
* [Couchmove](https://github.com/differentway/couchmove) is used instead of [Liquibase](http://www.liquibase.org/) to manage database changes
* The [entity sub-generator]({{ site.url }}/creating-an-entity/) will not ask you for entity relationships, as you can't have relationships with a NoSQL database (at least not in the way you have relationships with JPA)
* [Couchbase TestContainers](https://github.com/differentway/testcontainers-java-module-couchbase) is used to launch a containerized version of the database for running unit tests.
2 changes: 1 addition & 1 deletion pages/using_elasticsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Elasticsearch is an option that adds search capabilities on top of your database

This option has some limitations:

* It only works with SQL databases. MongoDB and Cassandra support will be added in the future (help is welcome!).
* It only works with SQL databases. MongoDB, Cassandra and Couchbase support will be added in the future (help is welcome!).
* There is no consistency between your database and Elasticsearch, so you might have out-of-sync data. This is normal, as Elasticsearch is not a real database. As a result, you will probably need to write some specific code to synchronize your data, for example using the Spring `@Scheduled` annotation, to run every evening.
* This also means if your database is changed outside of your application, your search indexes will be out-of-sync. The [Elasticsearch Reindexer](http://www.jhipster.tech/modules/marketplace/#/details/generator-jhipster-elasticsearch-reindexer) JHipster module can help in these situations.

Expand Down
9 changes: 9 additions & 0 deletions presentation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,15 @@ <h3>NoSQL for scalability</h3>
<li>More scalable, easier to use</li>
</ul>
</section>
<section>
<h1>Couchbase</h1>
<h3>NoSQL for scalability</h3>
<ul>
<li>Alternative to the SQL database and JPA choice</li>
<li>Similar code: Spring Data Couchbase works the same as Spring Data JPA</li>
<li>More scalable, easier to use</li>
</ul>
</section>
<section>
<h1>Cassandra</h1>
<h3>NoSQL for scalability</h3>
Expand Down

0 comments on commit 4169d52

Please sign in to comment.