Skip to content

Commit

Permalink
Merge branch 'release/0.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Aug 12, 2021
2 parents 922297f + 0ad0284 commit 8fa2d5a
Show file tree
Hide file tree
Showing 116 changed files with 4,246 additions and 1,438 deletions.
12 changes: 4 additions & 8 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
---
kind: pipeline
type: exec
type: docker
name: default

platform:
os: linux
arch: amd64

steps:
- name: greeting
- name: install
image: maven:3-jdk-11
commands:
- echo HELLO WORLD! Drone on Docker
- mvn clean compile --batch-mode --show-version -DskipTests=true -Dmaven.javadoc.skip=true
597 changes: 231 additions & 366 deletions CHANGELOG.md

Large diffs are not rendered by default.

42 changes: 24 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,41 +26,47 @@ Here is the highlights of **Muscle and Fitness Server**:

2. [Spring Cloud](https://spring.io/projects/spring-cloud) Feature:

- Consul - Service registration and discovery.
- Spring Cloud Gateway - API Gateway on top of Spring WebFlux. Provide a simple, yet effective way to route to APIs and provide cross cutting concerns to them such as: security, monitoring/metrics, and resiliency.
- Spring Cloud OpenFeign - Declarative REST Client: Feign creates a dynamic implementation of an interface decorated with JAX-RS or Spring MVC annotations. Enhanced connection by Okhttp 3.
- Spring Boot Admin - Admin UI for administration of spring boot applications.
- Zipkin - a distributed tracing system. It helps gather timing data needed to troubleshoot latency problems in service architectures.
- [Consul](https://www.consul.io/) - Service registration and discovery.
- [Spring Cloud Gateway](https://spring.io/projects/spring-cloud-gateway) - API Gateway on top of Spring WebFlux. Provide a simple, yet effective way to route to APIs and provide cross cutting concerns to them such as: security, monitoring/metrics, and resiliency.
- [Spring Cloud OpenFeign](https://spring.io/projects/spring-cloud-openfeign) - Declarative REST Client: Feign creates a dynamic implementation of an interface decorated with JAX-RS or Spring MVC annotations. Enhanced connection by Okhttp 3.
- [Spring Boot Admin](https://codecentric.github.io/spring-boot-admin/current/) - Admin UI for administration of spring boot applications.
- [Zipkin](https://zipkin.io/) - a distributed tracing system. It helps gather timing data needed to troubleshoot latency problems in service architectures.

3. Secured API. RBAC control by API gateway and Auth Center. JWT authentication, and RBAC authorization.
3. Customized Spring Cloud Starter for traditional Spring MVC and Reactive Spring WebFlux microservice. Encapsulated a bunch of libraries and dependencies. Developer can import those dependencies by demand.

4. Higher-level packaging other libraries: `Spring Cloud Starter`, auto configuration for Spring Cloud services.
- For Spring MVC, [spring-cloud-starter](https://github.com/johnnymillergh/muscle-and-fitness-server/tree/master/spring-cloud-starter)
- For Spring WebFlux, [reactive-spring-cloud-starter](https://github.com/johnnymillergh/muscle-and-fitness-server/tree/master/reactive-spring-cloud-starter)

5. MySQL cluster support. Multi data source. Dynamic SQL read-write isolation. MyBatis-Plus is the integrated ORM library.
4. Secured API. [RBAC](https://en.wikipedia.org/wiki/Role-based_access_control) by API gateway and Auth Center. JWT authentication, and RBAC authorization.

6. Redis 6.x support.
5. [MySQL Replication for High Availability](https://severalnines.com/resources/database-management-tutorials/mysql-replication-high-availability-tutorial). Multi data source. Dynamic SQL read-write isolation. MyBatis-Plus is the integrated ORM library.

6. Redis 6.x support. [Master-slave replication for high availability](https://redis.io/topics/replication). Redis cluster

7. Docker, Rancher Kubernetes support. Google JIB for building Docker container images.

8. OSS service, based on Minio and SFTP integration.
8. OSS service, based on [Minio](https://min.io/) and SFTP integration. Asynchronous [Progressive Download](https://www.nginx.com/resources/glossary/progressive-download/) resources. The media player will play back that content using sequential byte-range requests. Refers to [a request for partial content](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) (HTTP 206). This type of request is typically used to retrieve a large asset in smaller segments. This technique is employed by HTTP Progressive Download to avoid long buffering times.

9. STOMP over WebSocket (SockJS), real time messaging, based on RabbitMQ STOMP message broker.
9. [STOMP over WebSocket](https://www.toptal.com/java/stomp-spring-boot-websocket) (SockJS), real time messaging, based on [RabbitMQ STOMP](https://www.rabbitmq.com/stomp.html) message broker.

10. Quartz support. Distributed job scheduling, based on JDBC.
10. [Quartz](http://www.quartz-scheduler.org/) support. Distributed job scheduling, based on JDBC.

11. Multi-environment support.

12. API visualization. Enhanced Swagger API documentation.
12. [Knife4j](https://doc.xiaominfo.com/) API visualization. Enhanced Swagger API documentation.

13. Log compression. [ELK](https://www.elastic.co/what-is/elk-stack) log aggregation.

13. Log compression. ELK log aggregation.
14. AOP based request log, configurable for turning on or off.

14. Request log.
15. Customized method argument validation.

15. Method Argument Validation Aspect.
- [Date time range validator](https://github.com/johnnymillergh/muscle-and-fitness-server/blob/master/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/validation/validator/DateTimeRangeValidator.java)
- [Enum value validator](https://github.com/johnnymillergh/muscle-and-fitness-server/blob/master/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/validation/validator/EnumValueValidator.java)

16. Docker container log persistence.
16. Docker container log persistence. Size and time based rolling policy.

17. Startup statistics.
17. [Startup and deployment statistics](https://github.com/johnnymillergh/muscle-and-fitness-server/blob/master/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/helper/SpringBootStartupHelper.java).

18. Customized startup banner.

Expand Down
55 changes: 54 additions & 1 deletion api-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>com.jmsoftware.maf</groupId>
<artifactId>muscle-and-fitness-server</artifactId>
<version>0.0.2</version>
<version>0.0.3</version>
</parent>

<!-- Build Settings -->
Expand All @@ -30,6 +30,44 @@
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.14.0</version>
<configuration>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<targetJdk>${java.version}</targetJdk>
<printFailingErrors>true</printFailingErrors>
<rulesets>
<ruleset>rulesets/java/ali-comment.xml</ruleset>
<ruleset>rulesets/java/ali-concurrent.xml</ruleset>
<ruleset>rulesets/java/ali-constant.xml</ruleset>
<ruleset>rulesets/java/ali-exception.xml</ruleset>
<ruleset>rulesets/java/ali-flowcontrol.xml</ruleset>
<ruleset>rulesets/java/ali-naming.xml</ruleset>
<ruleset>rulesets/java/ali-oop.xml</ruleset>
<ruleset>rulesets/java/ali-orm.xml</ruleset>
<ruleset>rulesets/java/ali-other.xml</ruleset>
<ruleset>rulesets/java/ali-set.xml</ruleset>
</rulesets>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.alibaba.p3c</groupId>
<artifactId>p3c-pmd</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
</plugin>

<!-- https://github.com/GoogleContainerTools/jib/blob/master/jib-maven-plugin/README.md -->
<plugin>
<groupId>com.google.cloud.tools</groupId>
Expand Down Expand Up @@ -80,17 +118,32 @@
</plugins>
</build>

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</reporting>

<!-- Scoped Dependencies Management -->
<dependencies>
<dependency>
<groupId>com.jmsoftware.maf</groupId>
<artifactId>reactive-spring-cloud-starter</artifactId>
</dependency>

<!-- Spring Dependencies -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>

<dependency>
<groupId>com.github.xiaoymin</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import cn.hutool.core.util.StrUtil;
import com.jmsoftware.maf.apigateway.remoteapi.AuthCenterRemoteApi;
import com.jmsoftware.maf.common.domain.authcenter.security.UserPrincipal;
import com.jmsoftware.maf.common.exception.BusinessException;
import com.jmsoftware.maf.common.exception.BizException;
import com.jmsoftware.maf.common.exception.SecurityException;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
Expand Down Expand Up @@ -57,8 +57,8 @@ private Mono<UserDetails> retrieveUser(String username) {
return Mono.error(
new SecurityException(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED, "Username mustn't be blank"));
}
return authCenterRemoteApi.getUserByLoginToken(username)
.switchIfEmpty(Mono.error(new BusinessException("Authentication failure! Cause: User not found")))
return this.authCenterRemoteApi.getUserByLoginToken(username)
.switchIfEmpty(Mono.error(new BizException("Authentication failure! Cause: User not found")))
.map(data -> {
log.info("Authentication success! Found {}", data);
return UserPrincipal.create(data, null, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ spring:
base-url: http://maf-zipkin:9411
devtools:
add-properties: true
redis:
host: maf-redis

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis
10 changes: 8 additions & 2 deletions api-gateway/src/main/resources/application-development-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ spring:
add-properties: true
zipkin:
base-url: http://localhost:9411
redis:

redis:
master:
host: localhost
port: 6379
password: maf@redis
slaves:
- host: localhost
port: 6380
password: maf@redis

maf:
configuration:
web-security-enabled: false
web-security-enabled: true
10 changes: 8 additions & 2 deletions api-gateway/src/main/resources/application-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ spring:
add-properties: false
zipkin:
base-url: http://maf-zipkin:9411
redis:
host: maf-redis

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis
10 changes: 8 additions & 2 deletions api-gateway/src/main/resources/application-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ spring:
add-properties: false
zipkin:
base-url: http://maf-zipkin:9411
redis:
host: maf-redis

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis
10 changes: 8 additions & 2 deletions api-gateway/src/main/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ spring:
add-properties: false
zipkin:
base-url: http://maf-zipkin:9411
redis:
host: maf-redis

redis:
master:
host: maf-redis-master
port: 6379
password: maf@redis
slaves:
- host: maf-redis-slave-1
port: 6379
password: maf@redis
1 change: 1 addition & 0 deletions api-gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ maf:
- "/swagger-resources/**"
- "/v2/api-docs/**"
- "/*/v2/api-docs/**"
- "/webjars/**"
- "/*/webjars/**"
- "/doc.html"
- "/oss-center/**"
2 changes: 1 addition & 1 deletion auth-center/auto-run-windows.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SET skipMavenBuild=true
SET minimalJavaMajorVersion=11
SET javaExe=C:\Users\Johnny\.sdkman\candidates\java\11.0.10.hs-adpt\bin\java.exe
SET mavenActiveProfile="development-local"
SET javaParameter=-Xms256m -Xmx256m -Dfile.encoding=UTF-8 -Dspring.cloud.consul.host=localhost
SET javaParameter=-Xms256m -Xmx256m -Dfile.encoding=UTF-8 -Dspring.cloud.consul.host=localhost -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:2345

GOTO:MAIN

Expand Down
Loading

0 comments on commit 8fa2d5a

Please sign in to comment.