Skip to content

Commit 814e724

Browse files
committed
fix(redis): Show a warning on the dashboard if Amazon ElastiCache is used as the database
1 parent 086f1c6 commit 814e724

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

lib/routes-ui.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,9 @@ function applyRoutes(server, call) {
837837
stats,
838838
counterList,
839839
hasAccounts,
840+
841+
isElastiCache: ['elasticache'].includes(stats.redisSoftware),
842+
840843
redisPing: {
841844
key: 'redisPing',
842845
title: 'Redis Latency',

lib/tools.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@ MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV3QUiYsp13nD9suD1/ZkEXnuMoSg
11251125

11261126
let redisVersion;
11271127
let softwareDetails;
1128+
let redisSoftware;
11281129
try {
11291130
let redisInfo = await module.exports.getRedisStats(redis);
11301131
if (!redisInfo || typeof redisInfo.redis_version !== 'string') {
@@ -1135,21 +1136,31 @@ MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV3QUiYsp13nD9suD1/ZkEXnuMoSg
11351136
// Detect Dragonfly
11361137
if (typeof redisInfo.dragonfly_version === 'string') {
11371138
softwareDetails = `Dragonfly v${redisInfo.dragonfly_version.replace(/^[^\d]*/, '')}`;
1139+
redisSoftware = 'dragonfly';
11381140
}
11391141

11401142
// Detect KeyDB
11411143
if (typeof redisInfo.mvcc_depth === 'number') {
11421144
softwareDetails = `KeyDB`;
1145+
redisSoftware = 'keydb';
11431146
}
11441147

11451148
// Detect Upstash
11461149
if (typeof redisInfo.upstash_version === 'string') {
11471150
softwareDetails = `Upstash Redis v${redisInfo.upstash_version.replace(/^[^\d]*/, '')}`;
1151+
redisSoftware = 'upstash';
11481152
}
11491153

11501154
// Detect Memurai
11511155
if (typeof redisInfo.memurai_version === 'string') {
11521156
softwareDetails = `${redisInfo.memurai_edition || 'Memurai'} v${redisInfo.memurai_version.replace(/^[^\d]*/, '')}`;
1157+
redisSoftware = 'memurai';
1158+
}
1159+
1160+
// Detect ElastiCache
1161+
if (/Amazon ElastiCache/i.test(redisInfo.os)) {
1162+
softwareDetails = `Amazon ElastiCache`;
1163+
redisSoftware = 'elasticache';
11531164
}
11541165
} catch (err) {
11551166
console.log(err);
@@ -1193,6 +1204,7 @@ MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV3QUiYsp13nD9suD1/ZkEXnuMoSg
11931204
accounts: await redis.scard(`${REDIS_PREFIX}ia:accounts`),
11941205
node: process.versions.node,
11951206
redis: `${redisVersion}${softwareDetails ? ` (${softwareDetails})` : ''}`,
1207+
redisSoftware,
11961208
imapflow: ImapFlow.version || 'please upgrade',
11971209
bullmq: bullmqPackage.version,
11981210
arch: process.arch,

views/dashboard.hbs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,33 @@
55
</div>
66

77

8+
{{#if isElastiCache}}
9+
<div class="card border-left-danger mt-4">
10+
<div class="card-body">
11+
<div class="row no-gutters align-items-center">
12+
<div class="col mr-2">
13+
<div class="text-xs font-weight-bold text-danger text-uppercase mb-1">Compatiblity warning
14+
</div>
15+
<p>EmailEngine is incompatible with Amazon ElastiCache as the database backend.</p>
16+
<p>Please switch to a standard Redis instance. Using ElastiCache with EmailEngine can result in data
17+
loss and several functionalities may not work.</p>
18+
</div>
19+
<div class="col-auto">
20+
<i class="fas fa-exclamation-circle fa-2x text-gray-300"></i>
21+
</div>
22+
</div>
23+
</div>
24+
</div>
25+
{{/if}}
26+
827

928
{{#unless hasAccounts}}
1029

1130
<div class="card border-left-success mt-4">
1231
<div class="card-body">
1332
<div class="row no-gutters align-items-center">
1433
<div class="col mr-2">
15-
<div class="text-xs font-weight-bold text-danger text-uppercase mb-1">Welcome to EmailEngine!
34+
<div class="text-xs font-weight-bold text-success text-uppercase mb-1">Welcome to EmailEngine!
1635
</div>
1736
<p>To start using EmailEngine, add an email account to the <a href="/admin/accounts">account
1837
registry</a>. Once registered, you can access this account to send

0 commit comments

Comments
 (0)