Skip to content

Commit

Permalink
fix: healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
hanihusam committed Nov 20, 2024
1 parent 64b870b commit 057a907
Show file tree
Hide file tree
Showing 3 changed files with 421 additions and 2,572 deletions.
8 changes: 4 additions & 4 deletions app/routes/healthcheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export async function loader({ request }: LoaderFunctionArgs) {
request.headers.get('X-Forwarded-Host') ?? request.headers.get('host')

try {
const url = new URL('/', `http://${host}`)
// if we can connect to the database and make a simple query
// and make a HEAD request to ourselves, then we're good.
await Promise.all([
getContentMdxListItems('blog', { request }),
fetch(url.toString(), { method: 'HEAD' }).then((r) => {
fetch(`${new URL(request.url).protocol}${host}`, {
method: 'HEAD',
headers: { 'x-healthcheck': 'true' },
}).then((r) => {
if (!r.ok) return Promise.reject(r)
}),
])
Expand Down
9 changes: 4 additions & 5 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ processes = []

[[services.http_checks]]
interval = "10s"
grace_period = "5s"
timeout = "5s"
grace_period = "1m0s"
restart_limit = 0
method = "get"
path = "/healthcheck"
protocol = "http"
timeout = "2s"
tls_skip_verify = false
headers = { }
protocol = "http"
Loading

0 comments on commit 057a907

Please sign in to comment.