- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试为我的 Postgres 构建一个 docker-compose 文件,它使用 sequelize 作为 ORM ( https://sequelize.org/ )。这是我的 docker-compose.yml
version: "2"
services:
web:
build:
context : .
dockerfile: Dockerfile
image : testorganization
ports:
- "5000:5000"
links:
- db
db:
image: postgres
expose:
- 5432
volumes:
- ./data/db:/data/db
environment:
POSTGRES_HOST: db
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASS: admin
FROM node:8-alpine
LABEL description="Docker file for organizations app"
RUN mkdir -p /var/www/logs/
RUN mkdir -p /logs/
RUN mkdir -p /usr/src/
WORKDIR /usr/src/
ADD package.json /usr/src/package.json
RUN npm install --production
COPY . .
CMD ["node", "index.js"]
this.sequelize = new Sequelize( 'postgres','postgres','admin',{'host':'db', 'dialect': 'postgres',"define": { "createdAt": "createdat","updatedAt": "updatedat"}, 'operatorAliases': operatorsAliases} );
web_1 | Unhandled rejection SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:5432
web_1 | at connection.connect.err (/usr/src/node_modules/sequelize/lib/dialects/postgres/connectionmanager.js:170:24)
web_1 | at Connection.connectingErrorHandler (/usr/src/node_modules/pg/lib/client.js:191:14)
web_1 | at emitOne (events.js:116:13)
web_1 | at Connection.emit (events.js:211:7)
web_1 | at Socket.reportStreamError (/usr/src/node_modules/pg/lib/connection.js:72:10)
web_1 | at emitOne (events.js:116:13)
web_1 | at Socket.emit (events.js:211:7)
web_1 | at emitErrorNT (internal/streams/destroy.js:66:8)
web_1 | at _combinedTickCallback (internal/process/next_tick.js:139:11)
web_1 | at process._tickCallback (internal/process/next_tick.js:181:9)
db
,与 docker-compose 文件 最佳答案
index.js
const Sequelize = require('sequelize');
const sequelize = new Sequelize("postgres", "postgres", "admin", {
host: "db",
dialect: "postgres",
pool: {
max: 9,
min: 0,
idle: 10000
}
});
sequelize.authenticate().then(() => {
console.log("Success!");
}).catch((err) => {
console.log(err);
});
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"sequelize": "",
"pg": ""
}
}
version: "3.2"
services:
web:
build:
context : .
dockerfile: Dockerfile
networks:
- examplenetwork
ports:
- "5000:5000"
depends_on:
- db
db:
image: postgres
networks:
- examplenetwork
volumes:
- postgresql:/var/lib/postgresql
- postgresql_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASS=admin
networks:
examplenetwork:
volumes:
postgresql:
postgresql_data:
关于node.js - 未处理的拒绝 SequelizeConnectionRefusedError : connect ECONNREFUSED 127. 0.0.1:5432 with dockers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58898478/
嘿,我正在尝试在我的 REST 服务器上有一个/create 函数。我在 C9.io 工作 var express = require("express") var bodyParser = requ
我运行我的 server.js 文件,但出现此错误: Unhandled rejection SequelizeConnectionRefusedError: connect ECONNREFUSED
每当我启动我的应用程序时,我的部分任务就是首先运行迁移。但是,我在 95% 的情况下都会遇到以下错误。 Command failed: /bin/sh -c node_modules/.bin/seq
我正在使用以下配置运行 docker web: image: ca9a385372b0 volumes: - .:/src ports: - "8000:8000" c
当由于某种原因(例如数据库负载过重)数据库拒绝连接时,我的整个 Node 应用程序因“未处理的 promise 拒绝”SequelizeConnectionRefusedError 崩溃。 我想找到一
我使用 Sequelize 作为我的 Node js 应用程序和 Mysql 数据库的 ORM,在遵循一些教程之后,我添加了此代码以将 mysql 连接到 Node ,但是在录制 npm start
我将 Sequelize ORM 与 PostgreSQL 方言一起使用,该方言托管在 localhost 上运行的 docker 容器中。应用程序通过端口 3050 运行,数据库通过端口 5432
Unhandled rejection SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306 at Prom
我正在尝试使用 docker 容器启动并运行我的 nodejs 应用程序。我不知道可能有什么问题。当我使用控制台调试凭据时,凭据似乎已正确传递。同时启动 sequel pro 并使用相同的用户名和密码
我正在尝试为我的 Postgres 构建一个 docker-compose 文件,它使用 sequelize 作为 ORM ( https://sequelize.org/ )。这是我的 docker
我是一名优秀的程序员,十分优秀!