Skip to content

Commit

Permalink
Change /healthz to /healthcheck and remove unused docker compose …
Browse files Browse the repository at this point in the history
…templates (#54171)
  • Loading branch information
hectorsector authored Jan 29, 2025
1 parent 785cb83 commit 758ac42
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 76 deletions.
2 changes: 1 addition & 1 deletion config/kubernetes/production/deployments/webapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ spec:
httpGet:
# WARNING: This should be updated to a meaningful endpoint for your application which will return a 200 once the app is fully started.
# See: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes
path: /healthz
path: /healthcheck
port: http
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const router = express.Router()
* instance remains in the pool to handle requests
* For example: if we have a failing database connection we may return a 500 status here.
*/
router.get('/', function healthz(req, res) {
router.get('/', function healthcheck(req, res) {
noCacheControl(res)

res.sendStatus(200)
Expand Down
10 changes: 4 additions & 6 deletions src/frame/middleware/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import findPage from './find-page.js'
import blockRobots from './block-robots'
import archivedEnterpriseVersionsAssets from '@/archives/middleware/archived-enterprise-versions-assets'
import api from './api'
import healthz from './healthz'
import healthcheck from './healthcheck'
import manifestJson from './manifest-json'
import buildInfo from './build-info'
import reqHeaders from './req-headers'
Expand Down Expand Up @@ -66,16 +66,14 @@ import shielding from '@/shielding/middleware'
import tracking from '@/tracking/middleware'
import { MAX_REQUEST_TIMEOUT } from '@/frame/lib/constants.js'

const { DEPLOYMENT_ENV, NODE_ENV } = process.env
const { NODE_ENV } = process.env
const isTest = NODE_ENV === 'test' || process.env.GITHUB_ACTIONS === 'true'

// By default, logging each request (with morgan), is on. And by default
// it's off if you're in a production environment or running automated tests.
// But if you set the env var, that takes precedence.
const ENABLE_DEV_LOGGING = Boolean(
process.env.ENABLE_DEV_LOGGING
? JSON.parse(process.env.ENABLE_DEV_LOGGING)
: !(DEPLOYMENT_ENV === 'azure' || isTest),
process.env.ENABLE_DEV_LOGGING ? JSON.parse(process.env.ENABLE_DEV_LOGGING) : !isTest,
)

const ENABLE_FASTLY_TESTING = JSON.parse(process.env.ENABLE_FASTLY_TESTING || 'false')
Expand Down Expand Up @@ -120,7 +118,7 @@ export default function (app: Express) {
// Put this early to make it as fast as possible because it's used,
// and used very often, by the Azure load balancer to check the
// health of each node.
app.use('/healthz', healthz)
app.use('/healthcheck', healthcheck)

// Must appear before static assets and all other requests
// otherwise we won't be able to benefit from that functionality
Expand Down
2 changes: 1 addition & 1 deletion src/redirects/middleware/handle-redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function handleRedirects(req: ExtendedRequest, res: Response, nex
// the language prefix.
// We can't always force on the language prefix because some URLs
// aren't pages. They're other middleware endpoints such as
// `/healthz` which should never redirect.
// `/healthcheck` which should never redirect.
// But for example, a `/authentication/connecting-to-github-with-ssh`
// needs to become `/en/authentication/connecting-to-github-with-ssh`
const possibleRedirectTo = `/en${req.path}`
Expand Down
33 changes: 0 additions & 33 deletions src/workflows/docker-compose.prod.tmpl.yaml

This file was deleted.

33 changes: 0 additions & 33 deletions src/workflows/docker-compose.staging.tmpl.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/workflows/wait-until-url-is-healthy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const DELAY_SECONDS = 15

/*
* Promise resolves once url is healthy or fails if timeout has passed
* @param {string} url - health url, e.g. docs.com/healthz
* @param {string} url - health url, e.g. docs.com/healthcheck
*/
export async function waitUntilUrlIsHealthy(url: string) {
try {
Expand Down

0 comments on commit 758ac42

Please sign in to comment.