chore: get websocket service to start in docker-compose (#28135)

This commit is contained in:
Maxime Beauchemin 2024-04-23 11:06:41 -07:00 committed by GitHub
parent b7f3e0bb50
commit 063914af04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 2 deletions

View File

@ -120,6 +120,10 @@ services:
- ./superset-websocket:/home/superset-websocket
- /home/superset-websocket/node_modules
- /home/superset-websocket/dist
# Mounting a config file that contains a dummy secret required to boot up.
# do no not use this docker-compose in production
- ./docker/superset-websocket/config.json:/home/superset-websocket/config.json
environment:
- PORT=8080
- REDIS_HOST=redis

View File

@ -0,0 +1,22 @@
{
"port": 8080,
"logLevel": "info",
"logToFile": false,
"logFilename": "app.log",
"statsd": {
"host": "127.0.0.1",
"port": 8125,
"globalTags": []
},
"redis": {
"port": 6379,
"host": "127.0.0.1",
"password": "",
"db": 0,
"ssl": false
},
"redisStreamPrefix": "async-events-",
"jwtAlgorithms": ["HS256"],
"jwtSecret": "CHANGE-ME-IN-PRODUCTION-GOTTA-BE-LONG-AND-SECRET",
"jwtCookieName": "async-token"
}

View File

@ -94,8 +94,17 @@ export const statsd = new StatsD({
});
// enforce JWT secret length
if (startServer && opts.jwtSecret.length < 32)
throw new Error('Please provide a JWT secret at least 32 bytes long');
if (startServer && opts.jwtSecret.length < 32) {
console.error('ERROR: Please provide a JWT secret at least 32 bytes long');
process.exit(1);
}
if (startServer && opts.jwtSecret.startsWith('CHANGE-ME')) {
console.warn(
'WARNING: it appears you secret in your config.json is insecure',
);
console.warn('DO NOT USE IN PRODUCTION');
}
export const buildRedisOpts = (baseConfig: RedisConfig) => {
const redisOpts: RedisOptions = {