Skip to content
Permalink
Browse files

first commit

  • Loading branch information...
zhou-hao committed Aug 21, 2018
1 parent c0a3d1a commit 3e6cf7781607792115a93c842c0658a30a9e0e1d
Showing 6,698 changed files with 627,104 additions and 1 deletion.
The diff you're trying to view is too large. We only load the first 3000 changed files.
@@ -0,0 +1,24 @@
**/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/
@@ -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'
@@ -1 +1,75 @@
# hsweb-iot-cloud
# 开源物联网管理平台

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

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

### 技术栈

1. [spring-boot](https://spring.io/projects/spring-boot): 整合各种组件
2. [spring-cloud](https://spring.io/projects/spring-cloud): 对微服务提供支持
3. [hsweb-framework](https://github.com/hs-web/hsweb-framework): 基础业务框架
4. [vertx](https://vertx.io/): 物联网通信(mqtt,udp)
5. [redisson](https://github.com/redisson/redisson): redis客户端
6. [spring-cloud-stream](https://cloud.spring.io/spring-cloud-stream/): 事件驱动
7. [kafka](http://kafka.apache.org/): 消息中间件
8. [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 # 微服务通用依赖
-------------user-server # 用户服务
-------------interaction-server # 物联网设备交互服务

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


### 使用

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

以linux为例:

1. 下载源码

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

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

./start-dev-env.sh

未提供windows下的安装脚本,windows下请自行安装相关服务:`redis`,`zookeeper`,`kafka`.

3. 依次启动服务

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

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

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

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

### 贡献
目前缺前端大佬一名, 要求:
1. 有开源精神,原意无偿并长期献身开源项目.
2.`hsweb`感兴趣.
3. 有能力使用主流前端框架重写现有功能页面.
4. 加入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,17 @@
version: '2'
services:
redis:
image: redis
ports:
- "6379:6379"
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_HOST_NAME: localhost
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
docker-compose stop
docker-compose up
@@ -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

@@ -0,0 +1,154 @@
<?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>gateway-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.GateWayApplication</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.26</version>
</dependency>

<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>

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

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

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

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>

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

<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-spring-boot-starter</artifactId>
<version>${hsweb.framework.version}</version>
</dependency>

<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-basic</artifactId>
<version>${hsweb.framework.version}</version>
</dependency>

<!--组织架构权限-->
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-system-organizational-authorization</artifactId>
<version>${hsweb.framework.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-core</artifactId>
<version>${hsweb.framework.version}</version>
</dependency>
<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-okhttp</artifactId>
<version>8.18.0</version>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
</project>
Oops, something went wrong.

0 comments on commit 3e6cf77

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