-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(iotmqtt.js): fix the problem that mqtt cannot send number data
- Loading branch information
Showing
11 changed files
with
268 additions
and
5 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,21 @@ | ||
# This config is equivalent to both the '.circleci/extended/orb-free.yml' and the base '.circleci/config.yml' | ||
version: 2.1 | ||
|
||
# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects. | ||
# See: https://circleci.com/docs/2.0/orb-intro/ | ||
orbs: | ||
node: circleci/node@4.7.0 | ||
|
||
# Invoke jobs via workflows | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows | ||
workflows: | ||
sample: # This is the name of the workflow, feel free to change it to better match your workflow. | ||
# Inside the workflow, you define the jobs you want to run. | ||
jobs: | ||
- node/test: | ||
# This is the node version to use for the `cimg/node` tag | ||
# Relevant tags can be found on the CircleCI Developer Hub | ||
# https://circleci.com/developer/images/image/cimg/node | ||
version: '16.10' | ||
# If you are using yarn, change the line below from "npm" to "yarn" | ||
pkg-manager: yarn |
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,117 @@ | ||
# 跳过构建在Commit Message中添加 [CI SKIP] | ||
kind: pipeline | ||
name: 打包部署[NodeJs-Npm] | ||
|
||
clone: | ||
disable: true | ||
|
||
steps: | ||
- name: 下载源代码[Git] | ||
image: docker:git | ||
commands: | ||
- echo "### $DRONE_GIT_HTTP_URL -> $DRONE_BRANCH" | ||
- git clone http://172.18.1.1:13000/lizw/dgiot_amis.git ./ | ||
- git checkout master | ||
# - git clone $DRONE_GIT_HTTP_URL ./ | ||
# - git checkout $DRONE_BRANCH | ||
|
||
- name: 编译源代码[Npm] docker | ||
image: node:12.22.6-alpine3.12 | ||
volumes: | ||
- name: package-nodejs | ||
path: /package-nodejs | ||
commands: | ||
- npm config set unsafe-perm true | ||
- npm config set cache "/package-nodejs/npm-cache" | ||
- npm config set prefix "/package-nodejs/npm" | ||
- npm config set registry https://registry.npm.taobao.org --global | ||
- npm config set disturl https://npm.taobao.org/dist --global | ||
#- npm install --prefer-offline | ||
#- npm run build | ||
- cd server | ||
- npm install --prefer-offline | ||
- cd ../ | ||
|
||
- name: 构建镜像[Docker] | ||
image: plugins/docker | ||
volumes: | ||
- name: docker-daemon | ||
path: /etc/docker | ||
settings: | ||
username: | ||
from_secret: harbor_username | ||
password: | ||
from_secret: harbor_password | ||
registry: '172.18.1.1:15000' | ||
repo: '172.18.1.1:15000/node-service/dgiot_amis' | ||
insecure: true | ||
debug: true | ||
dockerfile: ./Dockerfile | ||
target: dev | ||
tags: ['0.0.1-SNAPSHOT'] | ||
force_tag: true | ||
auto_tag: false | ||
auto_tag_suffix: '' | ||
|
||
- name: 启动容器[SSH-Docker] | ||
image: appleboy/drone-ssh | ||
settings: | ||
host: 172.18.1.1 | ||
port: 22 | ||
username: | ||
from_secret: sshUsername | ||
password: | ||
from_secret: sshPassword | ||
command_timeout: 300s | ||
script: | ||
- echo "------------------< 停止容器 >------------------" | ||
- docker stop dgiot_amis | ||
- echo "------------------< 删除容器 >------------------" | ||
- docker rm -v dgiot_amis | ||
- echo "------------------< 删除旧镜像 >------------------" | ||
- docker rmi 172.18.1.1:15000/node-service/dgiot_amis:0.0.1-SNAPSHOT | ||
- echo "------------------< 拉取新镜像 >------------------" | ||
- docker pull 172.18.1.1:15000/node-service/dgiot_amis:0.0.1-SNAPSHOT | ||
- echo "------------------< 运行新镜像 >------------------" | ||
- docker run --name dgiot_amis -d -p 19081:9066 172.18.1.1:15000/node-service/dgiot_amis:0.0.1-SNAPSHOT | ||
- exit | ||
|
||
- name: 发送通知[Email] | ||
image: drillster/drone-email | ||
# detach: true | ||
commands: | ||
- date | ||
- cd /etc | ||
- cp /share/localtime ./ | ||
- date | ||
- cd /bin | ||
- ./drone-email | ||
volumes: | ||
- name: share | ||
path: /share | ||
settings: | ||
host: smtp.qq.com | ||
port: 465 | ||
username: | ||
from_secret: emailUsername | ||
password: | ||
from_secret: emailPassword | ||
skip_verify: false | ||
from: | ||
from_secret: emailUsername | ||
recipients: [ 'lzw1000000@163.com' ] | ||
recipients_only: false | ||
subject: '[#{{build.number}}-{{build.status}}] {{repo.name}}' | ||
body: 'file:///drone/src/drone-email.html' | ||
|
||
volumes: | ||
# 共享文件 | ||
- name: share | ||
host: | ||
path: /home/lizw/Desktop/docker-opt/share | ||
# nodejs打包目录 | ||
- name: package-nodejs | ||
host: | ||
path: /home/lizw/Desktop/docker-opt/package/nodejs | ||
|
||
# ------------------------------------------------------------------------------------------------------------- |
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,7 @@ | ||
pull_request_rules: | ||
- name: Automatic merge on approval | ||
conditions: | ||
- "#approved-reviews-by>=1" | ||
actions: | ||
merge: | ||
method: merge |
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,76 @@ | ||
pipeline { | ||
agent any | ||
|
||
environment { | ||
Ali_OSS_KEY = credentials('Ali_OSS_KEY') | ||
Ali_OSS_SECRET = credentials('Ali_OSS_SECRET') | ||
} | ||
|
||
// tools { | ||
// git "Git2.x" | ||
// } | ||
|
||
options { | ||
// 保留最近历史构建记录的数量 | ||
buildDiscarder(logRotator(numToKeepStr: '8')) | ||
// 不允许同时执行 pipeline | ||
disableConcurrentBuilds() | ||
// 跳过默认的git Checkout | ||
skipDefaultCheckout() | ||
// 设置 pipeline 运行的超时时间 | ||
timeout(time: 8, unit: 'MINUTES') | ||
// 在失败时, 重新尝试整个 pipeline 的指定次数 | ||
// retry(3) | ||
// 控制台输出时间 | ||
timestamps() | ||
} | ||
|
||
triggers { | ||
// Jenkins 会检查新的源代码更新。如果存在更改, pipeline 就会被重新触发 | ||
pollSCM('H/5 * * * *') | ||
} | ||
|
||
// parameters {} | ||
|
||
stages { | ||
stage('Clone代码') { | ||
steps { | ||
checkout scm | ||
} | ||
} | ||
|
||
stage('编译dgiot_amis') { | ||
steps { | ||
sh 'yarn install --prefer-offline' | ||
// sh 'yarn cross-env TS_NODE_PROJECT="./build/webpack.tsconfig.json" ENABLE_CDN=true OSS_KEY="$Ali_OSS_KEY" OSS_SECRET="$Ali_OSS_SECRET" NODE_ENV=production webpack --config build/webpack.conf.ts' | ||
} | ||
} | ||
|
||
stage('编译server模块') { | ||
steps { | ||
dir('./server') { | ||
sh 'yarn install --prefer-offline' | ||
} | ||
} | ||
} | ||
|
||
stage('部署') { | ||
steps { | ||
withCredentials([sshUserPrivateKey(credentialsId: 'MSVC_SSH_SECRET', keyFileVariable: 'id_rsa')]) { | ||
sh 'ssh -i $id_rsa lizw@ssh.msvc.top -p 28822 "echo 远程执行"' | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
always { | ||
echo '项目构建完成' | ||
emailext subject: "[Jenkins] ${currentBuild.fullDisplayName}", | ||
body: '${DEFAULT_CONTENT}', | ||
mimeType: 'text/html', | ||
replyTo: '1183409807@qq.com', | ||
to: 'lzw1000000@163.com,mlrsyz@vip.qq.com' | ||
} | ||
} | ||
} |
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,15 @@ | ||
#This is an example webapp.io configuration for NodeJS | ||
FROM vm/ubuntu:18.04 | ||
# To note: Layerfiles create VMs, *not* containers! | ||
|
||
# Install node | ||
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash && \ | ||
apt install nodejs && \ | ||
rm -f /etc/apt/sources.list.d/nodesource.list | ||
RUN npm install -g http-server | ||
|
||
COPY . . | ||
RUN echo 'hello' > hello.html | ||
|
||
RUN BACKGROUND http-server -p 8000 | ||
EXPOSE WEBSITE http://localhost:8000 |
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,21 @@ | ||
# Node.js | ||
# Build a general Node.js project with npm. | ||
# Add steps that analyze code, save build artifacts, deploy, and more: | ||
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript | ||
|
||
trigger: | ||
- master | ||
|
||
pool: | ||
vmImage: ubuntu-latest | ||
|
||
steps: | ||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: '10.x' | ||
displayName: 'Install Node.js' | ||
|
||
- script: | | ||
npm install | ||
npm run build | ||
displayName: 'npm install and build' |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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,5 @@ | ||
{ | ||
"extends": [ | ||
"config:base" | ||
] | ||
} |
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