10 2021 档案
摘要:Node.js给我们提供了cluster模块,它可以生成多个工作线程来共享同一个TCP连接 instances:2 代表工作线程数量为2 如果给定的数字为0,PM2则会根据你CPU核心的数量来生成对应的工作线程。 module.exports = { apps: [ { name: 'my-nuxt
阅读全文
摘要:nginx.conf: #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/n
阅读全文
摘要:调接口 读json文件 修改json文件 nodemon或pm2监控到文件变化,自动重启 const restart = async (req, res) => { //spawn.sync(`runChild6.bat`, [], { stdio: 'inherit' })\ const rest
阅读全文
摘要:import os from 'os' const port = 81 const hostname = os.hostname() const host = { 'LAPTOP-4KDIA4A3': 'http://localhost', iZ6ilh61jzkvrhZ: 'http://39.9
阅读全文
摘要:const arr = [] for (let i = 0; i < 10000; i++) { const tempStr = Math.random().toString(36).substr(2, 6) arr.push(tempStr) } //es6提供的new Set也可以去重 let
阅读全文
摘要:81端口和84端口部署了两套node服务,接口相同 如果对81端口的请求加上特定的字符,则把请求转发到84上 app.js: const express = require('express') const bodyParser = require('body-parser') const cors
阅读全文
摘要:备份这三个文件 需要恢复时把这三个文件拷贝回来,再重新读取一下:
阅读全文
摘要:mklink /j "C:\temp" "D:\temp" 建立完成后 修改D盘temp文件夹里的内容,C盘temp文件夹里的内容会同步修改 修改C盘temp文件夹里的内容,D盘temp文件夹里的内容也会同步修改
阅读全文
摘要:通过正则表达式匹配项目:
阅读全文
摘要://jenkins部署时自动调run接口执行批处理,pm2起项目 const run = async (req, res) => { const { branch } = req.body console.log(branch) spawn.sync('yarn -v', [], { stdio:
阅读全文
摘要:run.js: const spawn = require('cross-spawn'); spawn.sync('yarn -v', [], { stdio: 'inherit' }) spawn.sync('run.bat origin/master', [], { stdio: 'inheri
阅读全文
摘要:使用/H指令 xcopy \Jenkins\workspace\m-node-edu \temp\test\ /Y /E /H /exclude:exclude.txt
阅读全文
摘要:xcopy \Jenkins\workspace\test \temp\test\ /Y /E /exclude:exclude.txt exclude.txt: node_modules
阅读全文
摘要:open.js: const simpleGit = require('simple-git') const git = simpleGit('D:/source/edu-node-github'); const init = async () => { const status = await g
阅读全文
摘要:tasklist | findstr nginx taskkill -PID 55232 -F taskkill -PID 59924 -F
阅读全文
摘要:net stop nginx net start nginx
阅读全文
摘要:安装 choco Chocolatey Software | Installing Chocolatey 以管理员身份运行Windows Power Shell 执行下面的命令: Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Ne
阅读全文
摘要:const net = require('net') const portUsed = (port) => { return new Promise((resolve, reject) => { let server = net.createServer().listen(port) server.
阅读全文
摘要:nginx.conf: #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/n
阅读全文
摘要:可视化管理前端项目测试环境,多分支,多测试环境: jenkins自动化部署: 分支选择: http://39.97.238.175:81/
阅读全文
摘要:ChrootDirectory C:\Jenkins\workspace
阅读全文
摘要:下载链接: http://www.ucbug.com/soft/23489.html
阅读全文
摘要:
阅读全文
摘要:sshd_config: 确保以下3条没有被注释 PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys PasswordAuthentication no (需要将默认的yes改为no,很重要) 确保以下2条有注释掉 #Ma
阅读全文
摘要:下载软件(OpenSSH-Win64.zip):Releases · PowerShell/Win32-OpenSSH · GitHub 解压后,在install-sshd.ps1文件上点击右键,使用PowerSheel运行: 或者执行下面的命令来安装sshd服务 powershell.exe -E
阅读全文
摘要:utils/tools.js: const log4js = require('log4js') //日志初始化 const initLog = (app) => { log4js.configure({ appenders: { out: { type: 'console' }, cheese:
阅读全文
摘要:app.js: const express = require('express') const bodyParser = require('body-parser') const cors = require('cors') const history = require('connect-his
阅读全文
摘要:app.js: const express = require('express') const bodyParser = require('body-parser') const cors = require('cors') const history = require('connect-his
阅读全文
摘要:ecosystem.config.js: module.exports = { apps: [ { name: 'app', script: './app.js', watch: true, ignore_watch: ['node_modules'], node_args: ['--inspect
阅读全文