-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump MySQL support from 5.7 to 8.4 and align spring profile with the …
…official Spring Petclinic version (#142)
- Loading branch information
Showing
17 changed files
with
122 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
services: | ||
mysql: | ||
image: mysql:8.4 | ||
command: --mysql-native-password=ON | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
- MYSQL_ROOT_PASSWORD= | ||
- MYSQL_ALLOW_EMPTY_PASSWORD=true | ||
- MYSQL_USER=petclinic | ||
- MYSQL_PASSWORD=petclinic | ||
- MYSQL_DATABASE=petclinic | ||
volumes: | ||
- "./conf.d:/etc/mysql/conf.d:ro" | ||
profiles: | ||
- mysql | ||
postgres: | ||
image: postgres:16.3 | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
- POSTGRES_PASSWORD=petclinic | ||
- POSTGRES_USER=petclinic | ||
- POSTGRES_DB=petclinic | ||
profiles: | ||
- postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
# HSQLDB config start | ||
#---------------------------------------------------------------- | ||
|
||
spring.sql.init.schema-locations=classpath*:db/hsqldb/initDB.sql | ||
spring.sql.init.data-locations=classpath*:db/hsqldb/populateDB.sql | ||
|
||
spring.datasource.url=jdbc:hsqldb:mem:petclinic | ||
spring.datasource.username=sa | ||
spring.datasource.username=sa | ||
spring.datasource.password= | ||
spring.jpa.database=HSQL | ||
spring.jpa.database-platform=org.hibernate.dialect.HSQLDialect | ||
spring.jpa.hibernate.ddl-auto=none | ||
#---------------------------------------------------------------- | ||
# HSQLDB config end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
# uncomment for init database (first start) | ||
#spring.sql.init.mode=always | ||
#spring.sql.init.schema-locations=classpath*:db/mysql/initDB.sql | ||
#spring.sql.init.data-locations=classpath*:db/mysql/populateDB.sql | ||
|
||
# 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 | ||
#---------------------------------------------------------------- | ||
# MySQL config end | ||
# database init, supports mysql too | ||
database=mysql | ||
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/petclinic} | ||
spring.datasource.username=${MYSQL_USER:petclinic} | ||
spring.datasource.password=${MYSQL_PASS:petclinic} | ||
# SQL is written to be idempotent so this is safe | ||
spring.sql.init.mode=always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
database=postgres | ||
spring.datasource.url=${POSTGRES_URL:jdbc:postgresql://localhost/petclinic} | ||
spring.datasource.username=${POSTGRES_USER:petclinic} | ||
spring.datasource.password=${POSTGRES_PASS:petclinic} | ||
# SQL is written to be idempotent so this is safe | ||
spring.sql.init.mode=always |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
src/main/resources/db/mysql/initDB.sql → src/main/resources/db/mysql/schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
src/main/resources/db/postgres/petclinic_db_setup_postgres.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
================================================================================ | ||
=== Spring PetClinic sample application - PostgreSQL Configuration === | ||
================================================================================ | ||
|
||
@author Vitaliy Fedoriv | ||
@autor Antoine Rey | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
1) Run the "docker-compose.yml" from the root of the project: | ||
|
||
$ docker-compose up | ||
... | ||
spring-petclinic-postgres-1 | The files belonging to this database system will be owned by user "postgres". | ||
... | ||
|
||
2) Run the app with `spring.profiles.active=postgres` (e.g. as a System property via the command | ||
line, but any way that sets that property in a Spring Boot app should work). For example use | ||
|
||
mvn spring-boot:run -Dspring-boot.run.profiles=postgres | ||
|
||
To activate the profile on the command line. |
File renamed without changes.
27 changes: 0 additions & 27 deletions
27
src/main/resources/db/postgresql/petclinic_db_setup_postgresql.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters