Skip to content

Commit

Permalink
fix: add make ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lsxredrain committed Jan 7, 2022
1 parent c381d51 commit 8d26126
Show file tree
Hide file tree
Showing 189 changed files with 7,228 additions and 2,151 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
.eunit
test-data/
deps
!deps/.placeholder
_build/
www/
*.o
*.beam
*.plt
*.iml
*.iws
erl_crash.dump
ebin
!ebin/.placeholder
.concrete/DEV_MODE
.rebar
Expand All @@ -22,11 +25,13 @@ eunit.coverdata
test/ct.cover.spec
ct.coverdata
.idea/
_build
.rebar3
rebar3.crashdump
.DS_Store
etc/gen.emqx.conf
compile_commands.json
cuttlefish
xrefr
*.coverdata
etc/emqx.conf.rendered
Expand Down Expand Up @@ -60,3 +65,15 @@ apps/dgiot_esports/
apps/dgiot_http/etc/dgiot_http.conf
node_modules/
package-lock.json
erlang_ls.config
.els_cache/
# VSCode files
.vs/
.vscode/
# Emacs Backup files
*~
# Emacs temporary files
.#*
*#
# For direnv
.envrc
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
erlang 23.2.7.2-emqx-1
erlang 23.2.7.2-emqx-3
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
$(shell $(CURDIR)/scripts/git-hooks-init.sh)
REBAR_VERSION = 3.14.3-emqx-7
REBAR_VERSION = 3.14.3-emqx-8
REBAR = $(CURDIR)/rebar3
BUILD = $(CURDIR)/build
SCRIPTS = $(CURDIR)/scripts
export PKG_VSN ?= $(shell $(CURDIR)/pkg-vsn.sh)
export EMQX_DESC ?= EMQ X
export EMQX_CE_DASHBOARD_VERSION ?= v4.3.8
export EMQX_CE_DASHBOARD_VERSION ?= v4.3.3
ifeq ($(OS),Windows_NT)
export REBAR_COLOR=none
endif
Expand Down Expand Up @@ -93,8 +93,10 @@ $(REL_PROFILES:%=%): $(REBAR) get-dashboard
clean: $(PROFILES:%=clean-%)
$(PROFILES:%=clean-%):
@if [ -d _build/$(@:clean-%=%) ]; then \
rm rebar.lock \
rm -rf _build/$(@:clean-%=%)/rel; \
find _build/$(@:clean-%=%) -name '*.beam' -o -name '*.so' -o -name '*.app' -o -name '*.appup' -o -name '*.o' -o -name '*.d' -type f | xargs rm -f; \
find _build/$(@:clean-%=%) -type l -delete; \
fi

.PHONY: clean-all
Expand All @@ -103,13 +105,15 @@ clean-all:

.PHONY: deps-all
deps-all: $(REBAR) $(PROFILES:%=deps-%)
@make clean # ensure clean at the end

## deps-<profile> is used in CI scripts to download deps and the
## share downloads between CI steps and/or copied into containers
## which may not have the right credentials
.PHONY: $(PROFILES:%=deps-%)
$(PROFILES:%=deps-%): $(REBAR) get-dashboard
@$(REBAR) as $(@:deps-%=%) get-deps
@rm -f rebar.lock

.PHONY: xref
xref: $(REBAR)
Expand Down
12 changes: 0 additions & 12 deletions Platform-service.md

This file was deleted.

15 changes: 11 additions & 4 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/dgiot/dgiot)](https://hub.docker.com/r/dgiot/dgiot)
[![Community](https://img.shields.io/badge/Community-DGIOT-yellow)](https://tech.iotn2n.com)
[![QQ群346566935](https://img.shields.io/badge/QQ群-346566935-brightgreen)](https://jq.qq.com/?_wv=1027&k=LipWZvDe)
[![star](https://gitee.com/dgiiot/dgiot/badge/star.svg?theme=gvp)](https://gitee.com/dgiiot/dgiot/stargazers)
[![dgiot/Gitee Feedback](https://gitee.com/dgiiot/dgiot/widgets/widget_card.svg?colors=colors=ffffff,1e252b,323d47,455059,d7deea,99a0ae)](https://gitee.com/dgiiot/dgiot)

[English](./README.md) | [中文](./README-CN.md) | [日本語](./README-JP.md) | [русский](./README-RU.md)|
[github](https://github.com/dgiot?from=git)|[gitee](https://www.iotn2n.com?from=git)|[官网](https://www.iotn2n.com?from=git)|[博客](https://tech.iotn2n.com?from=git)|[体验](https://prod.iotn2n.com?from=git)|[微信群](#jump)
Expand Down Expand Up @@ -34,9 +36,14 @@ DG-IoT是国内首款轻量级开源工业物联网平台,我们致力于提
|[智慧园区](https://gitee.com/dgiiot/dgiot/wikis/%E8%A1%8C%E4%B8%9A%E6%A1%88%E4%BE%8B/%E6%99%BA%E6%85%A7%E5%9B%AD%E5%8C%BA)|[云云对接](https://gitee.com/dgiiot/dgiot/wikis/%E5%AE%9E%E6%88%98%E6%8E%A5%E5%85%A5/%E4%BA%91%E4%BA%91%E5%AF%B9%E6%8E%A5/%E6%A6%82%E8%BF%B0)|智慧场馆|

## 快速体验与微信群
|<span id="jump">技术支持微信群2群</span>|小程序|公众号|[电脑端](https://prod.iotn2n.com/)|账号|密码|
|---|---|---|---|---|---|
|![image](https://user-images.githubusercontent.com/51999461/147313158-ac48ad72-e799-4d64-81f9-60527c63d271.png)|![](http://dgiot-1253666439.cos.ap-shanghai-fsi.myqcloud.com/dgiot_release/dgiot_wechat.jpg)|![](http://dgiot-1253666439.cos.ap-shanghai-fsi.myqcloud.com/wechat/qrcode.png)|![](http://dgiot-1253666439.cos.ap-shanghai-fsi.myqcloud.com/dgiot_release/dgiot_dashboard.png) |dgiot_admin|dgiot_admin|
<span id="jump">技术支持微信群2群</span>
![image](https://user-images.githubusercontent.com/51999461/147809135-43c1f653-5b9a-4301-afe8-b6504b4df59e.png)

[QQ群346566935](https://jq.qq.com/?_wv=1027&k=LipWZvDe)

点此[电脑端](https://prod.iotn2n.com/)或者输入https://prod.iotn2n.com体验

账号/密码 : dgiot_admin/dgiot_admin

## 系统部署
+ **centos 7.6/7.9** 推荐使用腾讯云和阿里云部署,具体操作[点击这里](https://gitee.com/dgiiot/dgiot/wikis/DG-IoT%E7%89%A9%E8%81%94%E7%BD%91%E6%89%8B%E5%86%8C/%E7%AE%80%E4%BB%8B/%E5%AE%89%E8%A3%85%E9%83%A8%E7%BD%B2)
Expand All @@ -55,7 +62,7 @@ wget -q https://gitee.com/dgiiot/dgiot/raw/master/dgiot_install.sh && sh dgiot_
+ 欢迎dgiot用户多尝试自助服务,多参与社区建设,多提issue,多在qq或者微信上反馈真实的物联网需求,助力提升社区服务品质
+ 欢迎dgiot先来者可以为后来者提供系统部署,插件开发和设备接入等指导服务,一起提供更多优质VIP服务,构建可持续的社区生态
+ dgiot团队在保守用户商业机密的前提下,将持续提炼行业业务需求和物联网平台运维经验,把行业真需求和一线经验沉淀到社区生态中

| | | | |
| -----| ------ |------- |------- |
| 内容 | 服务等级 |服务收费| 服务方式 |
Expand Down
5 changes: 3 additions & 2 deletions README-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
[![Build Status](https://travis-ci.org/dgiot/dgiot.svg)](https://travis-ci.org/dgiot/dgiot)
[![Docker Pulls](https://img.shields.io/docker/pulls/dgiot/dgiot)](https://hub.docker.com/r/dgiot/dgiot)
[![Community](https://img.shields.io/badge/Community-DGIOT-yellow)](https://tech.iotn2n.com)

[![star](https://gitee.com/dgiiot/dgiot/badge/star.svg?theme=gvp)](https://gitee.com/dgiiot/dgiot/stargazers)
[![dgiot/Gitee Feedback](https://gitee.com/dgiiot/dgiot/widgets/widget_card.svg?colors=colors=ffffff,1e252b,323d47,455059,d7deea,99a0ae)](https://gitee.com/dgiiot/dgiot)
[English](./README.md) | [简体中文](./README-CN.md) | [日本語](./README-JP.md) | [русский](./README-RU.md)

*DGIOT* は中国で最初の軽量オープンソース産業用IoT継続的インテグレーションプラットフォームです
*DGIOT* は中国で最初の軽量オープンソース産業用IoT継続的インテグレーションプラットフォームです

2016年以前、Shuwaチームはインターネットとモバイルインターネットを長年にわたってクロールしていました。 2016年には、モノのインターネットのクロールに参入し始めました。 このオープンソースプラットフォームを通じて長年のクロール経験を共有し、学際的な産業用インターネットプロジェクトを容易にすることを望んでいます。
+ 金持ちのエンジニアがウィンドウの相互作用を通じて、より簡単な要件で産業用インターネットプロジェクトを完了できるようにします
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/dgiot/dgiot)](https://hub.docker.com/r/dgiot/dgiot)
[![Community](https://img.shields.io/badge/Community-DGIOT-yellow)](https://tech.iotn2n.com)
[![QQ群346566935](https://img.shields.io/badge/QQ群-346566935-brightgreen)](https://jq.qq.com/?_wv=1027&k=LipWZvDe)

[![star](https://gitee.com/dgiiot/dgiot/badge/star.svg?theme=gvp)](https://gitee.com/dgiiot/dgiot/stargazers)
[![dgiot/Gitee Feedback](https://gitee.com/dgiiot/dgiot/widgets/widget_card.svg?colors=colors=ffffff,1e252b,323d47,455059,d7deea,99a0ae)](https://gitee.com/dgiiot/dgiot)

[English](./README.md) | [简体中文](./README-CN.md) | [日本語](./README-JP.md) | [русский](./README-RU.md)

Expand Down
43 changes: 7 additions & 36 deletions apps/dgiot/conf/rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -36,42 +36,13 @@
{erl_first_files, ["src/emqx_logger.erl", "src/emqx_rule_actions_trans.erl"]}.

{deps,
[
{getopt, {git, "https://gitee.com/fastdgiot/getopt.git", {tag, "v1.0.2"}}}
, {grpc, {git, "https://gitee.com/fastdgiot/grpc-erl", {tag, "0.6.4"}}}
, {grpc_plugin, {git, "https://gitee.com/fastdgiot/grpc_plugin.git", {tag, "v0.10.4"}}}
, {recon, {git, "https://gitee.com/fastdgiot/recon.git", {tag, "2.5.1"}}}
, {rebar3_proper, {git, "https://gitee.com/fastdgiot/rebar3_proper.git", {tag, "0.12.1"}}}
, {gpb, {git, "https://gitee.com/fastdgiot/gpb", {tag, "4.17.6"}}}
, {cuttlefish, {git, "https://gitee.com/fastdgiot/cuttlefish", {tag, "v4.3.4"}}}
, {cowboy, {git, "https://gitee.com/fastdgiot/cowboy", {tag, "2.8.3"}}}
, {minirest, {git, "https://gitee.com/fastdgiot/minirest", {tag, "0.3.5"}}}
, {ecpool, {git, "https://gitee.com/fastdgiot/ecpool", {tag, "0.5.1"}}}
, {replayq, {git, "https://gitee.com/fastdgiot/replayq", {tag, "0.3.2"}}}
, {pbkdf2, {git, "https://gitee.com/fastdgiot/erlang-pbkdf2.git", {branch, "2.0.4"}}}
, {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}
, {rulesql, {git, "https://gitee.com/fastdgiot/rulesql", {tag, "0.1.2"}}}
, {recon, {git, "https://gitee.com/fastdgiot/recon", {tag, "2.5.1"}}}
, {ranch, {git, "https://gitee.com/fastdgiot/ranch", {tag, "1.7.1"}}}
, {gproc, {git, "https://gitee.com/fastdgiot/gproc", {tag, "0.8.0"}}}
, {gen_rpc, {git, "https://gitee.com/fastdgiot/gen_rpc", {tag, "2.5.1"}}}
, {gun, {git, "https://gitee.com/fastdgiot/gun", {tag, "1.3.5"}}}
, {ssl_verify_fun, {git, "https://gitee.com/fastdgiot/ssl_verify_fun.erl.git", {tag, "1.1.4"}}}
, {jiffy, {git, "https://gitee.com/fastdgiot/jiffy", {tag, "1.0.5"}}}
, {esockd, {git, "https://gitee.com/fastdgiot/esockd", {tag, "5.8.0"}}}
, {ekka, {git, "https://gitee.com/fastdgiot/ekka", {tag, "0.8.1"}}}
, {ehttpc, {git, "https://gitee.com/fastdgiot/ehttpc", {tag, "0.1.5"}}}
, {erlydtl, {git, "https://gitee.com/fastdgiot/erlydtl.git", {tag, "0.12.1"}}}
, {erlport, {git, "https://gitee.com/fastdgiot/erlport", {tag, "v1.2.2"}}}
, {poolboy, {git, "https://gitee.com/fastdgiot/poolboy.git", {tag, "1.5.3"}}}
, {websocket_client, {git, "https://gitee.com/fastdgiot/websocket_client", {tag, "v0.7"}}}
, {observer_cli, "1.6.1"} % NOTE: depends on recon 2.5.1
, {ejdbc, {git, "https://gitee.com/fastdgiot/ejdbc", {tag, "1.0.1"}}}
, {snabbkaffe, {git, "https://gitee.com/fastdgiot/snabbkaffe.git", {tag, "0.12.2"}}}
, {cowlib, {git, "https://gitee.com/fastdgiot/cowlib",{tag,"2.8.0"}}}
, {ibrowse, {git, "https://gitee.com/fastdgiot/ibrowse.git", {tag, "v4.4.2"}}}
, {jesse, {git, "https://gitee.com/fastdgiot/jesse.git", {tag, "1.6.1"}}}
, {jwerl, {git, "https://gitee.com/fastdgiot/jwerl.git", {tag, "1.1.1"}}}
[{gun, {git, "https://gitee.com/fastdgiot/gun", {tag, "1.3.5"}}}
, {ssl_verify_fun, {git, "https://gitee.com/fastdgiot/ssl_verify_fun.erl.git", {tag, "1.1.4"}}}
, {erlydtl, {git, "https://gitee.com/fastdgiot/erlydtl.git", {tag, "0.12.1"}}}
, {erlport, {git, "https://gitee.com/fastdgiot/erlport", {tag, "v1.2.2"}}}
, {poolboy, {git, "https://gitee.com/fastdgiot/poolboy.git", {tag, "1.5.3"}}}
, {ibrowse, {git, "https://gitee.com/fastdgiot/ibrowse.git", {tag, "v4.4.2"}}}
, {jwerl, {git, "https://gitee.com/fastdgiot/jwerl.git", {tag, "1.1.1"}}}
]}.

{xref_ignores,
Expand Down
4 changes: 3 additions & 1 deletion apps/dgiot_api/rebar.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{deps, []}.
{deps, [
{jesse, {git, "https://gitee.com/fastdgiot/jesse.git", {tag, "1.6.1"}}}
]}.

{shell, [
% {config, "config/sys.config"},
Expand Down
2 changes: 1 addition & 1 deletion apps/dgiot_api/src/dgiot_api.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{vsn, "4.3.0"},
{registered, []},
{mod, {dgiot_api_app, []}},
{applications,[kernel, stdlib, dgiot, dgiot_parse]},
{applications,[kernel, stdlib, jesse, dgiot, dgiot_parse]},
{env, []},
{modules, []},
{licenses, ["Apache-2.0"]},
Expand Down
1 change: 1 addition & 0 deletions apps/dgiot_device/rebar.config
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{deps, [
{ibrowse, {git, "https://gitee.com/fastdgiot/ibrowse.git", {tag, "v4.4.2"}}}
]}.
28 changes: 22 additions & 6 deletions apps/dgiot_device/src/dgiot_device.erl
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ get_acl(_DeviceId) ->

online(DeviceId) ->
case lookup(DeviceId) of
{ok, {[_, _Now, Acl, DeviceName, Devaddr, ProductId], Node}} ->
dgiot_mnesia:insert(DeviceId, {[true, dgiot_datetime:now_secs(), Acl, DeviceName, Devaddr, ProductId], Node});
{ok, {[Status, _Now, Acl, DeviceName, Devaddr, ProductId], Node}} ->
dgiot_mnesia:insert(DeviceId, {[Status, dgiot_datetime:now_secs() + 72000, Acl, DeviceName, Devaddr, ProductId], Node});
_ -> pass
end.

offline(DeviceId) ->
case lookup(DeviceId) of
{ok, {[_, _Now, Acl, DeviceName, Devaddr, ProductId], Node}} ->
dgiot_mnesia:insert(DeviceId, {[true, _Now - 7200, Acl, DeviceName, Devaddr, ProductId], Node}),
{ok, {[Status, Now, Acl, DeviceName, Devaddr, ProductId], Node}} ->
dgiot_mnesia:insert(DeviceId, {[Status, Now - 72000, Acl, DeviceName, Devaddr, ProductId], Node}),
offline_child(DeviceId);
_ -> pass
end.
Expand All @@ -156,6 +156,22 @@ sync_parse(OffLine) ->
{_, DeviceId, V} = X,
Now = dgiot_datetime:now_secs(),
case V of
{[_, Last, Acl, DeviceName, Devaddr, ProductId], Node} when (Now - Last) < 0 ->
case dgiot_parse:update_object(<<"Device">>, DeviceId, #{<<"status">> => <<"ONLINE">>}) of
{ok, _R} ->
Productname =
case dgiot_parse:get_object(<<"Product">>, ProductId) of
{ok, #{<<"name">> := Productname1}} ->
Productname1;
_ ->
<<"">>
end,
?MLOG(info, #{<<"deviceid">> => DeviceId, <<"devaddr">> => Devaddr, <<"productid">> => ProductId, <<"productname">> => Productname, <<"devicename">> => DeviceName, <<"status">> => <<"上线"/utf8>>}, ['device_statuslog']),
dgiot_mnesia:insert(DeviceId, {[true, Now, Acl, DeviceName, Devaddr, ProductId], Node});
_ ->
pass
end,
timer:sleep(50);
{[true, Last, Acl, DeviceName, Devaddr, ProductId], Node} when (Now - Last) > OffLine ->
case dgiot_parse:update_object(<<"Device">>, DeviceId, #{<<"status">> => <<"OFFLINE">>}) of
{ok, _R} ->
Expand All @@ -168,7 +184,7 @@ sync_parse(OffLine) ->
end,
?MLOG(info, #{<<"deviceid">> => DeviceId, <<"devaddr">> => Devaddr, <<"productid">> => ProductId, <<"productname">> => Productname, <<"devicename">> => DeviceName, <<"status">> => <<"下线"/utf8>>}, ['device_statuslog']),
dgiot_umeng:save_devicestatus(DeviceId, <<"OFFLINE">>),
dgiot_mnesia:insert(DeviceId, {[false, Now, Acl, DeviceName, Devaddr, ProductId], Node});
dgiot_mnesia:insert(DeviceId, {[false, Last, Acl, DeviceName, Devaddr, ProductId], Node});
_ ->
pass
end,
Expand All @@ -184,7 +200,7 @@ sync_parse(OffLine) ->
<<"">>
end,
?MLOG(info, #{<<"deviceid">> => DeviceId, <<"devaddr">> => Devaddr, <<"productid">> => ProductId, <<"productname">> => Productname, <<"devicename">> => DeviceName, <<"status">> => <<"上线"/utf8>>}, ['device_statuslog']),
dgiot_mnesia:insert(DeviceId, {[true, Now, Acl, DeviceName, Devaddr, ProductId], Node});
dgiot_mnesia:insert(DeviceId, {[true, Last, Acl, DeviceName, Devaddr, ProductId], Node});
_ ->
pass
end,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8d26126

Please sign in to comment.