Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
When connecting to DigitalOcean Managed Redis, you need to use the rediss protocol because it requires connections to be made over TLS.
To connect using the redis package with TLS, follow the example below:
const Redis = require('redis');
const host = 'db-redis.db.ondigitalocean.com';
const port = '25061';
const username = 'user';
const password = 'secret';
const url = `rediss://${username}:${password}@${host}:${port}`;
const client = Redis.createClient({
url: url,
tls: {}
});
client.on('error', (err) => {
console.error('Redis Client Error', err);
});
(async () => {
try {
await client.connect();
console.log('Connected to Redis');
} catch (err) {
console.error('Error connecting to Redis', err);
}
})();
If you are using sockets and need to enable rediss, pass the necessary options through adapterOptions:
sockets: {
onlyAllowOrigins: ['https://my-website.com'],
adapterOptions: {
user: 'username',
pass: 'password',
host: 'host',
port: 9999,
db: 2, // pick a number
tls: {},
},
adapter: '@sailshq/socket.io-redis',
},
For session management, pass the tls: {} empty object in the configuration:
session: {
pass: 'password',
host: 'host',
port: 9999,
db: 1, // pick a number not used by sockets
tls: {},
cookie: {
secure: true,
maxAge: 24 * 60 * 60 * 1000, // 24 hours
},
},
Basically, by including the tls: {} option, you make sure that your connection to the Redis instance uses TLS, providing the necessary security for your application.
- Bobby