-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- use named volumes that mount faster and don't need renewing - skip docker compose healthcheck - add healthcheck script to initialize
- Loading branch information
Showing
5 changed files
with
82 additions
and
27 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
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
File renamed without changes.
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,43 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import subprocess | ||
import time | ||
import sys | ||
env = os.environ.copy() | ||
|
||
env['DJANGO_SETTINGS_MODULE'] = 'olympia' | ||
|
||
def worker_healthcheck(): | ||
subprocess.run( | ||
['celery', '-A', 'olympia.amo.celery', 'status'], | ||
env=env, | ||
stdout=subprocess.DEVNULL, | ||
) | ||
|
||
def web_healthcheck(): | ||
subprocess.run([ | ||
'curl', | ||
'--fail', | ||
'--show-error', | ||
'--include', | ||
'--location', | ||
'--silent', | ||
'http://127.0.0.1:8002/__version__' | ||
], stdout=subprocess.DEVNULL) | ||
|
||
|
||
TIME = time.time() | ||
TIMEOUT = 60 | ||
SLEEP = 1 | ||
|
||
while time.time() - TIME < TIMEOUT: | ||
try: | ||
worker_healthcheck() | ||
web_healthcheck() | ||
print('OK') | ||
sys.exit(0) | ||
except Exception as e: | ||
print(f'Error: {e}') | ||
time.sleep(SLEEP) | ||
SLEEP *= 2 |