hello everyone
i have nestJS application with docker-compose file
i try to deploy this application on Render
but Deploy console give me this
Feb 19 10:58:46 PM [Nest] 1 - 02/19/2023, 7:58:46 PM LOG [NestFactory] Starting Nest application...
Feb 19 10:58:47 PM [Nest] 1 - 02/19/2023, 7:58:47 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +1296ms
Feb 19 10:58:47 PM [Nest] 1 - 02/19/2023, 7:58:47 PM LOG [InstanceLoader] TelegrafModule dependencies initialized +1ms
Feb 19 10:58:47 PM [Nest] 1 - 02/19/2023, 7:58:47 PM LOG [InstanceLoader] CacheModule dependencies initialized +1ms
Feb 19 10:58:47 PM [Nest] 1 - 02/19/2023, 7:58:47 PM LOG [InstanceLoader] DiscoveryModule dependencies initialized +1ms
Feb 19 10:58:47 PM [Nest] 1 - 02/19/2023, 7:58:47 PM LOG [InstanceLoader] ConfigHostModule dependencies initialized +0ms
Feb 19 10:58:47 PM [Nest] 1 - 02/19/2023, 7:58:47 PM LOG [InstanceLoader] AppModule dependencies initialized +91ms
Feb 19 10:58:47 PM [Nest] 1 - 02/19/2023, 7:58:47 PM LOG [InstanceLoader] TelegrafCoreModule dependencies initialized +4ms
Feb 19 10:58:47 PM [Nest] 1 - 02/19/2023, 7:58:47 PM LOG [InstanceLoader] ConfigModule dependencies initialized +1ms
Feb 19 10:58:47 PM [Nest] 1 - 02/19/2023, 7:58:47 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Feb 19 10:58:47 PM Error: getaddrinfo ENOTFOUND db-vlad-tg
Feb 19 10:58:47 PM at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
Feb 19 10:58:47 PM node:events:491
Feb 19 10:58:47 PM throw er; // Unhandled 'error' event
Feb 19 10:58:47 PM ^
Feb 19 10:58:47 PM
Feb 19 10:58:47 PM Error: getaddrinfo ENOTFOUND redis-vlad-tg
Feb 19 10:58:47 PM at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
Feb 19 10:58:47 PM Emitted 'error' event on RedisClient instance at:
Feb 19 10:58:47 PM at RedisClient.on_error (/app/node_modules/redis/index.js:342:14)
Feb 19 10:58:47 PM at Socket.<anonymous> (/app/node_modules/redis/index.js:223:14)
Feb 19 10:58:47 PM at Socket.emit (node:events:513:28)
Feb 19 10:58:47 PM at Socket.emit (node:domain:489:12)
Feb 19 10:58:47 PM at emitErrorNT (node:internal/streams/destroy:157:8)
Feb 19 10:58:47 PM at emitErrorCloseNT (node:internal/streams/destroy:122:3)
Feb 19 10:58:47 PM at processTicksAndRejections (node:internal/process/task_queues:83:21) {
Feb 19 10:58:47 PM errno: -3008,
Feb 19 10:58:47 PM code: 'ENOTFOUND',
Feb 19 10:58:47 PM syscall: 'getaddrinfo',
Feb 19 10:58:47 PM hostname: 'redis-vlad-tg'
Feb 19 10:58:47 PM }
my docker compose file :
version: '3.8'
services:
app:
build:
dockerfile: Dockerfile
context: .
environment:
- TZ=Europe/Moscow
env_file:
- .env
volumes:
- ./:/app
- /app/node_modules
depends_on:
- redis-vlad-tg
- db-vlad-tg
ports:
- "3000:3000"
command: npm run start
restart: always
db-vlad-tg:
container_name: tg-vlad-db
image: postgres:14-alpine
restart: always
environment:
- POSTGRES_USER=${TYPEORM_USERNAME}
- POSTGRES_PASSWORD=${TYPEORM_PASSWORD}
- POSTGRES_DB=${TYPEORM_DB}
- TZ=Europe/Moscow
volumes:
- ./pgdata:/var/lib/postgresql/data
ports:
- ${TYPEORM_PORT}:${TYPEORM_PORT}
redis-vlad-tg:
image: redis:latest
volumes:
- ./redis:/data
ports:
- 6379:6379
config in my app.module file :
TypeOrmModule.forRoot({
type: 'postgres',
host: 'db-vlad-tg',
port: parseInt(process.env.TYPEORM_PORT),
username: process.env.TYPEORM_USERNAME,
password: process.env.TYPEORM_PASSWORD,
database: process.env.TYPEORM_DB,
synchronize: false,
logging: true,
migrationsTableName: 'migrations',
namingStrategy: new SnakeNamingStrategy(),
entities: [`${__dirname}/../**/*.entity{.js,.ts}`],
migrations: ['dist/**/migrations/*.js'],
}),
CacheModule.register({
store: redisStore,
host: 'redis-vlad-tg',
port: parseInt(process.env.REDIS_PORT),
ttl: 3600,
isGlobal: true,
}),
If i started local this docker-compose file all works good but in Render i have problems…