Skip to content

Commit

Permalink
chore: get websocket service to start in docker-compose (apache#28135)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored and jzhao62 committed May 16, 2024
1 parent 7246627 commit 705fc41
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions docker/superset-websocket/config.json
Original file line number Diff line number Diff line change
@@ -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"
}
13 changes: 11 additions & 2 deletions superset-websocket/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 705fc41

Please sign in to comment.