Skip to content
Permalink
Browse files

first commit

  • Loading branch information...
zhou-hao committed Jan 21, 2019
1 parent 7358f6b commit 381b64b19343017b07ca5093ba9da9363cca43d1
Showing 6,730 changed files with 834,403 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
@@ -0,0 +1,26 @@
**/pom.xml.versionsBackup
**/target/
**/out/
**/log/
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
.idea/
/nbproject
*.ipr
*.iws
*.iml

# Package Files #
*.jar
*.war
*.ear
*.log
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
**/transaction-logs/
pom.xml.versionsBackup
build/
/data/
!/.mvn/wrapper/maven-wrapper.jar
bin/
Binary file not shown.
@@ -0,0 +1 @@
distributionUrl=http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip?spm=0.0.0.0.7d3k4a&file=apache-maven-3.3.9-bin.zip
@@ -0,0 +1,11 @@
language: java
sudo: false
jdk:
- oraclejdk8
script:
- mvn test
after_success:
- bash <(curl -s https://codecov.io/bash)
cache:
directories:
- '$HOME/.m2/repository'
@@ -0,0 +1,76 @@
# 开源物联网管理平台

[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square)](https://www.apache.org/licenses/LICENSE-2.0.html)

## 目的
提供一个开源的物联网管理平台,支持各种设备接入,并完成数据上报,分析,处理等自定义功能.

### 技术栈
1. java8,maven3
2. [spring-boot](https://spring.io/projects/spring-boot): 整合各种组件
3. [hsweb](https://github.com/hs-web): 后台管理基础框架
4. [spring-cloud](https://spring.io/projects/spring-cloud): 对微服务提供支持
5. [hsweb-framework](https://github.com/hs-web/hsweb-framework): 基础业务框架
6. [vertx](https://vertx.io/): 物联网通信(mqtt,udp)
7. [redisson](https://github.com/redisson/redisson): redis客户端
8. [spring-cloud-stream](https://cloud.spring.io/spring-cloud-stream/): 事件消息驱动
9. [rabbitMQ](http://www.rabbitmq.com): 消息中间件
10. [docker](https://www.docker.com/): 快速环境搭建,持续交付

在使用本项目之前,你应该对以上技术有所了解.

### 模块介绍

---------hsweb-iot-cloud
-------------docker # 一些docker脚本
---------------dev-env # 启动开发环境需要的外部服务(redis,kafka,zookeeper等)
-------------eureka-server # 服务注册中心
-------------gateway-server # 基于zuul的网关服务
-------------iot-components # 通用组件
------------------iot-authorization # 权限集成
------------------iot-cloud-stream # spring-cloud-stream集成
------------------iot-logging # 访问日志,系统日志集成
------------------iot-redis # redis集成
------------------server-dependencies # 微服务通用依赖
-------------mqtt-emulator # mqtt客户端模拟器
-------------user-server # 用户服务
-------------vertx-server # 物联网设备交互服务

约定: 所有微服务以`-server`为后缀,微服务禁止依赖其他微服务,只能依赖`iot-components`内的通用依赖.
微服务间使用`FeignClient`或者`spring cloud stream` 进行通信.


### 使用

本项目使用了redis,mysql,rabbitMQ.因此在启动项目之前需要先安装并启动相应服务.

以linux为例:

1. 下载源码

git clone https://github.com/hs-web/hsweb-iot-cloud.git

2. 执行启动开发环境脚本,将会使用docker安装相应服务.(自行安装docker)

./start-dev-env.sh

未提供windows下的安装脚本,windows下请自行安装相关服务:`Redis`,`mysql`,`RabbitMQ`.

3. 依次启动服务(所有以`-server`结尾的模块)

eureka-server,gateway-server,user-server....

4. 服务启动成功后,浏览器访问: http://localhost:8000 ,用户名:admin 密码: admin

5. 数据库,项目默认使用`h2``mysql`数据库,可自行修改`application.yml`配置更改数据库,目前支持: h2,mysql,oracle数据库.
系统首次启动将会自动初始化数据库,无需导入数据库脚本.

遇到问题? 可以加入QQ群:`515649185`,
或者使用[issues](https://github.com/hsweb-pro/hsweb-iot-cloud/issues/new)提问.

### QQ群

`515649185`(备注:`hsweb-iot-cloud`).

### License
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square)](https://www.apache.org/licenses/LICENSE-2.0.html)
@@ -0,0 +1,28 @@
version: '2'
services:
redis:
image: redis
ports:
- "6379:6379"
rabbit-mq:
image: rabbitmq:3-management
ports:
- "15672:15672"
- "5672:5672"
environment:
APPLICATION_SECRET: admin
user-mysql: # user 数据库
image: mysql:5.7
volumes:
- "user-database:/var/lib/mysql"
ports:
- 3306
restart: always
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
environment:
MYSQL_ROOT_PASSWORD: hsweb-iot-cloud
MYSQL_DATABASE: user_server


volumes:
user-database:
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
docker-compose stop
docker-compose up
@@ -0,0 +1,2 @@
FROM haproxy:1.7
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
@@ -0,0 +1,32 @@
global
maxconn 20000
ulimit-n 204800
log 127.0.0.1 local3
nbproc 4 #启动后运行的进程数量
daemon
pidfile /var/run/haproxy.pid
defaults
mode http
log global
option dontlognull
option httpclose
option tcplog
option redispatch
timeout connect 10000
timeout client 300000
timeout server 300000
maxconn 60000
retries 3

frontend mqtt-server
bind *:1883
mode tcp
option tcplog
default_backend mqtt-server

backend mqtt-server
mode tcp
balance leastconn
option tcplog
server s1 mqtt-server-01:1884 weight 1

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
docker run -it --rm -p 1884:1883 --name hsweb-iot-cloud-haproxy \
-v ${PWD}/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg haproxy:1.7 \
haproxy -f /usr/local/etc/haproxy/haproxy.cfg
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-iot-cloud</artifactId>
<groupId>org.hswebframework.iot</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>eureka-server</artifactId>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<mainClass>org.hswebframework.iot.EurekaApplication</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>

</dependencies>
</project>
@@ -0,0 +1,18 @@
package org.hswebframework.iot;

import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;


/**
* @author zhouhao
* @since 1.0
*/
@SpringCloudApplication
@EnableEurekaServer
public class EurekaApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaApplication.class, args);
}
}
@@ -0,0 +1,2 @@
logging:
level: warn
@@ -0,0 +1,14 @@
server:
port: 8761
eureka:
client:
fetch-registry: false
register-with-eureka: false
server:
# 自我保护模式,当出现出现网络分区、eureka在短时间内丢失过多客户端时,会进入自我保护模式,即一个服务长时间没有发送心跳,eureka也不会将其删除,默认为true
enable-self-preservation: true
eviction-interval-timer-in-ms: 5000
spring:
application:
name: eureka-server

Oops, something went wrong.

0 comments on commit 381b64b

Please sign in to comment.
You can’t perform that action at this time.