-
Notifications
You must be signed in to change notification settings - Fork 24.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5aedb47
commit a9bcd80
Showing
9 changed files
with
136 additions
and
15 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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
spring.docker.compose.profiles.active=${database} |
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
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,36 @@ | ||
================================================================================ | ||
=== Spring PetClinic sample application - MySQL Configuration === | ||
================================================================================ | ||
|
||
@author Sam Brannen | ||
@author Costin Leau | ||
@author Dave Syer | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
1) Download and install the MySQL database (e.g., MySQL Community Server 5.1.x), | ||
which can be found here: https://dev.mysql.com/downloads/. Or run the | ||
"docker-compose.yml" from the root of the project (if you have docker installed | ||
locally): | ||
|
||
$ docker-compose up | ||
... | ||
mysql_1_eedb4818d817 | MySQL init process done. Ready for start up. | ||
... | ||
|
||
2) (Once only) create the PetClinic database and user by executing the "db/mysql/user.sql" | ||
scripts. You can connect to the database running in the docker container using | ||
`mysql -u root -h localhost --protocol tcp`, but you don't need to run the script there | ||
because the petclinic user is already set up if you use the provided `docker-compose.yml`. | ||
|
||
3) Run the app with `spring.profiles.active=mysql` (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=mysql | ||
|
||
To activate the profile on the command line. | ||
|
||
N.B. the "petclinic" database has to exist for the app to work with the JDBC URL value | ||
as it is configured by default. This condition is taken care of automatically by the | ||
docker-compose configuration provided, or by the `user.sql` script if you run that as | ||
root. |
19 changes: 19 additions & 0 deletions
19
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,19 @@ | ||
=============================================================================== | ||
=== Spring PetClinic sample application - PostgreSQL Configuration === | ||
=============================================================================== | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
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. |
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