我有Node.js服务,其中我使用mongo-API与Document/Cosmos DB进行通信.我的服务运行正常,并执行所有的crud操作,但1分钟后,一些mongo错误从服务中抛出.
/document-db-service/node_modules/mongodb/lib/utils.js:123
process.nextTick(function() { throw err; });
^
MongoError: pool destroyed
at Pool.write (/document-db-service/node_modules/mongodb-core/lib/connection/pool.js:922:12)
at Cursor._find (/document-db-service/node_modules/mongodb-core/lib/cursor.js:286:22)
at nextFunction (/document-db-service/node_modules/mongodb-core/lib/cursor.js:584:10)
at Cursor.next [as _next] (/document-db-service/node_modules/mongodb-core/lib/cursor.js:692:3)
at fetchDocs (/document-db-service/node_modules/mongodb/lib/cursor.js:856:10)
at toArray (/document-db-service/node_modules/mongodb/lib/cursor.js:883:3)
at Cursor.toArray (/document-db-service/node_modules/mongodb/lib/cursor.js:836:44)
at exports.getDocsOfCollections (/document-db-service/services/collections.js:273:10)
at Layer.handle [as handle_request] (/document-db-service/node_modules/express/lib/router/layer.js:95:5)
at next (/document-db-service/node_modules/express/lib/router/route.js:137:13)
Run Code Online (Sandbox Code Playgroud)
我无法理解为什么会出现此错误.请建议需要进行的更改以解决此错误.
我想卷曲一个URL并将响应捕获到一个变量中.
当我卷曲命令并回显其输出时,我得到正确的响应,如下所示
sh 'output=`curl https://some-host/some-service/getApi?apikey=someKey`;echo $output;'
Run Code Online (Sandbox Code Playgroud)
我想在变量中捕获相同的响应,并使用该响应进行进一步操作
下面是我的Jenkins文件
pipeline {
agent {
label "build_2"
}
stages {
stage('Build') {
steps {
checkout scm
sh 'npm install'
}
}
stage('Build-Image') {
steps {
echo '..........................Building Image..........................'
//In below line I am getting Output
//sh 'output=`curl https://some-host/some-service/getApi?apikey=someKey`;echo $output;'
script {
//I want to get the same response here
def response = sh 'curl https://some-host/some-service/getApi?apikey=someKey'
echo '=========================Response===================' + response
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
你能告诉我在Jenkinsfile中需要做些什么改变吗?
我正在尝试做的是:
以下是我的代码:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
LOG.info("#### Starting TokenValidateInterceptor.preHandle ####");
LOG.info("apikeyAttribute-->" + request.getAttribute("apiKey"); //coming as a blank
LOG.info("apikeyHeader-->" + request.getHeader("apiKey"));//coming as a blank
if (StringUtils.isBlank(apiKey)) {
if (!request.getRequestURI().endsWith("/")) {
try {
response.sendError(401, ("Unauthorized: Access is denied due to invalid credentials."));
} catch (IOException e) {
LOG.error("##### IOException occured at TokenValidateInterceptor.preHandle() #####", e);
} catch (Exception e) {
LOG.error("##### Generic Exception occured at TokenValidateInterceptor.preHandle() #####,e");
}
//This block is getting executed but still …Run Code Online (Sandbox Code Playgroud) 我正在尝试从 Azure AD 获取访问令牌。为此,我执行了以下步骤
1) 在Azure Active Directory上创建企业应用程序
2)我可以使用授权获取访问令牌 --->>“获取新的访问令牌”
https://login.microsoftonline.com/<Application ID>/oauth2/token3) 点击URL的“POST”请求
已在下面配置 POST 正文
ClientID 是第一步创建的应用程序的 ApplicationID
代码也是第一步创建的应用程序的 ApplicationID
不确定我是否配置正确
4)当我尝试发送请求时使用相同的访问代码,我收到以下错误响应
`{
"error": "invalid_grant",
"error_description": "AADSTS9002313: Invalid request. Request is malformed or invalid.\r\nTrace ID: 60b8fb68-40d5-43da-9b7b-36de021c2900\r\nCorrelation ID: 90ed2f2c-1ac8-4044-8742-493a3fce51be\r\nTimestamp: 2019-07-03 12:42:32Z",
"error_codes": [
9002313
],
"timestamp": "2019-07-03 12:42:32Z",
"trace_id": "60b8fb68-40d5-43da-9b7b-36de021c2900",
"correlation_id": "90ed2f2c-1ac8-4044-8742-493a3fce51be"
}
Run Code Online (Sandbox Code Playgroud)
请让我知道我哪里错了或者需要改变什么。
我正在使用Docker(版本 18.05.0-ce)来构建和部署节点服务。
我没有在我的服务中的任何地方指定 OpenSSL。
不确定 OpenSSL 如何安装在 docker 容器中。
OpenSSL 的当前版本是1.0.1t。我想把它改成1.1.1u
我需要在 Dockerfile 中进行哪些更改?
下面是我正在使用的 Dockerfile。
FROM node
ARG ENVIRONMENT
ARG PORT
ENV PORT $PORT
ENV ENVIRONMENT $ENVIRONMENT
RUN apt-get update && apt-get install -my wget gnupg
RUN mkdir /deamon_service
ADD . /deamon_service
WORKDIR /deamon_service
RUN npm cache verify
RUN npm install
EXPOSE $PORT
ENTRYPOINT [ "node", "server.js" ]
CMD [ $PORT, $ENVIRONMENT ]
Run Code Online (Sandbox Code Playgroud)
任何帮助都将非常重要
我已经配置了Winrm。
winrm quickconfig由于winrm服务已在运行,因此我在响应以下。
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.
Run Code Online (Sandbox Code Playgroud)
另外,如果我愿意 New-PSSession -ComputerName DESKTOP-0DNHIDE
我的输出低于
Id Name ComputerName ComputerType State ConfigurationName Availability
-- ---- ------------ ------------ ----- ----------------- ------------
5 WinRM5 DESKTOP-0DNHIDE RemoteMachine Opened Microsoft.PowerShell Available
Run Code Online (Sandbox Code Playgroud)
我也可以使用以下方法建立PSConnection
`Enter-PSSession -Computername DESKTOP-0DNHIDE`
Run Code Online (Sandbox Code Playgroud)
但是仍然当我尝试使用Azure Devops Pipeline部署CSharp应用程序时出现以下错误
[error]Microsoft.PowerShell.Commands.WriteErrorException: Deployment on one or more machines failed. System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server xx.xx.xx.xx failed with the following error message : The …Run Code Online (Sandbox Code Playgroud) powershell remote-access winrm azure-devops azure-devops-extensions
我使用 NGINX 作为反向代理。
我有 3 个环境(开发、QA、生产)
考虑一下,develop的 IP 地址是 1.2.3.4,qa 是 4.3.2.1,production 是 3.4.1.2
我已经按如下方式配置了 nginx.conf 文件,并且在开发环境的情况下它可以正常工作。
在构建这些 docker-image 时,我已经明确提到应该构建图像的配置如下
cd conf/clustered-develop/;sudo docker build -t jcibts-swmdtr-dev.jci.com/nginx:1 --build-arg PORT=8765 --build-arg ENVIRONMENT=clustered-develop .
Run Code Online (Sandbox Code Playgroud)
要求是 docker-image 应该只构建 1,然后它将被推送到 Docker Trusted 存储库。
它将被提升到其他环境的 docker 可信存储库,而无需再次构建镜像。
我的问题是我能做些什么来为所有环境工作这些单一的 conf。
就像 ip 替换为 localhost 或 ip 替换为 127.0.0.1 (我都试过但没有工作)
worker_processes 4;
events { worker_connections 1024; }
http {
sendfile on;
upstream consumer-portal {
server 1.2.3.4:9006;
}
upstream licenseportal {
server 1.2.3.4:9006; …Run Code Online (Sandbox Code Playgroud) 我想将 NGINX 配置为作为其他微服务的反向代理。
我能够将请求从 NGINX 转发到其中一个微服务
如果我curl http://xx.xx.xx.xx:8080/打电话确实登陆了消费者门户但它使用默认位置配置/
当我评论1st块并配置相同的code位置/consumer-portal并执行操作时curl http://xx.xx.xx.xx:8080/consumer-portal
我得到:
无法获取/消费者门户
我有超过 10 个微服务,我想使用 NGINX 调用它们。
下面是我的nginx.conf文件
worker_processes 4;
events {
worker_connections 1024;
}
http {
sendfile on;
upstream consumer-portal {
server xx.xx.xx.xx:9006;
}
upstream publisher-portal {
server xx.xx.xx.xx:9001;
}
server {
listen 8080;
#1st Block
#location / {
# proxy_pass http://consumer-portal;
# proxy_redirect off;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header …Run Code Online (Sandbox Code Playgroud) nginx docker docker-machine nginx-location nginx-reverse-proxy
docker ×3
nginx ×2
azure ×1
azure-devops ×1
dockerfile ×1
groovy ×1
groovyshell ×1
interceptor ×1
java ×1
jenkins ×1
mongodb ×1
nginx-config ×1
node.js ×1
npm ×1
oauth-2.0 ×1
openssl ×1
powershell ×1
spring-boot ×1
winrm ×1