Change /healthz to /healthcheck and remove unused docker compose templates (#54171)
This commit is contained in:
@@ -53,5 +53,5 @@ spec:
|
|||||||
httpGet:
|
httpGet:
|
||||||
# WARNING: This should be updated to a meaningful endpoint for your application which will return a 200 once the app is fully started.
|
# 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
|
# See: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes
|
||||||
path: /healthz
|
path: /healthcheck
|
||||||
port: http
|
port: http
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const router = express.Router()
|
|||||||
* instance remains in the pool to handle requests
|
* instance remains in the pool to handle requests
|
||||||
* For example: if we have a failing database connection we may return a 500 status here.
|
* 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)
|
noCacheControl(res)
|
||||||
|
|
||||||
res.sendStatus(200)
|
res.sendStatus(200)
|
||||||
@@ -27,7 +27,7 @@ import findPage from './find-page.js'
|
|||||||
import blockRobots from './block-robots'
|
import blockRobots from './block-robots'
|
||||||
import archivedEnterpriseVersionsAssets from '@/archives/middleware/archived-enterprise-versions-assets'
|
import archivedEnterpriseVersionsAssets from '@/archives/middleware/archived-enterprise-versions-assets'
|
||||||
import api from './api'
|
import api from './api'
|
||||||
import healthz from './healthz'
|
import healthcheck from './healthcheck'
|
||||||
import manifestJson from './manifest-json'
|
import manifestJson from './manifest-json'
|
||||||
import buildInfo from './build-info'
|
import buildInfo from './build-info'
|
||||||
import reqHeaders from './req-headers'
|
import reqHeaders from './req-headers'
|
||||||
@@ -66,16 +66,14 @@ import shielding from '@/shielding/middleware'
|
|||||||
import tracking from '@/tracking/middleware'
|
import tracking from '@/tracking/middleware'
|
||||||
import { MAX_REQUEST_TIMEOUT } from '@/frame/lib/constants.js'
|
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'
|
const isTest = NODE_ENV === 'test' || process.env.GITHUB_ACTIONS === 'true'
|
||||||
|
|
||||||
// By default, logging each request (with morgan), is on. And by default
|
// 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.
|
// it's off if you're in a production environment or running automated tests.
|
||||||
// But if you set the env var, that takes precedence.
|
// But if you set the env var, that takes precedence.
|
||||||
const ENABLE_DEV_LOGGING = Boolean(
|
const ENABLE_DEV_LOGGING = Boolean(
|
||||||
process.env.ENABLE_DEV_LOGGING
|
process.env.ENABLE_DEV_LOGGING ? JSON.parse(process.env.ENABLE_DEV_LOGGING) : !isTest,
|
||||||
? JSON.parse(process.env.ENABLE_DEV_LOGGING)
|
|
||||||
: !(DEPLOYMENT_ENV === 'azure' || isTest),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const ENABLE_FASTLY_TESTING = JSON.parse(process.env.ENABLE_FASTLY_TESTING || 'false')
|
const ENABLE_FASTLY_TESTING = JSON.parse(process.env.ENABLE_FASTLY_TESTING || 'false')
|
||||||
@@ -120,7 +118,7 @@ export default function (app: Express) {
|
|||||||
// Put this early to make it as fast as possible because it's used,
|
// 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
|
// and used very often, by the Azure load balancer to check the
|
||||||
// health of each node.
|
// health of each node.
|
||||||
app.use('/healthz', healthz)
|
app.use('/healthcheck', healthcheck)
|
||||||
|
|
||||||
// Must appear before static assets and all other requests
|
// Must appear before static assets and all other requests
|
||||||
// otherwise we won't be able to benefit from that functionality
|
// otherwise we won't be able to benefit from that functionality
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export default function handleRedirects(req: ExtendedRequest, res: Response, nex
|
|||||||
// the language prefix.
|
// the language prefix.
|
||||||
// We can't always force on the language prefix because some URLs
|
// We can't always force on the language prefix because some URLs
|
||||||
// aren't pages. They're other middleware endpoints such as
|
// 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`
|
// But for example, a `/authentication/connecting-to-github-with-ssh`
|
||||||
// needs to become `/en/authentication/connecting-to-github-with-ssh`
|
// needs to become `/en/authentication/connecting-to-github-with-ssh`
|
||||||
const possibleRedirectTo = `/en${req.path}`
|
const possibleRedirectTo = `/en${req.path}`
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
version: '3.7'
|
|
||||||
|
|
||||||
services:
|
|
||||||
ghdocs-prod:
|
|
||||||
image: '#{IMAGE}#'
|
|
||||||
ports:
|
|
||||||
- '4000:4000'
|
|
||||||
environment:
|
|
||||||
NODE_ENV: ${NODE_ENV}
|
|
||||||
NODE_OPTIONS: ${NODE_OPTIONS}
|
|
||||||
DD_API_KEY: ${DD_API_KEY}
|
|
||||||
COOKIE_SECRET: ${COOKIE_SECRET}
|
|
||||||
HYDRO_ENDPOINT: ${HYDRO_ENDPOINT}
|
|
||||||
HYDRO_SECRET: ${HYDRO_SECRET}
|
|
||||||
HAYSTACK_URL: ${HAYSTACK_URL}
|
|
||||||
HEROKU_APP_NAME: ${HEROKU_APP_NAME}
|
|
||||||
DEPLOYMENT_ENV: ${DEPLOYMENT_ENV}
|
|
||||||
HEROKU_PRODUCTION_APP: true
|
|
||||||
PORT: 4000
|
|
||||||
DD_AGENT_HOST: datadog-agent
|
|
||||||
depends_on:
|
|
||||||
- datadog-agent
|
|
||||||
restart: always
|
|
||||||
|
|
||||||
datadog-agent:
|
|
||||||
image: 'ghdocsprod.azurecr.io/datadog/dogstatsd:latest'
|
|
||||||
ports:
|
|
||||||
- '8125:8125'
|
|
||||||
environment:
|
|
||||||
DD_API_KEY: ${DD_API_KEY}
|
|
||||||
DD_AGENT_HOST: datadog-agent
|
|
||||||
DD_HISTOGRAM_PERCENTILES: 0.99 0.95 0.50
|
|
||||||
DD_HOSTNAME_TRUST_UTS_NAMESPACE: true
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
version: '3.7'
|
|
||||||
|
|
||||||
services:
|
|
||||||
ghdocs-staging:
|
|
||||||
image: '#{IMAGE}#'
|
|
||||||
ports:
|
|
||||||
- '4000:4000'
|
|
||||||
environment:
|
|
||||||
NODE_ENV: ${NODE_ENV}
|
|
||||||
NODE_OPTIONS: ${NODE_OPTIONS}
|
|
||||||
DD_API_KEY: ${DD_API_KEY}
|
|
||||||
COOKIE_SECRET: ${COOKIE_SECRET}
|
|
||||||
HYDRO_ENDPOINT: ${HYDRO_ENDPOINT}
|
|
||||||
HYDRO_SECRET: ${HYDRO_SECRET}
|
|
||||||
HAYSTACK_URL: ${HAYSTACK_URL}
|
|
||||||
HEROKU_APP_NAME: ${HEROKU_APP_NAME}
|
|
||||||
ENABLED_LANGUAGES: ${ENABLED_LANGUAGES}
|
|
||||||
DEPLOYMENT_ENV: ${DEPLOYMENT_ENV}
|
|
||||||
HEROKU_PRODUCTION_APP: true
|
|
||||||
PORT: 4000
|
|
||||||
DD_AGENT_HOST: datadog-agent
|
|
||||||
depends_on:
|
|
||||||
- datadog-agent
|
|
||||||
restart: always
|
|
||||||
|
|
||||||
datadog-agent:
|
|
||||||
image: datadog/dogstatsd:7.32.4
|
|
||||||
ports:
|
|
||||||
- '8125:8125'
|
|
||||||
environment:
|
|
||||||
DD_API_KEY: ${DD_API_KEY}
|
|
||||||
DD_AGENT_HOST: datadog-agent
|
|
||||||
DD_HISTOGRAM_PERCENTILES: 0.99 0.95 0.50
|
|
||||||
@@ -6,7 +6,7 @@ const DELAY_SECONDS = 15
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Promise resolves once url is healthy or fails if timeout has passed
|
* 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) {
|
export async function waitUntilUrlIsHealthy(url: string) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user