Skip to content

Commit

Permalink
Merge branch 'boilerplate-generator' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
neoformit committed Dec 17, 2024
2 parents 7b4b222 + 9e16280 commit 614848e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions ansible/group_vars/webservers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ create_directories:
- "{{ config_root }}"
- "{{ django_root }}/app/media"
- "{{ django_root }}/app/logs"
- "{{ temp_dir }}"

# Admin user login for the web admin
admin_user:
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/galaxy_labs_engine/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ nginx_limit_requests_per_minute: 10
project_root: /home/ubuntu/labs-engine
config_root: /home/ubuntu/config
django_root: "{{ project_root }}/app"
temp_dir: /tmp/labs_engine

labs_engine:
templates:
Expand Down
2 changes: 2 additions & 0 deletions ansible/roles/galaxy_labs_engine/templates/.env.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ GITHUB_API_TOKEN={{ github_api_token }}
LOG_LEVEL_CONSOLE={{ django_log_levels.console|upper }}
LOG_LEVEL_CACHE={{ django_log_levels.cache|upper }}

TMP_DIR={{ temp_dir }}

{% if django_sentry_dns %}
SENTRY_DNS={{ django_sentry_dns }}
{% endif %}
2 changes: 1 addition & 1 deletion app/app/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
STATIC_ROOT = BASE_DIR / 'app/static'
MEDIA_ROOT = BASE_DIR / 'app/media'
LOG_ROOT = ensure_dir(BASE_DIR / 'app/logs')
TEMP_DIR = ensure_dir(BASE_DIR / 'app/temp')
TEMP_DIR = ensure_dir(os.getenv('TMP_DIR', '/tmp/labs_engine/'))
DEFAULT_EXPORTED_LAB_CONTENT_ROOT = (
f'http://{HOSTNAME}/static/labs/content/docs/base.yml')

Expand Down
4 changes: 2 additions & 2 deletions app/labs/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.utils.text import slugify
from pathlib import Path

HOURS_72 = 3 * 24 * 60 * 60
HOURS_1 = 60 * 60
ALPHANUMERIC = string.ascii_letters + string.digits
TEMPLATE_DIR = Path('labs/bootstrap')
TEMPLATES_TO_RENDER = [
Expand Down Expand Up @@ -111,6 +111,6 @@ def create_logo(data, output_dir):
def clean_dir(directory):
"""Delete directories that were created more than 7 days ago."""
for path in directory.iterdir():
if path.is_dir() and path.stat().st_ctime < time.time() - HOURS_72:
if path.is_dir() and path.stat().st_ctime < time.time() - HOURS_1:
shutil.rmtree(path)
return directory

0 comments on commit 614848e

Please sign in to comment.