Skip to content

Commit 5fe9841

Browse files
committed
adding sample
1 parent 218e4a0 commit 5fe9841

File tree

128 files changed

+34996
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+34996
-0
lines changed

samples/bookstore-demo/.gitignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/
34+
target/
35+
pom.xml.tag
36+
pom.xml.releaseBackup
37+
pom.xml.versionsBackup
38+
pom.xml.next
39+
release.properties
40+
dependency-reduced-pom.xml
41+
buildNumber.properties
42+
.mvn/timing.properties
43+
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
44+
.mvn/wrapper/maven-wrapper.jar
45+
46+
# Eclipse m2e generated files
47+
# Eclipse Core
48+
.project
49+
# JDT-specific (Eclipse Java Development Tools)
50+
.classpath
51+
52+
53+
.terraform*
54+
terraform.tfstate
55+
terraform.tfstate.backup
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

samples/bookstore-demo/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM openjdk:23-slim-bullseye
2+
3+
WORKDIR /app
4+
5+
RUN apt-get update && apt-get install -y maven
6+
COPY ./target/test-sessions-0.0.1-SNAPSHOT.jar .
7+
8+
WORKDIR /app
9+
10+
CMD ["java", "-jar", "test-sessions-0.0.1-SNAPSHOT.jar", "--spring.profiles.active=docker"]

