Skip to content

Commit

Permalink
feat: add health check route
Browse files Browse the repository at this point in the history
  • Loading branch information
Trugamr committed Jan 15, 2024
1 parent 5f213bd commit e4ec647
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/lib/docker/compose.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { execa } from 'execa'

export async function getDockerComposeVersion() {
const { stdout } = await execa('docker', ['compose', 'version'])
return stdout
}
20 changes: 20 additions & 0 deletions app/routes/health.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { getDockerComposeVersion } from '~/lib/docker/compose.server'

export async function loader() {
try {
await getDockerComposeVersion()
} catch (error) {
// eslint-disable-next-line no-console
console.error(`Failed to get docker compose version`)

return new Response('ERROR', {
status: 500,
statusText: 'Internal Server Error',
})
}

return new Response('OK', {
status: 200,
statusText: 'OK',
})
}

0 comments on commit e4ec647

Please sign in to comment.