When using the app with the Docker compose setup, it sometimes crashes after some usage. I tried a bunch of things like trying an IP in place of the Redis hostname, among other things. Running the Redis server with --loglevel verbose, I can see no connection attempt to it. I'm glossing over what I tried because its been a while since I started poking around and also because I think I found a fix.
> scholarsome@1.2.0 serve:node
> npm run migrate && node dist/apps/api/main.js
> scholarsome@1.2.0 migrate
> npx prisma migrate deploy
Prisma schema loaded from prisma/schema.prisma
Datasource "db": MySQL database "scholarsome" at "scholarsome_mariadb:3306"
12 migrations found in prisma/migrations
No pending migrations to apply.
[Scholarsome] Info 6/28/2024, 1:33:33 AM Scholarsome has started! +0ms
[Scholarsome] Error 6/28/2024, 1:49:41 AM uncaughtException: Reached the max retries per request limit (which is 20). Refer to "maxRetriesPerRequest" option for details.
MaxRetriesPerRequestError: Reached the max retries per request limit (which is 20). Refer to "maxRetriesPerRequest" option for details.
at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/event_handler.js:182:37)
at Object.onceWrapper (node:events:633:26)
at Socket.emit (node:events:518:28)
at TCP.<anonymous> (node:net:337:12) - {
error: {},
stack: 'MaxRetriesPerRequestError: Reached the max retries per request limit (which is 20). Refer to "maxRetriesPerRequest" option for details.\n' +
' at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/event_handler.js:182:37)\n' +
' at Object.onceWrapper (node:events:633:26)\n' +
' at Socket.emit (node:events:518:28)\n' +
' at TCP.<anonymous> (node:net:337:12)',
exception: true,
date: 'Fri Jun 28 2024 01:49:41 GMT+0000 (Coordinated Universal Time)',
process: {
pid: 18,
uid: 0,
gid: 0,
cwd: '/usr/src/app',
execPath: '/usr/local/bin/node',
version: 'v20.11.1',
argv: [ '/usr/local/bin/node', '/usr/src/app/dist/apps/api/main.js' ],
memoryUsage: {
rss: 129327104,
heapTotal: 53673984,
heapUsed: 51399080,
external: 2822225,
arrayBuffers: 334413
}
},
os: { loadavg: [ 0.99, 1.35, 1.99 ], uptime: 2416781 },
trace: [
{
column: 37,
file: '/usr/src/app/node_modules/ioredis/built/redis/event_handler.js',
function: null,
line: 182,
method: null,
native: false
},
{
column: 26,
file: 'node:events',
function: 'Object.onceWrapper',
line: 633,
method: 'onceWrapper',
native: false
},
{
column: 28,
file: 'node:events',
function: 'Socket.emit',
line: 518,
method: 'emit',
native: false
},
{
column: 12,
file: 'node:net',
function: null,
line: 337,
method: null,
native: false
}
]
} +16m
# This is the full environment file, intended for use with development installations
# Use production if deploying for use
NODE_ENV=production
# Required if using compose
# Password to provide for internal database
DATABASE_PASSWORD=
# Complete connection URI to MariaDB
DATABASE_URL=mysql://mysql:pIYNFnoxcSOxAIdwayX6Xif0cqbZK7vS@tower:3306/scholarsome
# Random secret used to validate tokens
JWT_SECRET=testing
# Port to expose Scholarsome on
HTTP_PORT=3333
# Domain that Scholarsome will be running on
HOST=localhost:4200
# Redis server details
REDIS_HOST=192.168.1.69
REDIS_PORT=6379
REDIS_USERNAME=
REDIS_PASSWORD=nxcXSfA1hlE3yfWIU0qCH8dKgTLgHBp4
# Data storage configuration
STORAGE_TYPE=local
# Required if storage type is local
# Absolute filepath
STORAGE_LOCAL_DIR=/scholarsome
# Required if storage type is s3
S3_STORAGE_ENDPOINT=
S3_STORAGE_ACCESS_KEY=
S3_STORAGE_SECRET_KEY=
S3_STORAGE_REGION=
S3_STORAGE_BUCKET=
# ---
# Everything past this line is optional
# ---
# Self-explanatory SMTP fields
# Necessary for emails to be sent - otherwise, users are verified by default
SMTP_HOST=localhost
SMTP_PORT=25
SMTP_USERNAME=test
SMTP_PASSWORD=test
# SSL key and cert encoded as base64
SSL_KEY_BASE64=
SSL_CERT_BASE64=
# Recaptcha site key and secret key
SCHOLARSOME_RECAPTCHA_SITE=
SCHOLARSOME_RECAPTCHA_SECRET=
# Additional scripts to be placed on the head of every page encoded in base64
SCHOLARSOME_HEAD_SCRIPTS_BASE64=
When using the app with the Docker compose setup, it sometimes crashes after some usage. I tried a bunch of things like trying an IP in place of the Redis hostname, among other things. Running the Redis server with --loglevel verbose, I can see no connection attempt to it. I'm glossing over what I tried because its been a while since I started poking around and also because I think I found a fix.
Running the development environment, I could replicate the same thing.
ENV file:
I changed a line in https://github.com/hwgilbert16/scholarsome/blob/a3754d457dbab4969975b4fd6f131651b856470c/apps/api/src/app/app.module.ts#L69
Successful connection to Redis and no more issues afaik
Please let me know if you are able to replicate this issue and fix.