-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add docker healthchecks to server and ml (#9583)
* add healthcheck * format, import, IMMICH_PORT, and eslint change * chore: clean up nodejs healthcheck * fix ruff formating * add healthcheck * format, import, IMMICH_PORT, and eslint change * chore: clean up nodejs healthcheck * fix ruff formating * add healthcheck to dockerfile * poetry run ruff check --fix * removed 2 of 3 console calls --------- Co-authored-by: Jason Rasmussen <[email protected]>
- Loading branch information
Showing
5 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import os | ||
import sys | ||
|
||
import requests | ||
|
||
port = os.getenv("IMMICH_PORT", 3003) | ||
|
||
try: | ||
response = requests.get(f"http://localhost:{port}/ping", timeout=2) | ||
if response.status_code == 200: | ||
sys.exit(0) | ||
sys.exit(1) | ||
except requests.RequestException: | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env node | ||
const port = Number(process.env.IMMICH_PORT) || 3001; | ||
const controller = new AbortController(); | ||
|
||
const main = async () => { | ||
const timeout = setTimeout(() => controller.abort(), 2000); | ||
try { | ||
const response = await fetch(`http://localhost:${port}/api/server-info/ping`, { | ||
signal: controller.signal, | ||
}); | ||
|
||
if (response.ok) { | ||
const body = await response.json(); | ||
if (body.res === 'pong') { | ||
process.exit(); | ||
} | ||
} | ||
} catch (error) { | ||
if (error instanceof DOMException === false) { | ||
console.error(error); | ||
} | ||
} finally { | ||
clearTimeout(timeout); | ||
} | ||
|
||
process.exit(1); | ||
}; | ||
|
||
void main(); |