-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for galaxy operator (#2058)
1. Updating Dockerfile to install required directories in /var/lib/pulp/ 2. Adding skopeo dnf dependency for content signing script 3. Adding readyz.py for galaxy-operator ready check 4. Updating MANIFEST.in No-Issue
- Loading branch information
Showing
6 changed files
with
77 additions
and
10 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
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 |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
set -o errexit | ||
set -o nounset | ||
|
||
exec pulpcore-worker | ||
exec pulpcore-worker |
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,66 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
import requests | ||
|
||
from requests.packages.urllib3.util.connection import HAS_IPV6 | ||
|
||
|
||
def is_api_healthy(path): | ||
""" | ||
Checks if API is healthy | ||
""" | ||
address = "[::1]" if HAS_IPV6 else "127.0.0.1" | ||
url = f"http://{address}:8000{path}" | ||
print(f"Readiness probe: checking {url}") | ||
response = requests.get(url, allow_redirects=True) | ||
data = response.json() | ||
|
||
if not data["database_connection"]["connected"]: | ||
print("Readiness probe: database issue") | ||
sys.exit(3) | ||
|
||
if os.getenv("REDIS_SERVICE_HOST") and not data["redis_connection"]["connected"]: | ||
print("Readiness probe: cache issue") | ||
sys.exit(4) | ||
|
||
print("Readiness probe: ready!") | ||
sys.exit(0) | ||
|
||
|
||
def is_content_healthy(path): | ||
""" | ||
Checks if Content is healthy | ||
""" | ||
address = "[::1]" if HAS_IPV6 else "127.0.0.1" | ||
url = f"http://{address}:24816{path}" | ||
print(f"Readiness probe checking {url}") | ||
response = requests.head(url) | ||
response.raise_for_status() | ||
|
||
print("Readiness probe: ready!") | ||
sys.exit(0) | ||
|
||
|
||
""" | ||
PID 1 value (/proc/1/cmdline) may vary based on the gunicorn install method (RPM vs pip) | ||
The cmdline value for this PID looks like: | ||
``` | ||
# pip installation | ||
gunicorn: master [pulp-{content,api}] | ||
``` | ||
OR | ||
``` | ||
# RPM installation | ||
/usr/bin/python3.9/usr/bin/gunicorn--bind[::]:2481{6,7}pulpcore.app.wsgi:application--namepulp-{api,content}--timeout90--workers2 | ||
``` | ||
""" | ||
with open("/proc/1/cmdline", "r") as f: | ||
cmdline = f.readline() | ||
|
||
if "pulp-api" in cmdline: | ||
is_api_healthy(sys.argv[1]) | ||
|
||
elif "pulp-content" in cmdline: | ||
is_content_healthy(sys.argv[1]) |