Skip to content

Commit

Permalink
backstage: add healthcheck
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Login <batazor@evrone.com>
  • Loading branch information
batazor committed Feb 27, 2023
1 parent 5064a90 commit b8f8b8f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
3 changes: 3 additions & 0 deletions internal/services/backstage/packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import proxy from './plugins/proxy';
import techdocs from './plugins/techdocs';
import search from './plugins/search';
import kubernetes from './plugins/kubernetes';
import healthcheck from './plugins/healthcheck';
import todo from './plugins/todo';
import { PluginEnvironment } from './types';
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
Expand Down Expand Up @@ -80,6 +81,7 @@ async function main() {
});
const createEnv = makeCreateEnv(config);

const healthcheckEnv = useHotMemoize(module, () => createEnv('healthcheck'));
const catalogEnv = useHotMemoize(module, () => createEnv('catalog'));
const scaffolderEnv = useHotMemoize(module, () => createEnv('scaffolder'));
const authEnv = useHotMemoize(module, () => createEnv('auth'));
Expand All @@ -105,6 +107,7 @@ async function main() {

const service = createServiceBuilder(module)
.loadConfig(config)
.addRouter('', await healthcheck(healthcheckEnv))
.addRouter('/api', apiRouter)
.addRouter('', await app(appEnv));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2020 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { createStatusCheckRouter } from '@backstage/backend-common';
import { PluginEnvironment } from '../types';

export default async function createRouter({ logger }: PluginEnvironment) {
return await createStatusCheckRouter({ logger, path: '/healthcheck' });
}
6 changes: 3 additions & 3 deletions ops/Helm/backstage/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ deploy:

image:
repository: registry.gitlab.com/shortlink-org/shortlink/backstage
tag: 0.14.5
tag: 0.14.5.1
# -- Global imagePullPolicy
# Default: 'Always' if image tag is 'latest', else 'IfNotPresent'
# Ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
Expand All @@ -89,15 +89,15 @@ deploy:
initialDelaySeconds: 15
timeoutSeconds: 15
httpGet:
path: /backstage
path: /healthcheck
port: 7007

# -- define a readiness probe that checks every 5 seconds, starting after 5 seconds
readinessProbe:
initialDelaySeconds: 15
timeoutSeconds: 15
httpGet:
path: /backstage
path: /healthcheck
port: 7007

securityContext:
Expand Down

0 comments on commit b8f8b8f

Please sign in to comment.