Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves docs on Cassandra setup #703

Merged
merged 5 commits into from May 3, 2017

Conversation

ignasi35
Copy link
Contributor

  • specify settings are for devmode only
  • document how to setup a static list of contact-points

@@ -156,4 +156,25 @@ In sbt:

@[local-instance](code/build-cassandra-opts3.sbt)

Assuming your local Cassandra instance is running on port `9042`.
These two settings will only be used when running Lagom in DevMode. The purpose of these two settings is to disabled the embedded Cassandra server and configure the Service Locator in DevMode to still be able to locate Cassandra when looking for `cas_native`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/disabled/disable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if it should say why you would disable the embedded Cassandra - typically, you would do this if you were already running your own Cassandra locally, perhaps you have another application not managed by Lagom that uses Cassandra, and for running that you run Cassandra, and it doesn't make sense for Lagom to start its own Cassandra then.


The service locator setup in these examples assumes your local Cassandra instance is running on port `9042`.

## Disabling Service Location
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that this section really belongs in the page on the development mode Cassandra server. Maybe it should be on the page about configuring Cassandra persistent entities?

Despite that, there scenarios where a hard-coded list of contact-points is required and updating and maintaining a list of endpoints in a service locator is not a viable option. In that case a user may use the following setup in the `application.conf` of your service:

```
cassandra {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this need to be configured separately for cassandra-journal, cassandra-snapshot-store and lagom.persistence.read-side.cassandra? AFAIK nothing reads this config out of the cassandra namespace (although maybe it would be more convenient if we had a shared default key substituted in to the three namespaces).


It is possible to hardcode the list of `contact-points` where Cassandra may be located. That is the default behavior in `akka-persistence-cassandra` but Lagom overrides that behavior implementing a Session provider based on service location. That allows all services to continue to operate without the need to redeploy if/when the Cassandra `contact-points` are updated or fail. Using a Service Location based approach provides higher resiliency.

Despite that, there scenarios where a hard-coded list of contact-points is required and updating and maintaining a list of endpoints in a service locator is not a viable option. In that case a user may use the following setup in the `application.conf` of your service:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: "s/there scenarios/there are scenarios"

@ignasi35
Copy link
Contributor Author

ignasi35 commented May 2, 2017

I ended up using a different approach.

I like @TimMoore's suggestion to remove the info from the dev-mode section and placed the docs I was adding in the ProductionOverview page.

This way a developer adding cassandra support will first read C* PE and configure the minimum to make it work. At the end of that page I linked CassandraServer ("if you want to tune your dev mode) and I linked to ProductionOverview ("if you want to use a static list of contact-points").


Lagom will start an embedded Cassandra server when running in developer mode. You can review the configuration options or how to disable the embedded server in the section on Cassandra Server in [[Running Lagom in development|CassandraServer]].

In production you usually will prefer a dinamically locatable Cassandra server for resiliency. If you need to use a static list of contact-points to locate your Cassandra server review the section on deploying using static service location for Cassandra Service in [[Running Lagom in Production|ProductionOverview#Deploying-using-static-Cassandra-contact-points]].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo: dinamically -> dynamically (I'll go ahead and fix it myself)

This setup disables Lagom's `ConfigSessionProvider` and fallbacks to that provided in `akka-persistence-cassandra` which uses the list of endpoints listed in `contact-points`.

This configuration is part of `application.conf` and therefore it will be applied in all environments (develpment and production) unless overriden. See developer mode settings on [[overriding Cassandra setup in Dev Mode|CassandraServer#Connecting-to-a-locally-running-Cassandra-instance]] for more information on settings up Cassandra in dev mode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another typo: develpment -> development

session-provider = akka.persistence.cassandra.ConfigSessionProvider
}
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still missing the three different namespace prefixes.

Tim Moore added 2 commits May 3, 2017 13:25
This uses substitution to avoid redefining the values in multiple
places.
@TimMoore
Copy link
Contributor

TimMoore commented May 3, 2017

I went ahead and pushed some minor changes to your branch. I'm OK to merge if you are, but if you don't like something about the way I changed it, feel free to keep working on it.

@ignasi35
Copy link
Contributor Author

ignasi35 commented May 3, 2017

Thanks @TimMoore

@ignasi35 ignasi35 merged commit f0096c3 into lagom:master May 3, 2017
ignasi35 added a commit to ignasi35/lagom that referenced this pull request May 3, 2017
* Documents the override for static list of endpoints

* Don't use same verb twice

* Moved the info to Production section and added cross link on PE pages

* Fix typos

* Correct the Cassandra configuration key prefixes

This uses substitution to avoid redefining the values in multiple
places.
@ignasi35
Copy link
Contributor Author

ignasi35 commented May 3, 2017

Backported to 1.3.x 6e62ff6

@ignasi35 ignasi35 deleted the docs-cassandra-setup-improvements branch May 4, 2017 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants