-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* HTTP interfaces for operations * update dependency Co-authored-by: xufangyou <[email protected]>
- Loading branch information
Showing
41 changed files
with
22,029 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Dockerfile* | ||
.dockerignore | ||
docker-compose* | ||
.env | ||
|
||
.git | ||
.gitignore | ||
|
||
go.sum | ||
|
||
.vscode | ||
.idea/ | ||
|
||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,8 @@ go.sum | |
.idea | ||
|
||
# TLS Certificates | ||
etc/security | ||
etc/security | ||
etc/resources | ||
etc/config.yaml | ||
|
||
VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM golang:1.16-alpine3.15 AS builder | ||
|
||
ARG ALPINE_PKG_BASE="make git" | ||
ARG ALPINE_PKG_EXTRA="" | ||
|
||
RUN sed -e 's/dl-cdn[.]alpinelinux.org/nl.alpinelinux.org/g' -i~ /etc/apk/repositories | ||
RUN apk add --update --no-cache ${ALPINE_PKG_BASE} ${ALPINE_PKG_EXTRA} | ||
|
||
WORKDIR /edge | ||
|
||
COPY . . | ||
|
||
RUN make update || echo "skipping" | ||
RUN make build | ||
|
||
FROM alpine:3.15 | ||
|
||
WORKDIR /edge | ||
|
||
COPY --from=builder /edge/edge-device-manager ./edge-device-manager | ||
COPY --from=builder /edge/bin ./bin | ||
COPY --from=builder /edge/etc ./etc | ||
COPY --from=builder /edge/public ./public | ||
|
||
RUN ./bin/boot.sh | ||
|
||
EXPOSE 10996 | ||
|
||
CMD ["./edge-device-manager", "-cp", "etc", "-cn", "config"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
APP=edge-device-manager | ||
PKG=github.com/thingio/${APP} | ||
|
||
VERSION=$(shell cat ./VERSION 2>/dev/null || echo 0.0.0) | ||
GIT_SHA=$(shell git rev-parse HEAD) | ||
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) | ||
|
||
GOMODULE=GO111MODULE=on GOPROXY=https://goproxy.cn,https://goproxy.io/,https://mirrors.aliyun.com/goproxy,direct | ||
GO=CGO_ENABLED=0 $(GOMODULE) go | ||
CGO=CGO_ENABLED=1 $(GOMODULE) go | ||
GOFLAGS=-ldflags "-X $(PKG)/version.Version=$(VERSION)" | ||
|
||
.PHONY: update build | ||
update: | ||
$(GO) mod download all | ||
build: | ||
$(GO) build $(GOFLAGS) -o $(APP) ./main.go | ||
|
||
.PHONY: dockerfile | ||
dockerfile: | ||
docker build -f Dockerfile . \ | ||
-t $(APP):$(GIT_SHA) \ | ||
-t $(APP):$(GIT_BRANCH) \ | ||
-t $(APP):$(VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# generate config.yaml from config.yaml.template | ||
cp -f ./etc/config.yaml.template ./etc/config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
common: | ||
driver_health_check_interval_second: 5 | ||
device_health_check_interval_second: 5 | ||
manager: | ||
http: | ||
port: 10996 | ||
|
||
msgbus: | ||
type: "MQTT" | ||
mqtt: | ||
host: 127.0.0.1 | ||
port: 8883 | ||
port: 1883 | ||
username: admin | ||
password: 123456 | ||
connect_timout_millisecond: 30000 | ||
token_timeout_millisecond: 1000 | ||
qos: 2 | ||
clean_session: false | ||
method_call_timeout_millisecond: 1000 | ||
with_tls: true | ||
with_tls: false | ||
ca_path: etc/security/ca.crt | ||
cert_path: etc/security/client.crt | ||
key_path: etc/security/client.key | ||
key_path: etc/security/client.key | ||
|
||
log: | ||
level: info | ||
console: true |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package http | ||
|
||
import ( | ||
"github.com/emicklei/go-restful/v3" | ||
"github.com/patrickmn/go-cache" | ||
"github.com/thingio/edge-device-manager/pkg/api/http/device" | ||
"github.com/thingio/edge-device-manager/pkg/api/http/product" | ||
"github.com/thingio/edge-device-manager/pkg/api/http/protocol" | ||
"github.com/thingio/edge-device-manager/pkg/api/http/swagger" | ||
"github.com/thingio/edge-device-manager/pkg/metastore" | ||
"github.com/thingio/edge-device-std/operations" | ||
) | ||
|
||
const ( | ||
ApiRoot = "/api/v1" | ||
) | ||
|
||
func MountAllModules(protocols *cache.Cache, metaStore metastore.MetaStore, | ||
mc operations.ManagerClient, ms operations.ManagerService) { | ||
restful.Add(swagger.Resource{}.WebService("/apidocs")) | ||
|
||
restful.Add(protocol.Resource{ProtocolCache: protocols}.WebService(ApiRoot + "/protocols")) | ||
restful.Add(product.Resource{ProtocolCache: protocols, MetaStore: metaStore, OperationClient: mc}.WebService(ApiRoot + "/products")) | ||
restful.Add(device.Resource{MetaStore: metaStore, OperationClient: mc, OperationService: ms}.WebService(ApiRoot + "/devices")) | ||
} |
Oops, something went wrong.