.mvn/wrapper | ||
.vscode | ||
src | ||
.editorconfig | ||
.gitignore | ||
.travis.yml | ||
app-env-vars.png | ||
build-config.png | ||
clean.sh | ||
create-project.png | ||
db-params.png | ||
db.png | ||
docker-compose.yml | ||
mvnw | ||
mvnw.cmd | ||
mysql-ephimeral.png | ||
mysql-terminal.png | ||
output-ui.png | ||
petclinic-deploy.png | ||
petclinic-url.png | ||
pom.xml | ||
readme.md | ||
screenshot.png | ||
switch-perspective.png |
Sprint PetClinic and OpenShift
Local Development
mvn package
docker-compose up
java -Dspring.profiles.active=mysql -jar target/spring-petclinic-2.3.0.BUILD-SNAPSHOT.jar
docker exec -it spring-petclinic_mysql_1 mysql -upetclinic -ppetclinic
show databases;
use petclinic;
show tables;
+---------------------+
| Tables_in_petclinic |
+---------------------+
| owners |
| pets |
| specialties |
| types |
| vet_specialties |
| vets |
| visits |
+---------------------+
7 rows in set (0.00 sec)
select * from petclinic.owners;
+----+------------+-----------+-----------------------+-------------+------------+
| id | first_name | last_name | address | city | telephone |
+----+------------+-----------+-----------------------+-------------+------------+
| 1 | George | Franklin | 110 W. Liberty St. | Madison | 6085551023 |
| 2 | Betty | Davis | 638 Cardinal Ave. | Sun Prairie | 6085551749 |
| 3 | Eduardo | Rodriquez | 2693 Commerce St. | McFarland | 6085558763 |
| 4 | Harold | Davis | 563 Friendly St. | Windsor | 6085553198 |
| 5 | Peter | McTavish | 2387 S. Fair Way | Madison | 6085552765 |
| 6 | Jean | Coleman | 105 N. Lake St. | Monona | 6085552654 |
| 7 | Jeff | Black | 1450 Oak Blvd. | Monona | 6085555387 |
| 8 | Maria | Escobito | 345 Maple St. | Madison | 6085557683 |
| 9 | David | Schroeder | 2749 Blackhawk Trail | Madison | 6085559435 |
| 10 | Carlos | Estaban | 2335 Independence La. | Waunakee | 6085555487 |
| 11 | Burr | Sutter | 123 ABC Lane | Wonderland | 5555555555 |
| 12 | test | test | test | test | 1231231321 |
+----+------------+-----------+-----------------------+-------------+------------+
12 rows in set (0.00 sec)
http://localhost:8080
## For OpenShift:
Dev Console
Create a new OpenShift Project
with spring-petclinic-devconsole
name.
Then move to Developer perspective:
And create a new MySQL instance by clicking the +Add
button and choose Database
type:
Choose MySQL Ephimeral:
and Push Instantiate Template
.
Then fill the wizard with the following parameters:
Push the Create
button.
Let's deploy the Pet Clinic app.
And create a new MySQL instance by clicking the +Add
button and choose From Git
type:
Fill the Git repo with the following value https://github.com/burrsutter/spring-petclinic
and select the project as Java project:
Push the link to Build Configuration
:
Add the following environment variables for the application Pod:
Finally push the Create
button and wait until the Build is done and the Pod is up and running (dark blue around the deployment bubble).
Push the Open URL button to view the Pet Clinic app: