Add environment variables for Redis and Postgres hosts (#1641)

* Update to support additional env vars

- Added environment variables for:
  - Redis Host
  - Postgres Host
- Change `POSTGRES_PASSWORD` => `CVAT_POSTGRES_PASSWORD` to avoid collision with other scripts.

* Using ENV vars in supervisord.conf

* Fixing ENV vars.

* add env vars to docker-compose.yml

* merge supervisord.conf

* update docker-compose env var values

* Update CHANGELOG.md

Co-authored-by: Aleksandr Melnikov <aleksandr@onepanel.io>
Co-authored-by: Nikita Manovich <40690625+nmanovic@users.noreply.github.com>
main
Rush Tehrani 6 years ago committed by GitHub
parent 306e91c3d7
commit 3cb1f52bc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Throttling policy for unauthenticated users (<https://github.com/opencv/cvat/pull/1531>)
- Added default label color table for mask export (https://github.com/opencv/cvat/pull/1549)
- Added environment variables for Redis and Postgres hosts for Kubernetes deployment support (<https://github.com/opencv/cvat/pull/1641>)
- Added visual identification for unavailable formats (https://github.com/opencv/cvat/pull/1567)
### Changed

@ -11,9 +11,9 @@ INSTALLED_APPS += [
]
for key in RQ_QUEUES:
RQ_QUEUES[key]['HOST'] = 'cvat_redis'
RQ_QUEUES[key]['HOST'] = os.getenv('CVAT_REDIS_HOST', 'cvat_redis')
CACHEOPS_REDIS['host'] = 'cvat_redis'
CACHEOPS_REDIS['host'] = os.getenv('CVAT_REDIS_HOST', 'cvat_redis')
# Django-sendfile:
# https://github.com/johnsensible/django-sendfile
@ -25,9 +25,9 @@ SENDFILE_BACKEND = 'sendfile.backends.xsendfile'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'HOST': 'cvat_db',
'HOST': os.getenv('CVAT_POSTGRES_HOST', 'cvat_db'),
'NAME': 'cvat',
'USER': 'root',
'PASSWORD': os.getenv('POSTGRES_PASSWORD', ''),
'PASSWORD': os.getenv('CVAT_POSTGRES_PASSWORD', ''),
}
}

@ -53,6 +53,8 @@ services:
environment:
DJANGO_MODWSGI_EXTRA_ARGS: ""
ALLOWED_HOSTS: '*'
CVAT_REDIS_HOST: "cvat_redis"
CVAT_POSTGRES_HOST: "cvat_db"
volumes:
- cvat_data:/home/django/data
- cvat_keys:/home/django/keys

@ -23,26 +23,26 @@ priority=1
autorestart=true
[program:rqworker_default]
command=%(ENV_HOME)s/wait-for-it.sh redis:6379 -t 0 -- bash -ic \
command=%(ENV_HOME)s/wait-for-it.sh %(ENV_CVAT_REDIS_HOST)s:6379 -t 0 -- bash -ic \
"exec /usr/bin/python3 %(ENV_HOME)s/manage.py rqworker -v 3 default"
environment=SSH_AUTH_SOCK="/tmp/ssh-agent.sock"
numprocs=2
process_name=rqworker_default_%(process_num)s
[program:rqworker_low]
command=%(ENV_HOME)s/wait-for-it.sh redis:6379 -t 0 -- bash -ic \
command=%(ENV_HOME)s/wait-for-it.sh %(ENV_CVAT_REDIS_HOST)s:6379 -t 0 -- bash -ic \
"exec /usr/bin/python3 %(ENV_HOME)s/manage.py rqworker -v 3 low"
environment=SSH_AUTH_SOCK="/tmp/ssh-agent.sock"
numprocs=1
[program:git_status_updater]
command=%(ENV_HOME)s/wait-for-it.sh redis:6379 -t 0 -- bash -ic \
command=%(ENV_HOME)s/wait-for-it.sh %(ENV_CVAT_REDIS_HOST)s:6379 -t 0 -- bash -ic \
"/usr/bin/python3 ~/manage.py update_git_states"
environment=SSH_AUTH_SOCK="/tmp/ssh-agent.sock"
numprocs=1
[program:rqscheduler]
command=%(ENV_HOME)s/wait-for-it.sh redis:6379 -t 0 -- bash -ic \
command=%(ENV_HOME)s/wait-for-it.sh %(ENV_CVAT_REDIS_HOST)s:6379 -t 0 -- bash -ic \
"/usr/bin/python3 /usr/local/bin/rqscheduler --host redis -i 30"
environment=SSH_AUTH_SOCK="/tmp/ssh-agent.sock"
numprocs=1
@ -53,7 +53,7 @@ numprocs=1
; apps are dynamically loaded by an environment variable. It can lead to issues
; with docker cache. Thus it is necessary to run collectstatic here for such
; apps.
command=%(ENV_HOME)s/wait-for-it.sh db:5432 -t 0 -- bash -ic \
command=%(ENV_HOME)s/wait-for-it.sh %(ENV_CVAT_POSTGRES_HOST)s:5432 -t 0 -- bash -ic \
"rm -f /tmp/cvat-server/httpd.pid && /usr/bin/python3 ~/manage.py migrate && \
/usr/bin/python3 ~/manage.py collectstatic --no-input && \
exec /usr/bin/python3 $HOME/manage.py runmodwsgi --log-to-terminal --port 8080 \

Loading…
Cancel
Save