Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Remove deprecated ENV to make it docker-compose friendly #79

Closed
wernight opened this issue Jun 30, 2016 · 2 comments
Closed

Remove deprecated ENV to make it docker-compose friendly #79

wernight opened this issue Jun 30, 2016 · 2 comments

Comments

@wernight
Copy link

It looks like it currently uses deprecated environment variables like REDIS_PORT_6379_TCP_ADDR in sentry.conf.py:

redis = env('SENTRY_REDIS_HOST') or (env('REDIS_PORT_6379_TCP_ADDR') and 'redis')

This for example doesn't work when using docker-compose.yml equivalent to the started commands:

version: '2'
services:
  sentry:
    image: sentry
    links:
      - postgres
      - redis
    environment:
      - SENTRY_SECRET_KEY=<generated-secret>
  redis:
    image: redis
  postgres:
    image: postgres
    environment:
      - POSTGRES_USER=sentry
      - POSTGRES_PASSWORD=secret
$ docker-compose run --rm sentry upgrade
sentry.runner.importer.ConfigurationError: Exception: Error: REDIS_PORT_6379_TCP_ADDR (or SENTRY_REDIS_HOST) is undefined, did you forget to `--link` a redis container?

Idea for a fix (but needs review):

redis = env('SENTRY_REDIS_HOST', 'redis')

Same for other similar variables and then it works (tested by specifying SENTRY_REDIS_HOST and SENTRY_POSTGRES_HOST but also some that are not shared like POSTGRES_ENV_POSTGRES_PASSWORD and POSTGRES_ENV_POSTGRES_USERNAME and that makes a lot more sense).

@mattrobenolt
Copy link
Contributor

What's wrong with just saying SENTRY_REDIS_HOST=redis? I would rather not make assumptions about connecting to a DNS record of simply "redis" automatically. That's potentially insecure and incorrect. It should be an explicit decision.

@wernight
Copy link
Author

Ok, may be improve the error when one provides SENTRY_REDIS_HOST but didn't specify SENTRY_POSTGRES_HOST it fails in Django without talking about missing that environment variable.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants