Skip to content

Commit

Permalink
[environ] cleaned up environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
junjuew committed May 12, 2020
1 parent 9aa2b2b commit 9bc8cc4
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 275 deletions.
34 changes: 22 additions & 12 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#!/bin/bash

################################################################
# Change the variables below for access and security.
################################################################
export DJANGO_ALLOWED_HOSTS="<host-name-of-your-server>"
export OPENTPOD_DB_PASSWORD="secret!change me!"
export OPENTPOD_REDIS_PASSWORD="secret!change me!"
export DJANGO_SECRET_KEY="secret!change me!"

################################################################
# Default environment setup.
# Do not change, unless you know what you are doing
################################################################

# python setup
export PYTHONDONTWRITEBYTECODE=1

Expand All @@ -9,23 +24,18 @@ export PORT=3001
export OPENTPOD_TESTING=false

# DB
export OPENTPOD_DB_HOST="localhost"
export OPENTPOD_DB="<db-name>"
export OPENTPOD_DB_PASSWORD="<db-password>"
export OPENTPOD_DB_PORT="<db-port>"
export OPENTPOD_DB_VIEWER_PORT="<db-viewer-port>"
export OPENTPOD_DB_HOST="opentpod-db"
export OPENTPOD_DB="opentpod"
export OPENTPOD_DB_PORT="5432"
export OPENTPOD_DB_VIEWER_PORT="18080"

# Redis
export OPENTPOD_REDIS_HOST="localhost"
export OPENTPOD_REDIS_PASSWORD="<redis-password>"
export OPENTPOD_REDIS_PORT="<redis-port>"
export OPENTPOD_REDIS_HOST="opentpod-redis"
export OPENTPOD_REDIS_PORT="6379"

# Django specific environs
export DJANGO_DEBUG=true
export DJANGO_SECRET_KEY="<djangoo-secret-key>"
export DJANGO_ALLOWED_HOSTS="<host-name-of-your-server>"
export DJANGO_DEBUG=false
export REDIS_URL="redis://:${OPENTPOD_REDIS_PASSWORD}@${OPENTPOD_REDIS_HOST}:${OPENTPOD_REDIS_PORT}/0"
export REDIS_CACHE_URL="redis://:${OPENTPOD_REDIS_PASSWORD}@${OPENTPOD_REDIS_HOST}:${OPENTPOD_REDIS_PORT}/1"
export DATABASE_URL="postgres://root:${OPENTPOD_DB_PASSWORD}@${OPENTPOD_DB_HOST}:${OPENTPOD_DB_PORT}/${OPENTPOD_DB}"
export CELERY_BROKER_URL=${REDIS_URL}
export USE_DOCKER=false
2 changes: 1 addition & 1 deletion CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Junjue Wang
Junjue Wang <junjuew@cs.cmu.edu>
3 changes: 0 additions & 3 deletions Procfile

This file was deleted.

24 changes: 0 additions & 24 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"rest_auth",
"rest_auth.registration",
"django_rq",
"django_celery_beat",
"drf_yasg", # for rest api swagger
"cacheops",
"sendfile",
Expand Down Expand Up @@ -312,29 +311,6 @@
"root": {"level": "INFO", "handlers": ["console"]},
}

# Celery
# ------------------------------------------------------------------------------
if USE_TZ:
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-timezone
CELERY_TIMEZONE = TIME_ZONE
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-broker_url
CELERY_BROKER_URL = env("CELERY_BROKER_URL")
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_backend
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-accept_content
CELERY_ACCEPT_CONTENT = ["json"]
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-task_serializer
CELERY_TASK_SERIALIZER = "json"
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_serializer
CELERY_RESULT_SERIALIZER = "json"
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-time-limit
# TODO: set to whatever value is adequate in your circumstances
CELERY_TASK_TIME_LIMIT = 5 * 60
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-soft-time-limit
# TODO: set to whatever value is adequate in your circumstances
CELERY_TASK_SOFT_TIME_LIMIT = 60
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#beat-scheduler
CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"
# django-allauth
# ------------------------------------------------------------------------------
ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", True)
Expand Down
11 changes: 0 additions & 11 deletions config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,8 @@
}
# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#internal-ips
INTERNAL_IPS = ["127.0.0.1", "10.0.2.2"]
if env("USE_DOCKER") == "yes":
import socket

hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
INTERNAL_IPS += [ip[:-1] + "1" for ip in ips]

# django-extensions
# ------------------------------------------------------------------------------
# https://django-extensions.readthedocs.io/en/latest/installation_instructions.html#configuration
INSTALLED_APPS += ["django_extensions"] # noqa F405

# Celery
# ------------------------------------------------------------------------------

# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-eager-propagates
CELERY_TASK_EAGER_PROPAGATES = False # True will make celery run tasks in main thread for dev
2 changes: 0 additions & 2 deletions docker-compose.debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ services:
- REDIS_URL
- REDIS_CACHE_URL
- DATABASE_URL
- CELERY_BROKER_URL
- USE_DOCKER
- NVIDIA_VISIBLE_DEVICES=all # needed for this to be cuda devices to be visible
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
depends_on:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ services:
- REDIS_CACHE_URL
- DATABASE_URL
- CELERY_BROKER_URL
- USE_DOCKER
- NVIDIA_VISIBLE_DEVICES=all # needed for this to be cuda devices to be visible
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
depends_on:
Expand Down
148 changes: 0 additions & 148 deletions docs/development-README.rst

This file was deleted.

69 changes: 0 additions & 69 deletions local.yml

This file was deleted.

3 changes: 0 additions & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ python-slugify==3.0.2 # https://github.com/un33k/python-slugify
Pillow==6.1.0 # https://github.com/python-pillow/Pillow
argon2-cffi==19.1.0 # https://github.com/hynek/argon2_cffi
redis==3.2.1 # https://github.com/antirez/redis
celery==4.3.0 # pyup: < 5.0 # https://github.com/celery/celery
django-celery-beat==1.5.0 # https://github.com/celery/django-celery-beat
flower==0.9.3 # https://github.com/mher/flower

# Django
# ------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ flake8==3.7.8 # https://github.com/PyCQA/flake8
coverage==4.5.3 # https://github.com/nedbat/coveragepy
black==19.3b0 # https://github.com/ambv/black
pylint-django==2.0.11 # https://github.com/PyCQA/pylint-django
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery

# Django
# ------------------------------------------------------------------------------
Expand Down

0 comments on commit 9bc8cc4

Please sign in to comment.