Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding nginx and gunicorn to sheepdog image #418

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update settings.py
  • Loading branch information
jawadqur committed Aug 12, 2024
commit b608fa7b23a90885c1be09f6c016c80a6fc70c14
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"filename": "bin/settings.py",
"hashed_secret": "347cd9c53ff77d41a7b22aa56c7b4efaf54658e3",
"is_verified": false,
"line_number": 43
"line_number": 54
}
],
"docs/local_dev_environment.md": [
Expand Down Expand Up @@ -354,5 +354,5 @@
}
]
},
"generated_at": "2024-04-22T20:07:28Z"
"generated_at": "2024-08-12T21:26:18Z"
}
2 changes: 1 addition & 1 deletion bin/confighelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ def load_json(file_name, app_name, search_folders=None):
"""
actual_files = find_paths(file_name, app_name, search_folders)
if not actual_files:
return None
return {}
with open(actual_files[0], "r") as reader:
return json.load(reader)
45 changes: 29 additions & 16 deletions bin/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from sheepdog.api import app, app_init
from os import environ
import confighelper
import os
from . import confighelper

APP_NAME = "sheepdog"

Expand All @@ -22,39 +22,52 @@ def load_json(file_name):

# Signpost: deprecated, replaced by index client.
config["SIGNPOST"] = {
"host": environ.get("SIGNPOST_HOST") or "http://indexd-service",
"host": os.environ.get("SIGNPOST_HOST", "http://indexd-service"),
"version": "v0",
"auth": ("gdcapi", conf_data.get("indexd_password", "{{indexd_password}}")),
}
config["INDEX_CLIENT"] = {
"host": environ.get("INDEX_CLIENT_HOST") or "http://indexd-service",
"host": os.environ.get("INDEX_CLIENT_HOST") or "http://indexd-service",
"version": "v0",
"auth": ("gdcapi", conf_data.get("indexd_password", "{{indexd_password}}")),
}
config["FAKE_AUTH"] = False
config["PSQLGRAPH"] = {
"host": conf_data["db_host"],
"user": conf_data["db_username"],
"password": conf_data["db_password"],
"database": conf_data["db_database"],
"host": conf_data.get("db_host", os.environ.get("PGHOST", "localhost")),
"user": conf_data.get("db_username", os.environ.get("PGUSER", "sheepdog")),
"password": conf_data.get("db_password", os.environ.get("PGPASSWORD", "sheepdog")),
"database": conf_data.get("db_database", os.environ.get("PGDATABASE", "sheepdog")),
}

config["FLASK_SECRET_KEY"] = conf_data.get("gdcapi_secret_key", "{{gdcapi_secret_key}}")
config["PSQL_USER_DB_CONNECTION"] = "postgresql://%s:%s@%s:5432/%s" % tuple(
[
conf_data.get(key, key)
for key in ["fence_username", "fence_password", "fence_host", "fence_database"]
]

fence_username = conf_data.get(
"fence_username", os.environ.get("FENCE_DB_USERNAME", "fence")
)
fence_password = conf_data.get(
"fence_password", os.environ.get("FENCE_DB_PASSWORD", "fence")
)
fence_host = conf_data.get("fence_host", os.environ.get("FENCE_DB_HOST", "localhost"))
fence_database = conf_data.get(
"fence_database", os.environ.get("FENCE_DB_DATABASE", "fence")
)
config["PSQL_USER_DB_CONNECTION"] = "postgresql://%s:%s@%s:5432/%s" % (
fence_username,
fence_password,
fence_host,
fence_database,
)

config["USER_API"] = "https://%s/user" % conf_data["hostname"] # for use by authutils
config["USER_API"] = "https://%s/user" % conf_data.get(
"hostname", os.environ.get("CONF_HOSTNAME", "localhost")
) # for use by authutils
# use the USER_API URL instead of the public issuer URL to accquire JWT keys
config["FORCE_ISSUER"] = True
config["DICTIONARY_URL"] = environ.get(
config["DICTIONARY_URL"] = os.environ.get(
"DICTIONARY_URL",
"https://s3.amazonaws.com/dictionary-artifacts/datadictionary/develop/schema.json",
)

app_init(app)
application = app
application.debug = environ.get("GEN3_DEBUG") == "True"
application.debug = os.environ.get("GEN3_DEBUG") == "True"
3 changes: 2 additions & 1 deletion deployment/wsgi/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
wsgi_app = "deployment.wsgi.wsgi:application"
# /sheepdoog/bin/settings.py
wsgi_app = "bin.settings:application"
bind = "0.0.0.0:8000"
workers = 4
preload_app = True
Expand Down
Loading