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

docs: update the petclinic readme for mysql support #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions spring-petclinic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ Prerequisites For Binary:
2. OpenJDK 17.0.9
3. MVN version 3.6.3

## Setup the backend
# Setup the backend

## Using Postgres as the database
You need to update the postgresql properties, go to
`spring-petclinic/spring-petclinic-rest/src/main/resources/application-postgresql.properties`
and change
Expand All @@ -65,12 +66,44 @@ and then build the jar using:
mvn clean install -Dmaven.test.skip=true
```

## Spin up the database
#### Spin up the database

```
docker run -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 --name mypostgres postgres:15.2
```

## Using MySQL as the database
You need to update the properties file , go to
`spring-petclinic/spring-petclinic-rest/src/main/resources/application.properties`
and make active profile as mysql -
```
spring.profiles.active=mysql,spring-data-jpa
```
Inside the `src/main/resources/application-mysql.properties` change the url to
```
spring.datasource.url=jdbc:mysql://localhost:3306/testdb?useSSL=false&allowPublicKeyRetrieval=true
```
and then build the jar using:

```
mvn clean install -Dmaven.test.skip=true
```
:
Copy link
Member

Choose a reason for hiding this comment

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

please remove this

#### Spin up the MySQL database

```
docker run command - docker run -e MYSQL_USER=mysql -e MYSQL_PASSWORD=123456 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=testdb -p 3306:3306 --rm mysql:latest
Copy link
Member

Choose a reason for hiding this comment

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

"Docker run command - " should be out of the codeblock.

```

### Some limitations currently in mysql parser -

1) Please note that SSL is currently not supported in the MySQL integration. To use the package without SSL, you can include the following parameters in your database URL like the following example -
```
spring.datasource.url=jdbc:mysql://localhost:3306/testdb?useSSL=false&allowPublicKeyRetrieval=true
Copy link
Member

Choose a reason for hiding this comment

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

Insteading of righting the same code block again, reference the above code block here, or mention this point above itself.

```

2) Currently best experience for using MySQL support of keploy is to use default settings which where
Copy link
Member

Choose a reason for hiding this comment

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

Please make this point clear or remove it.


## Recording the testcases with Keploy

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

# MySQL config start
#----------------------------------------------------------------
spring.datasource.url = jdbc:mysql://localhost:3306/petclinic?useUnicode=true
spring.datasource.username=pc
spring.datasource.password=petclinic
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.database=MYSQL
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto=none

spring.datasource.url=jdbc:mysql://localhost:3306/testdb?useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=123456

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto=update
#----------------------------------------------------------------
# MySQL config end

# docker run command - docker run -e MYSQL_USER=mysql -e MYSQL_PASSWORD=123456 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=testdb -p 3306:3306 --rm mysql:latest
Loading