Skip to content

Commit 68534cf

Browse files
authored
Merge pull request #13 from DataStax-Examples/update_readme
Update readme
2 parents dbed62b + e36cc9e commit 68534cf

File tree

8 files changed

+624
-22
lines changed

8 files changed

+624
-22
lines changed

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at . All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Contributing
2+
3+
When contributing to this repository, please first discuss the change you wish to make via issue,
4+
email, or any other method with the owners of this repository before making a change.
5+
6+
Please note we have a [Code of Conduct](CODE_OF_CONDUCT.md), please follow it in all your interactions with the project.
7+
8+
## <a name="issue"></a> Found an Issue?
9+
If you find a bug in the source code or a mistake in the documentation, you can help us by
10+
[submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can
11+
[submit a Pull Request](#submit-pr) with a fix.
12+
13+
## <a name="feature"></a> Want a Feature?
14+
You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub
15+
Repository. If you would like to *implement* a new feature, please submit an issue with
16+
a proposal for your work first, to be sure that we can use it.
17+
18+
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
19+
20+
## <a name="submit"></a> Contribution Guidelines
21+
22+
### <a name="submit-issue"></a> Submitting an Issue
23+
Before you submit an issue, search the archive, maybe your question was already answered.
24+
25+
If your issue appears to be a bug, and hasn't been reported, open a new issue.
26+
Help us to maximize the effort we can spend fixing issues and adding new
27+
features, by not reporting duplicate issues. Providing the following information will increase the
28+
chances of your issue being dealt with quickly:
29+
30+
* **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
31+
* **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you
32+
* **Reproduce the Error** - provide a live example or a unambiguous set of steps
33+
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
34+
causing the problem (line of code or commit)
35+
36+
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
37+
Before you submit your Pull Request (PR) consider the following guidelines:
38+
39+
* Search the repository (https://github.com/bechbd/[repository-name]/pulls) for an open or closed PR that relates to your submission. You don't want to duplicate effort.
40+
41+
* Create a fork of the repo
42+
* Navigate to the repo you want to fork
43+
* In the top right corner of the page click **Fork**:
44+
![](https://help.github.com/assets/images/help/repository/fork_button.jpg)
45+
46+
* Make your changes in the forked repo
47+
* Commit your changes using a descriptive commit message
48+
* In GitHub, create a pull request: https://help.github.com/en/articles/creating-a-pull-request-from-a-fork
49+
* If we suggest changes then:
50+
* Make the required updates.
51+
* Rebase your fork and force push to your GitHub repository (this will update your Pull Request):
52+
53+
```shell
54+
git rebase master -i
55+
git push -f
56+
```
57+
58+
That's it! Thank you for your contribution!

GETTING_STARTED.md

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
# Reactive Implementation of 🐈 Spring PetClinic 🐕
2+
*15 minutes, Intermediate*
3+
4+
This sample is a fully reactive version of the Spring PetClinic application using Spring WebFlux.
5+
6+
![image](https://raw.githubusercontent.com/DataStax-Examples/spring-petclinic-reactive/master/doc/img/ui-top.png)
7+
8+
The steps to run the application are provided below. You can run the application with no installation using Gitpod and Cassandra as DBaas for free or locally. To get started with a free-forever, zero-install Cassandra database **[click here](https://astra.datastax.com/register?utm_source=github&utm_medium=referral&utm_campaign=spring-petclinic-reactive)** 🚀
9+
10+
![Pet Clinic Welcome Screen](doc/img/logical-architecture.png?raw=true)
11+
*Architecture overview*
12+
13+
## Table of contents
14+
15+
- [Run the application](#run-the-application)
16+
- [Understand the architecture](#understand-the-architecture)
17+
- [Contributing](#contributing)
18+
19+
## Run the application
20+
21+
### 1. Start the database
22+
23+
**✅ Create a free-forever Cassandra database with DataStax Astra**: [click here to get started](https://astra.datastax.com/register?utm_source=github&utm_medium=referral&utm_campaign=spring-petclinic-reactive) 🚀
24+
25+
26+
![Astra Registration Screen](doc/img/db-auth.png?raw=true)
27+
28+
29+
**✅ Use the form to create a new database**
30+
31+
On the Astra home page locate the **Add Database** button
32+
33+
![Astra Database Creation Form](doc/img/db-creation-1.png?raw=true)
34+
35+
Select the **free tier** plan, this is a true free tier, free forever and no payment method asked 🎉 🎉
36+
37+
![Astra Database Creation Form](doc/img/db-creation-2.png?raw=true)
38+
39+
Select the proper region and click the `configure` button. The number of regions and cloud providers are limited in the free tier but please notice you can run the DB on any cloud with any VPC Peering.
40+
41+
![Astra Database Creation Form](doc/img/db-creation-3.png?raw=true)
42+
43+
Fill in the `database name`, `keyspace name`, `username` and `password`. *Please remember your password as you will be asked to provide it when the application starts the first time.*
44+
45+
![Astra Database Creation Form](doc/img/db-creation-4.png?raw=true)
46+
47+
**✅ View your Database and connect**
48+
49+
View your database. It may take 2-3 minutes for your database to spin up. You will receive an email at that point.
50+
51+
**👁️ Expected output**
52+
53+
*Initializing*
54+
55+
![my-pic](https://github.com/datastaxdevs/shared-assets/blob/master/astra/dashboard-pending-1000.png?raw=true)
56+
57+
Once the database is ready, notice how the status changes from `Pending` to `Active` and Astra enables the **CONNECT** button.
58+
59+
![my-pic](https://github.com/datastaxdevs/shared-assets/blob/master/astra/dashboard-withdb-1000.png?raw=true)
60+
61+
### 2. Copy credentials to connect
62+
63+
**✅ Navigate to your credentials**
64+
65+
Locate the combo `Organization: <Your email>` on the top navigation. On the right side of your organization, click the ellipsis (...) then click your `<Your email>`.
66+
67+
![my-pic](https://github.com/datastaxdevs/shared-assets/blob/master/astra/organization-combo-1000.png?raw=true)
68+
69+
You should land on the following screen. Scroll down to the bottom of the page to locate the `Service Account` in `Security Settings`
70+
71+
![my-pic](https://github.com/datastaxdevs/shared-assets/blob/master/astra/organization-home-1000.png?raw=true)
72+
73+
**✅ Create Service Account**
74+
75+
Create a service account by clicking the `Add Service Account` button above the section as shown below
76+
77+
![my-pic](https://github.com/datastaxdevs/shared-assets/blob/master/astra/security-settings-annotated.png?raw=true)
78+
79+
When the panel opens on the right, click `Add`
80+
81+
![my-pic](https://github.com/datastaxdevs/shared-assets/blob/master/astra/security-add-org-annotated.png?raw=true)
82+
83+
**✅ Copy credentials to your clipboard**
84+
85+
Click the ellipsis at end of Service Account row to open menu and select `Copy Credentials`
86+
87+
![my-pic](https://github.com/datastaxdevs/shared-assets/blob/master/astra/organization-copycredentials-1000.png?raw=true)
88+
89+
The credentials you copied to the clipboard look like the following JSON, we will use this in gitpod to enable connectivity.
90+
```json
91+
{
92+
"clientId":"149de2c7-9b07-41b3-91ad-9453dee4dc54",
93+
"clientName":"cedrick.lunven@datastax.com",
94+
"clientSecret":"aaaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
95+
}
96+
```
97+
98+
### 3. Start in Gitpod
99+
100+
**✅ Open Gitpod (with creds copied to clipboard)**
101+
102+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/spring-petclinic/spring-petclinic-reactive)
103+
104+
When you first launch gitpod, it builds the image.
105+
![image](doc/img/building-workspace.png?raw=true)
106+
107+
Git pod pulls the image.
108+
![image](doc/img/pulling-image.png?raw=true)
109+
110+
111+
112+
**✅ Paste credentials in Gitpod terminal**
113+
114+
Once Gitpod loads the workspace, you'll be asked to paste your service account credentials in the Gitpod terminal at the bottom of the screen. The [setup.sh](setup.sh) script at the root of the repository is what asks this question.
115+
116+
![image](doc/img/script-copy-creds.png?raw=true)
117+
118+
**✅ Open Swagger UI in browser**
119+
120+
When gitpod finishes building the app, a new tab will open in your browser showing the following.
121+
122+
![image](doc/img/exec-start.png?raw=true)
123+
124+
**🎉 Celebrate!**
125+
126+
You've successfully built the Spring Petclinic Reactive backend application!
127+
128+
![image](doc/img/exec-api-page.png?raw=true)
129+
130+
**✅ Start the Web UI** :
131+
132+
You may have noticed another terminal named `spring-petclinic-angular`. This is where the UI should start.
133+
134+
![image](doc/img/start-ui.png?raw=true)
135+
136+
After answering the question about analytics usage, you should be able to access the UI on a new tab.
137+
138+
![Pet Clinic Welcome Screen](doc/img/ui-top.png?raw=true)
139+
140+
**NOTE** If you want to run everything locally, reference the [LOCAL_README.md](doc/LOCAL_README.md)
141+
142+
## Understand the architecture
143+
144+
### Internal Architecture our of component
145+
146+
Let's have a look inside the main component `spring-petclinic-reactive` to see which libraries and frameworks have been used.
147+
148+
![Pet Clinic Welcome Screen](doc/img/internal-architecture.png?raw=true)
149+
150+
- `Spring-boot`: Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need minimal Spring configuration.
151+
152+
- `Spring-Security`: Spring Security is a powerful and highly customizable authentication and access-control framework. It is the de-facto standard for securing Spring-based applications. Spring Security is a framework that focuses on providing both authentication and authorization to Java applications. Like all Spring projects, the real power of Spring Security is found in how easily it can be extended to meet custom requirements.
153+
154+
- `Spring-WebFlux`: Spring sub framework allowing to create Reactive Rest Endpoint.
155+
156+
- `Spring-Actuator`: Expose Endpoints to expose metrics to third party system: health, infos, jmx,prometheus,...
157+
158+
- `Spring-Test`: Enabled unit testing and mocking with Spring configuration and beans.
159+
160+
- `Spring-Cloud`: Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state). Coordination of distributed systems leads to boiler plate patterns, and using Spring Cloud developers can quickly stand up services and applications that implement those patterns. They will work well in any distributed environment, including the developer’s own laptop, bare metal data centres, and managed platforms such as Cloud Foundry.
161+
162+
- `SpringFox` *(Swagger)*: Annotation based rest documentation generation and test client generation (swagger-ui).
163+
164+
![Pet Clinic Welcome Screen](doc/img/swagger.png?raw=true)
165+
166+
167+
### Logical Architecture
168+
169+
![Pet Clinic Welcome Screen](doc/img/logical-architecture.png?raw=true)
170+
171+
Here, you can find a description of the logical architecture components:
172+
173+
- `spring-parclinic-angular`: This is the existing project that provides a user interface implementation using Angular. It has been used as well for other backend projects like the
174+
**spring-petclinic-rest**
175+
176+
- `prometheus`: Our component exposes some metrics through the actuator endpoint. A registry will push this information into the Prometheus database (docker-based).
177+
178+
![Pet Clinic Welcome Screen](doc/img/prometheus.png?raw=true)
179+
180+
- `Grafana`: Allows to create dashboards based on data stored in prometheus.
181+
182+
![Pet Clinic Welcome Screen](doc/img/grafana.png?raw=true)
183+
184+
- `zipkin`: Our component includes the `spring-cloud-sleuth` dependency allowing Brave to push metrics usage of the API to the distributed tracing component Zipkin. To enable this tracing
185+
set the property `zipkin.enabled` to true in `application.yaml`.
186+
To start zipkin use `docker-compose up -d`
187+
188+
```
189+
zipkin:
190+
enabled: true
191+
baseUrl: http://localhost:9411
192+
sender:
193+
type: web
194+
```
195+
196+
![Pet Clinic Welcome Screen](doc/img/zipkin.png?raw=true)
197+
198+
- `Apache Cassandra`: A NoSQL database
199+
200+
- `DataStax Astra` : Apache Cassandra available in the Cloud for free as a managed service (DBaas)
201+
202+
203+
### Data Model diagram
204+
205+
The underlying data model implemented in Apache Cassandra is different from the one you would have defined with a relational database.
206+
207+
![Pet Clinic Welcome Screen](doc/img/data-model.png?raw=true)
208+
209+
To enable scalability, Apache Cassandra does not support joins or integrity constraints. Therefore we used some denormalization.
210+
We also created some `secondary indices` to queries columns that are not the PARTITION KEY. These secondary indices work well in this case because the cardinality is low (e.g, few pets for an owner).
211+
212+
The application generates the objects related to the data model (e.g., tables, indices, udts) at startup.
213+
214+
## C. Contributing
215+
216+
The [issue tracker](https://github.com/spring-petclinic/spring-petclinic-reactive/issues)is the preferred channel for bug reports, features requests and submitting pull requests.
217+
218+
For pull requests, editor preferences are available in the editor config for easy use in common text editors. Read more and download plugins at http://editorconfig.org.
219+
220+
221+
![banner](doc/img/banner.png?raw=true)

0 commit comments

Comments
 (0)