Skip to content

Commit 71551ef

Browse files
author
Artem
authored
Merge pull request #2994 from RedisInsight/feature/change-port
change default port + add health endpoint
2 parents 287655e + 4076d6b commit 71551ef

File tree

11 files changed

+66
-39
lines changed

11 files changed

+66
-39
lines changed

DOCKER_README.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ RUN mkdir -p /data && chown -R node:node /data
6969
COPY --chown=node:node ./docker-entry.sh ./
7070
RUN chmod +x docker-entry.sh
7171

72-
# since RI is hard-code to port 5000, expose it from the container
73-
EXPOSE 5000
72+
# since RI is hard-code to port 5540, expose it from the container
73+
EXPOSE 5540
7474

7575
# don't run the node process as root
7676
USER node

api.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ RUN chmod +x api-docker-entry.sh
3838
ENTRYPOINT ["./api-docker-entry.sh"]
3939
CMD ["node", "dist/src/main"]
4040

41-
EXPOSE 5000
41+
EXPOSE 5540
4242

configs/webpack.config.web.prod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const configuration: webpack.Configuration = {
7676
new webpack.EnvironmentPlugin({
7777
NODE_ENV: 'production',
7878
RI_APP_TYPE: 'web',
79-
RI_APP_PORT: '5000',
79+
RI_APP_PORT: '5540',
8080
RI_BASE_API_URL: '',
8181
RI_API_PREFIX: 'api',
8282
RI_SCAN_COUNT_DEFAULT: '500',

redisinsight/api/config/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default {
4040
version,
4141
env: process.env.NODE_ENV || 'development',
4242
host: process.env.RI_APP_HOST ?? '0.0.0.0',
43-
port: parseInt(process.env.RI_APP_PORT, 10) || 5000,
43+
port: parseInt(process.env.RI_APP_PORT, 10) || 5540,
4444
docPrefix: 'api/docs',
4545
globalPrefix: 'api',
4646
customPluginsUri: '/plugins',
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {
2+
Controller,
3+
Get,
4+
} from '@nestjs/common';
5+
import { ApiTags } from '@nestjs/swagger';
6+
import { ApiEndpoint } from 'src/decorators/api-endpoint.decorator';
7+
8+
@ApiTags('Info')
9+
@Controller('health')
10+
export class HealthController {
11+
@Get('')
12+
@ApiEndpoint({
13+
description: 'Get server info',
14+
statusCode: 200,
15+
})
16+
async health(): Promise<object> {
17+
return { status: 'up' };
18+
}
19+
}

redisinsight/api/src/modules/server/server.module.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ServerService } from 'src/modules/server/server.service';
44
import { ServerRepository } from 'src/modules/server/repositories/server.repository';
55
import { LocalServerRepository } from 'src/modules/server/repositories/local.server.repository';
66
import { FeatureModule } from 'src/modules/feature/feature.module';
7+
import { HealthController } from 'src/modules/server/health.controller';
78

89
@Module({})
910
export class ServerModule {
@@ -12,7 +13,10 @@ export class ServerModule {
1213
) {
1314
return {
1415
module: ServerModule,
15-
controllers: [ServerController],
16+
controllers: [
17+
ServerController,
18+
HealthController,
19+
],
1620
providers: [
1721
ServerService,
1822
{
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {
2+
expect,
3+
describe,
4+
deps,
5+
Joi,
6+
getMainCheckFn
7+
} from '../deps';
8+
const { server, request } = deps;
9+
10+
// endpoint to test
11+
const endpoint = () => request(server).get('/health');
12+
13+
const responseSchema = Joi.object().keys({
14+
status: Joi.string().required(),
15+
}).required();
16+
17+
const mainCheckFn = getMainCheckFn(endpoint);
18+
19+
describe('GET /health', () => {
20+
[
21+
{
22+
name: 'Should return server health',
23+
statusCode: 200,
24+
responseSchema,
25+
checkFn: ({ body }) => {
26+
expect(body.status).to.eql('up');
27+
}
28+
},
29+
].map(mainCheckFn);
30+
});

tests/e2e/.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
COMMON_URL=https://app:5000
2-
API_URL=https://app:5000/api
1+
COMMON_URL=https://app:5540
2+
API_URL=https://app:5540/api
33
OSS_SENTINEL_PASSWORD=password
44
RI_NOTIFICATION_UPDATE_URL=https://s3.amazonaws.com/redisinsight.test/public/tests/e2e/notifications.json
55
RI_NOTIFICATION_SYNC_INTERVAL=30000

tests/e2e/helpers/conf.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { Chance } from 'chance';
55
const chance = new Chance();
66

77
// Urls for using in the tests
8-
export const commonUrl = process.env.COMMON_URL || 'https://localhost:5000';
9-
export const apiUrl = process.env.API_URL || 'https://localhost:5000/api';
8+
export const commonUrl = process.env.COMMON_URL || 'https://localhost:5540';
9+
export const apiUrl = process.env.API_URL || 'https://localhost:5540/api';
1010

1111
export const workingDirectory = process.env.RI_APP_FOLDER_ABSOLUTE_PATH
1212
|| (joinPath(os.homedir(), process.env.RI_APP_FOLDER_NAME || '.redisinsight-app'));

0 commit comments

Comments
 (0)