samples/bookstore-demo/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Redis Sessions Java Example
2+
3+
This is an example project demonstrating the usage of the Redis Sessions Java library.
4+
5+
## How to Run
6+
7+
### In Docker
8+
9+
If you want to run the whole thing within docker (the project itself as well as the accompanying services) you may do so using:
10+
11+
```shell
12+
docker compose up
13+
```
14+
15+
### Locally
16+
17+
To run this project you must first install the required jars locally:
18+
19+
```bash
20+
mvn install:install-file \
21+
-Dfile=jars/redis-enterprise-sessions-spring-1.0-SNAPSHOT.jar \
22+
-DgroupId=redis.enterprise.sessions \
23+
-DartifactId=redis-enterprise-sessions-spring \
24+
-Dversion=1.0-SNAPSHOT \
25+
-Dpackaging=jar \
26+
-DgeneratePom=true
27+
28+
29+
mvn install:install-file \
30+
-Dfile=jars/redis-enterprise-sessions-core-1.0-SNAPSHOT-jar-with-dependencies.jar \
31+
-DgroupId=redis.enterprise.sessions \
32+
-DartifactId=redis-enterprise-sessions-core \
33+
-Dversion=1.0-SNAPSHOT \
34+
-Dpackaging=jar \
35+
-DgeneratePom=true
36+
```
37+
38+
At which point you may spin up the required services using docker:
39+
40+
```bash
41+
docker compose -f docker-compose-ide.yml up
42+
```
43+
44+
After which you may run the app either directly from your IDE or as a simple jar command after packaging:
45+
46+
```shell
47+
mvn package
48+
java -jar target/test-sessions-0.0.1-SNAPSHOT.jar --spring.profiles.active=docker
49+
```
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
version: '3.7'
2+
3+
services:
4+
redis:
5+
image: redis/redis-stack-server
6+
ports:
7+
- 6379:6379
8+
postgres:
9+
image: postgres:latest
10+
environment:
11+
- "POSTGRES_USER=postgres"
12+
- "POSTGRES_PASSWORD=postgres"
13+
ports:
14+
- 5432:5432
15+
volumes:
16+
- ~/postgres_data:/var/lib/postgresql/data
17+
prometheus:
18+
image: prom/prometheus
19+
container_name: prometheus
20+
ports:
21+
- "9090:9090"
22+
volumes:
23+
- ./prometheus/prometheus-local.yml:/etc/prometheus/prometheus.yml
24+
grafana:
25+
container_name: grafana
26+
image: grafana/grafana:latest
27+
ports:
28+
- '3001:3000'
29+
environment:
30+
- GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer
31+
- GF_AUTH_ANONYMOUS_ENABLED=true
32+
- GF_AUTH_ANONYMOUS_ORG_NAME=Main Org.
33+
- GF_SECURITY_ALLOW_EMBEDDING=true
34+
- GF_SERVER_ROOT_URL=http://grafana:3000/grafana
35+
- GF_SERVER_DOMAIN=grafana
36+
- GF_LOG_LEVEL=error
37+
- GF_SERVER_SERVE_FROM_SUB_PATH=false
38+
links:
39+
- prometheus
40+
volumes:
41+
- ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
42+
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
43+
- ./grafana/dashboards:/var/lib/grafana/dashboards
44+
45+
volumes:
46+
prometheus-data:
47+
# volumes:
48+
# postgres_data:
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
version: '3.7'
2+
3+
services:
4+
redis:
5+
image: redis/redis-stack-server
6+
ports:
7+
- 6379:6379
8+
postgres:
9+
image: postgres:latest
10+
environment:
11+
- "POSTGRES_USER=postgres"
12+
- "POSTGRES_PASSWORD=postgres"
13+
ports:
14+
- 5432:5432
15+
healthcheck:
16+
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
17+
interval: 5s
18+
timeout: 5s
19+
retries: 5
20+
start_period: 5s
21+
volumes:
22+
- ~/postgres_data:/var/lib/postgresql/data
23+
frontend:
24+
image: frontend
25+
# environment:
26+
# - "REACT_PROXY_ENDPOINT=http://host.docker.internal:8080"
27+
build:
28+
context: ./frontend
29+
ports:
30+
- 80:80
31+
links:
32+
- backend
33+
- grafana
34+
depends_on:
35+
- backend
36+
- grafana
37+
volumes:
38+
- ./frontend/nginx.conf:/etc/nginx/nginx.conf
39+
backend:
40+
build:
41+
context: .
42+
ports:
43+
- 8080:8080
44+
depends_on:
45+
postgres:
46+
condition: service_healthy
47+
links:
48+
- redis
49+
- postgres
50+
prometheus:
51+
image: prom/prometheus
52+
container_name: prometheus
53+
depends_on:
54+
- backend
55+
links:
56+
- backend
57+
ports:
58+
- "9090:9090"
59+
volumes:
60+
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
61+
grafana:
62+
container_name: grafana
63+
image: grafana/grafana:latest
64+
ports:
65+
- '3001:3000'
66+
environment:
67+
- GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer
68+
- GF_AUTH_ANONYMOUS_ENABLED=true
69+
- GF_AUTH_ANONYMOUS_ORG_NAME=Main Org.
70+
- GF_SECURITY_ALLOW_EMBEDDING=true
71+
- GF_SERVER_ROOT_URL=http://grafana:3000/grafana
72+
- GF_SERVER_DOMAIN=grafana
73+
- GF_LOG_LEVEL=error
74+
- GF_SERVER_SERVE_FROM_SUB_PATH=false
75+
links:
76+
- prometheus
77+
volumes:
78+
- ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
79+
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
80+
- ./grafana/dashboards:/var/lib/grafana/dashboards
81+
82+
volumes:
83+
prometheus-data:
84+
# volumes:
85+
# postgres_data:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM node:18-alpine AS build
2+
3+
WORKDIR /app
4+
5+
COPY package*.json ./
6+
7+
RUN npm install
8+
9+
COPY . .
10+
11+
RUN npm run build
12+
13+
FROM nginx:stable-alpine
14+
15+
COPY --from=build /app/build /usr/share/nginx/html
16+
17+
RUN mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
18+
19+
EXPOSE 80
20+
21+
CMD ["nginx", "-g", "daemon off;"]
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `npm start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13+
14+
The page will reload when you make changes.\
15+
You may also see any lint errors in the console.
16+
17+
### `npm test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21+
22+
### `npm run build`
23+
24+
Builds the app for production to the `build` folder.\
25+
It correctly bundles React in production mode and optimizes the build for the best performance.
26+
27+
The build is minified and the filenames include the hashes.\
28+
Your app is ready to be deployed!
29+
30+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31+
32+
### `npm run eject`
33+
34+
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
35+
36+
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37+
38+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39+
40+
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41+
42+
## Learn More
43+
44+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45+
46+
To learn React, check out the [React documentation](https://reactjs.org/).
47+
48+
### Code Splitting
49+
50+
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51+
52+
### Analyzing the Bundle Size
53+
54+
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55+
56+
### Making a Progressive Web App
57+
58+
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59+
60+
### Advanced Configuration
61+
62+
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63+
64+
### Deployment
65+
66+
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67+
68+
### `npm run build` fails to minify
69+
70+
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

0 commit comments

Comments
 (0)