Skip to content

Commit

Permalink
fix: failfast if LIBRARY_ROOT is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
alee committed Mar 13, 2024
1 parent 987241e commit 704d91e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
11 changes: 0 additions & 11 deletions deploy/conf/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,28 @@ DB_NAME=comsesnet
DB_USER=comsesnet
DB_HOST=db
DB_PORT=5432
DB_PASSWORD=
CLEAN_DATABASE="false" # allowed values: "true" or "false"

# elastic search
ES_VERSION=7.17.18

# captcha
HCAPTCHA_SITEKEY=
# HCAPTCHA_SECRET=

# discourse
DISCOURSE_BASE_URL=
DISCOURSE_API_USERNAME=

# email
EMAIL_SUBJECT_PREFIX=[CoMSES Net]
# MAILGUN_API_KEY=
MAILGUN_SENDER_DOMAIN=

# logging
LOG_DIRECTORY=/shared/logs
SENTRY_DSN=

# secrets
# DISCOURSE_SSO_SECRET=
# DISCOURSE_API_KEY=
# django secret key
# SECRET_KEY=

GITHUB_CLIENT_ID=
# GITHUB_CLIENT_SECRET=
ORCID_CLIENT_ID=
# ORCID_CLIENT_SECRET=

# storage
DATA_ROOT=/shared
Expand Down
6 changes: 4 additions & 2 deletions django/core/settings/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,11 @@ def is_test(self):

SHARE_DIR = "/shared"
LOG_DIRECTORY = os.getenv("LOG_DIRECTORY", os.path.join(BASE_DIR, "logs"))
LIBRARY_ROOT = os.getenv("LIBRARY_ROOT", os.path.join(BASE_DIR, "library"))
LIBRARY_ROOT = os.getenv("LIBRARY_ROOT")
if not LIBRARY_ROOT:
raise ValueError("LIBRARY_ROOT not configured")
PREVIOUS_SHARE_ROOT = os.path.join(SHARE_DIR, ".latest")
REPOSITORY_ROOT = os.getenv("REPOSITORY_ROOT", os.path.join(BASE_DIR, "repository"))
REPOSITORY_ROOT = os.getenv("REPOSITORY_ROOT")
BORG_ROOT = "/shared/backups/repo"
BACKUP_ROOT = "/shared/backups"
EXTRACT_ROOT = "/shared/extract"
Expand Down
2 changes: 1 addition & 1 deletion django/deploy/cron.daily/backup
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

export DJANGO_SETTINGS_MODULE="core.settings.production"
/usr/local/bin/inv -r /code db.backup borg.backup > /var/log/comses-backup.log 2>&1
/usr/local/bin/inv -r /code db.backup borg.backup >> /shared/logs/comses-backup.log 2>&1

1 comment on commit 704d91e

@sgfost
Copy link
Contributor

@sgfost sgfost commented on 704d91e Mar 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote we hardcode it to /shared/library, otherwise the - ./docker/shared/library:/library volume mount in nginx + nginx conf needs to be dynamic as well

Please sign in to comment.