Deployment Guide
Living Progress - Build - Mentor Me API.
- Java 8
- Maven3+
- MySQL 5.7.x
- SMTP Server You may use FakeSMTP
- Chrome with postman(to verify api only)
Edit src/main/resources/application.properties.
you must change spring.datasource.url, spring.datasource.username, spring.datasource.password to match your mysql configuration and
spring.mail.host, spring.mail.port(more configurations please check commented email configurations for example auth,ttls and etc) to match your smtp configurations.
Others are recommend to not change but you may change with your need.
You may change port with key server.port, default is 8080.
Edit src/main/resources/log4j.properties.
You can change log level used in application with key log4j.logger.com.livingprogress.mentorme.
Edit src/main/resources/templates.
It exists subject.vm and body.vm in nested folder with email name.
Edit src/test/resources/test.properties.
Same key defined src/test/resources/test.properties will overwrite configuration defined in src/main/resources/application.properties.
You must change spring.datasource.url if you want to test with different database defined in src/main/resources/application.properties.
You may change **spring.mail.port ** to different port but please make sure not conflicts with ports in your computer it will start mock smtp server during test with this port.
so please not change spring.mail.host since it will listen localhost.
Please check all property keys in src/main/resources/application.properties.
You can custom using command line parameters or system variables easily.
For example custom server port -Dserver.port=8087 as command line parameter or using set server.port=8087 under windows or export SERVER_PORT=8087 under linux.
similar for database,email related configurations.
Details about order please check Externalized Configuration. For example if you define port in command line parameter and system variable at same time it will use command line parameter.
Create schemas with sqls/schema.sql.
Create tables in above schemas with sqls/ddl.sql.
If you want to drop all tables please run sqls/drop.sql.
If you want to clean all tables please run sqls/clear.sql.
If you want to prepare test data please run sqls/testdata.sql.
Make sure your configurations are right.
mvn clean testYou can also test with coverage report in target/site/jacoco/index.html after run below command.
mvn clean test jacoco:reportmvn clean packageMove to target folder
Start api service listening 8080
java -jar mentorme-api.jarOpen http://editor.swagger.io/ and copy docs/swagger.yaml to verify.
Prepare clean and test data in mysql with sqls/clear.sql and sqls/testdata.sql.
Import Postman collection docs/postman.json with environment variables docs/postman-env.json.
You can test basic auth with username=test{X} X could be 1-14, password=password, please use basic auth feature of Postman to verify.
Almost all requests will use JWT token auth defined in environment variable, but you can change to use basic auth easily.