-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #583 from memeLab/create-tools-container
Update Docker default user and Storage settings
- Loading branch information
Showing
35 changed files
with
202 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
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 |
---|---|---|
@@ -1,17 +1,22 @@ | ||
from locust import HttpLocust, Set, between | ||
|
||
|
||
def index(load): | ||
load.client.get("/") | ||
|
||
|
||
def load_gifs(load): | ||
load.client.get("/collection/") | ||
|
||
|
||
def exhibit(load): | ||
load.client.get("/longavida/") | ||
|
||
|
||
class UserBehavior(Set): | ||
s = {exhibit:1} | ||
s = {exhibit: 1} | ||
|
||
|
||
class WebsiteUser(HttpLocust): | ||
_set = UserBehavior | ||
wait_time = between(3,5) | ||
wait_time = between(3, 5) |
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 |
---|---|---|
@@ -1,10 +1,29 @@ | ||
#!/bin/bash | ||
poetry install | ||
|
||
# Set default values for environment variables if not provided | ||
INSTALL_DEV=${INSTALL_DEV:-false} | ||
USE_GUNICORN=${USE_GUNICORN:-true} | ||
|
||
# Convert variables to lowercase for case-insensitive comparison | ||
INSTALL_DEV=$(echo "$INSTALL_DEV" | tr '[:upper:]' '[:lower:]') | ||
USE_GUNICORN=$(echo "$USE_GUNICORN" | tr '[:upper:]' '[:lower:]') | ||
|
||
poetry install --without dev | ||
|
||
if [ "$INSTALL_DEV" = "true" ]; then | ||
poetry install --only dev | ||
fi | ||
|
||
poetry show | ||
# poetry run python src/manage.py collectstatic --no-input | ||
poetry run python src/manage.py collectstatic --no-input | ||
poetry run python src/manage.py migrate | ||
poetry run sphinx-build docs/ build/ | ||
poetry run python etc/scripts/compilemessages.py | ||
|
||
bash -c "cd src && poetry run gunicorn --reload --worker-connections=10000 --workers=4 --log-level debug --bind 0.0.0.0:8000 config.wsgi" | ||
# poetry run python src/manage.py runserver 0.0.0.0:8000 | ||
if [ "$USE_GUNICORN" = "true" ]; then | ||
echo "Running Gunicorn Server" | ||
bash -c "cd src && poetry run gunicorn --reload --worker-connections=10000 --workers=4 --log-level debug --bind 0.0.0.0:8000 config.wsgi" | ||
else | ||
echo "Running Django development server" | ||
poetry run python src/manage.py runserver 0.0.0.0:8000 | ||
fi |
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 |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
from django.utils.translation import gettext_lazy as _ | ||
from sentry_sdk.integrations.django import DjangoIntegration | ||
|
||
from .storage_settings import * # noqa F403 F401 | ||
|
||
ROOT_DIR = environ.Path("/jandig/") | ||
BASE_DIR = "/jandig/src" | ||
|
||
|
@@ -43,7 +45,7 @@ | |
HEALTH_CHECK_URL = env("HEALTH_CHECK_URL", default="api/v1/status/") | ||
SENTRY_TRACES_SAMPLE_RATE = env("SENTRY_TRACES_SAMPLE_RATE", default=0.1) | ||
SENTRY_ENVIRONMENT = env("SENTRY_ENVIRONMENT", default="") | ||
SENTRY_RELEASE = env("SENTRY_RELEASE", default="1.4.0") | ||
SENTRY_RELEASE = env("SENTRY_RELEASE", default="1.4.1") | ||
|
||
|
||
def traces_sampler(sampling_context): | ||
|
@@ -184,53 +186,6 @@ def debug(request): | |
|
||
USE_TZ = True | ||
|
||
|
||
# AWS credentials | ||
AWS_S3_OBJECT_PARAMETERS = { | ||
"CacheControl": "max-age=86400", | ||
} | ||
AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID", "") | ||
AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY", "") | ||
AWS_STORAGE_BUCKET_NAME = os.getenv("AWS_STORAGE_BUCKET_NAME", "") | ||
AWS_S3_REGION_NAME = os.getenv("AWS_S3_REGION_NAME", "us-east-2") | ||
AWS_DEFAULT_ACL = os.getenv("AWS_DEFAULT_ACL", None) | ||
AWS_STATIC_LOCATION = os.getenv("AWS_STATIC_LOCATION", "static") | ||
AWS_MEDIA_LOCATION = os.getenv("AWS_MEDIA_LOCATION", "media") | ||
USE_MINIO = os.getenv("USE_MINIO", "false").lower() in ("true", "True", "1") | ||
if USE_MINIO: | ||
AWS_S3_ENDPOINT_URL = os.getenv("MINIO_S3_ENDPOINT_URL", "http://storage:9000") | ||
AWS_S3_CUSTOM_DOMAIN = f"localhost:9000/{AWS_STORAGE_BUCKET_NAME}" | ||
AWS_S3_USE_SSL = False | ||
AWS_S3_SECURE_URLS = False | ||
AWS_S3_URL_PROTOCOL = "http:" | ||
|
||
else: | ||
AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com" | ||
AWS_S3_URL_PROTOCOL = "https:" | ||
|
||
# Static configuration | ||
# Add your own apps statics in this list | ||
STATICFILES_DIRS = [ | ||
os.path.join(BASE_DIR, "core", "static"), | ||
os.path.join(BASE_DIR, "users", "static"), | ||
os.path.join(BASE_DIR, "blog", "static"), | ||
] | ||
|
||
STATICFILES_FINDERS = [ | ||
"django.contrib.staticfiles.finders.AppDirectoriesFinder", | ||
] | ||
|
||
AWS_PUBLIC_MEDIA_LOCATION = "media/public" | ||
|
||
# Storages | ||
STORAGES = { | ||
"default": { | ||
"BACKEND": "config.storage_backends.PublicMediaStorage", | ||
}, | ||
"staticfiles": { | ||
"BACKEND": "config.storage_backends.StaticStorage", | ||
}, | ||
} | ||
# LOGIN / LOGOUT | ||
LOGIN_URL = "login" | ||
LOGIN_REDIRECT_URL = "home" | ||
|
@@ -245,10 +200,12 @@ def debug(request): | |
SMTP_PASSWORD = env("SMTP_PASSWORD", default="password") | ||
SMTP_SENDER_MAIL = env("SMTP_SENDER_MAIL", default="[email protected]") | ||
|
||
|
||
# RECAPTCHA | ||
# Recaptcha | ||
RECAPTCHA_ENABLED = env("RECAPTCHA_ENABLED", default=False) | ||
RECAPTCHA_SITE_KEY = env("RECAPTCHA_SITE_KEY", default="fake-key") | ||
RECAPTCHA_SITE_KEY = env("RECAPTCHA_SITE_KEY", default="") | ||
RECAPTCHA_SECRET_KEY = env("RECAPTCHA_SECRET_KEY", default="") | ||
RECAPTCHA_PROJECT_ID = env("RECAPTCHA_PROJECT_ID", default="") | ||
RECAPTCHA_GCLOUD_API_KEY = env("RECAPTCHA_GCLOUD_API_KEY", default="") | ||
|
||
if len(sys.argv) > 1 and sys.argv[1] == "test": | ||
logging.disable(logging.CRITICAL) |
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,56 @@ | ||
import os | ||
|
||
AWS_S3_OBJECT_PARAMETERS = { | ||
"CacheControl": "max-age=86400", | ||
} | ||
AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID", "") | ||
AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY", "") | ||
AWS_STORAGE_BUCKET_NAME = os.getenv("AWS_STORAGE_BUCKET_NAME", "") | ||
AWS_S3_REGION_NAME = os.getenv("AWS_S3_REGION_NAME", "us-east-2") | ||
AWS_DEFAULT_ACL = os.getenv("AWS_DEFAULT_ACL", None) | ||
AWS_STATIC_LOCATION = os.getenv("AWS_STATIC_LOCATION", "static") | ||
AWS_MEDIA_LOCATION = os.getenv("AWS_MEDIA_LOCATION", "media") | ||
|
||
if os.getenv("USE_GUNICORN", "true").lower() in ("false", "0"): | ||
USE_MINIO = False | ||
STATIC_URL = "/static/" | ||
MEDIA_URL = "/media/" | ||
STATIC_ROOT = os.path.join("/jandig", "static") | ||
MEDIA_ROOT = os.path.join("/jandig", "media") | ||
else: | ||
USE_MINIO = os.getenv("USE_MINIO", False) | ||
|
||
if USE_MINIO: | ||
AWS_S3_ENDPOINT_URL = os.getenv("MINIO_S3_ENDPOINT_URL", "http://storage:9000") | ||
AWS_S3_CUSTOM_DOMAIN = f"localhost:9000/{AWS_STORAGE_BUCKET_NAME}" | ||
AWS_S3_USE_SSL = False | ||
AWS_S3_SECURE_URLS = False | ||
AWS_S3_URL_PROTOCOL = "http:" | ||
|
||
else: | ||
AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com" | ||
AWS_S3_URL_PROTOCOL = "https:" | ||
|
||
# Static configuration | ||
# Add your own apps statics in this list | ||
STATICFILES_DIRS = [ | ||
os.path.join("/jandig/src", "core", "static"), | ||
os.path.join("/jandig/src", "users", "static"), | ||
os.path.join("/jandig/src", "blog", "static"), | ||
] | ||
|
||
STATICFILES_FINDERS = [ | ||
"django.contrib.staticfiles.finders.AppDirectoriesFinder", | ||
] | ||
|
||
AWS_PUBLIC_MEDIA_LOCATION = "media/public" | ||
|
||
if os.getenv("USE_GUNICORN", "true").lower() in ("true", "1"): | ||
STORAGES = { | ||
"default": { | ||
"BACKEND": "config.storage_backends.PublicMediaStorage", | ||
}, | ||
"staticfiles": { | ||
"BACKEND": "config.storage_backends.StaticStorage", | ||
}, | ||
} |
Oops, something went wrong.