Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"system.secret-key" MUST be set, went wrong in the web container #177

Closed
ignite-404 opened this issue Apr 27, 2019 · 27 comments
Closed

"system.secret-key" MUST be set, went wrong in the web container #177

ignite-404 opened this issue Apr 27, 2019 · 27 comments

Comments

@ignite-404
Copy link

I follow the instruction carefully, and had a second try and got the same issue

Mac OS Mojave 10.14.3

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/sentry/wsgi.py", line 21, in <module>
    configure()
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/__init__.py", line 125, in configure
    configure(ctx, py, yaml, skip_service_validation)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/settings.py", line 156, in configure
    skip_service_validation=skip_service_validation
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 274, in initialize_app
    apply_legacy_settings(settings)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 510, in apply_legacy_settings
    "`system.secret-key` MUST be set. Use 'sentry config generate-secret-key' to get one."
sentry.runner.importer.ConfigurationError: `system.secret-key` MUST be set. Use 'sentry config generate-secret-key' to get one.
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. GAME OVER ***
OOPS ! failed loading app in worker 1 (pid 19)
Sat Apr 27 00:44:31 2019 - need-app requested, destroying the instance...
OOPS ! failed loading app in worker 2 (pid 20)
Sat Apr 27 00:44:31 2019 - need-app requested, destroying the instance...
OOPS ! failed loading app in worker 3 (pid 21)
Sat Apr 27 00:44:31 2019 - need-app requested, destroying the instance...
goodbye to uWSGI.
@ghost
Copy link

ghost commented Apr 27, 2019

m2

@ignite-404
Copy link
Author

sorry, i ignored config.yml

@omidraha
Copy link
Contributor

same as me, @hiwjcn how do you solve this issue?

@omidraha
Copy link
Contributor

omidraha commented Apr 28, 2019

I follow the instruction, and add generated secret key value to .env as SENTRY_SECRET_KEY.

Traceback:

web_1        | Traceback (most recent call last):
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/wsgi.py", line 21, in <module>
web_1        |     configure()
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/__init__.py", line 125, in configure
web_1        |     configure(ctx, py, yaml, skip_service_validation)
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/settings.py", line 156, in configure
web_1        |     skip_service_validation=skip_service_validation
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 274, in initialize_app
web_1        |     apply_legacy_settings(settings)
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 510, in apply_legacy_settings
web_1        |     "`system.secret-key` MUST be set. Use 'sentry config generate-secret-key' to get one."
web_1        | sentry.runner.importer.ConfigurationError: `system.secret-key` MUST be set. Use 'sentry config generate-secret-key' to get one.
web_1        | unable to load app 0 (mountpoint='') (callable not found or import error)
web_1        | *** no app loaded. GAME OVER ***
web_1        | SIGINT/SIGQUIT received...killing workers...
web_1        | Traceback (most recent call last):
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/wsgi.py", line 21, in <module>
web_1        |     configure()
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/__init__.py", line 125, in configure
web_1        |     configure(ctx, py, yaml, skip_service_validation)
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/settings.py", line 156, in configure
web_1        |     skip_service_validation=skip_service_validation
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 274, in initialize_app
web_1        |     apply_legacy_settings(settings)
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 510, in apply_legacy_settings
web_1        |     "`system.secret-key` MUST be set. Use 'sentry config generate-secret-key' to get one."
web_1        | sentry.runner.importer.ConfigurationError: `system.secret-key` MUST be set. Use 'sentry config generate-secret-key' to get one.
web_1        | unable to load app 0 (mountpoint='') (callable not found or import error)
web_1        | *** no app loaded. GAME OVER ***
web_1        | Traceback (most recent call last):
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/wsgi.py", line 21, in <module>
web_1        |     configure()
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/__init__.py", line 125, in configure
web_1        |     configure(ctx, py, yaml, skip_service_validation)
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/settings.py", line 156, in configure
web_1        |     skip_service_validation=skip_service_validation
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 274, in initialize_app
web_1        |     apply_legacy_settings(settings)
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 510, in apply_legacy_settings
web_1        |     "`system.secret-key` MUST be set. Use 'sentry config generate-secret-key' to get one."
web_1        | sentry.runner.importer.ConfigurationError: `system.secret-key` MUST be set. Use 'sentry config generate-secret-key' to get one.
web_1        | unable to load app 0 (mountpoint='') (callable not found or import error)
web_1        | *** no app loaded. GAME OVER ***
web_1        | OOPS ! failed loading app in worker 3 (pid 22)
web_1        | Sun Apr 28 06:01:56 2019 - need-app requested, destroying the instance...
web_1        | OOPS ! failed loading app in worker 1 (pid 20)
web_1        | Sun Apr 28 06:01:57 2019 - need-app requested, destroying the instance...
web_1        | OOPS ! failed loading app in worker 2 (pid 21)
web_1        | Sun Apr 28 06:01:57 2019 - need-app requested, destroying the instance...
web_1        | goodbye to uWSGI.
web_1        | 06:02:02 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured.

@40huo
Copy link

40huo commented Apr 28, 2019

same problem

@mattrobenolt
Copy link
Contributor

Is this happening after #167 by any chance?

@40huo
Copy link

40huo commented Apr 29, 2019

I just followed README.

docker volume create --name=sentry-data && docker volume create --name=sentry-postgres - Make our local database and sentry volumes Docker volumes have to be created manually, as they are declared as external to be more durable.
cp -n .env.example .env - create env config file
docker-compose build - Build and tag the Docker services
docker-compose run --rm web config generate-secret-key - Generate a secret key. Add it to .env as SENTRY_SECRET_KEY.
docker-compose run --rm web upgrade - Build the database. Use the interactive prompts to create a user account.
docker-compose up -d - Lift all services (detached/background mode).
Access your instance at localhost:9000!

And it still said there's a secret_key problem.

@omidraha
Copy link
Contributor

Is this happening after #167 by any chance?

I confirm this issue is related to 4 last commit.
There is no problem until in this commit.

@ignite-404
Copy link
Author

ignite-404 commented Apr 29, 2019

@omidraha I paste the secret key into config.yml and this issue fixed.

but this operation were not be present in the guide section in readme file

@omidraha
Copy link
Contributor

omidraha commented Apr 29, 2019

@omidraha I paste the secret key into config.yml and this issue fixed.

but this operation were not be present in the guide section in readme file

I did, as value of this line, but that did not solve.
Please reopen this issue for others. (and unsubscribe your self if you don't want to follow)

@40huo
Copy link

40huo commented Apr 29, 2019

@omidraha I paste the secret key into config.yml and this issue fixed.
but this operation were not be present in the guide section in readme file

I did, as value of this line, but that did not solve.
Please reopen this issue for others. (and unsubscribe your self if you don't want to follow)

change config.yml and docker-compose build again, then docker-compose up -d seems ok.

@mattrobenolt
Copy link
Contributor

I’ll look into this today and try to reproduce and fix.

@mattrobenolt mattrobenolt reopened this Apr 29, 2019
@timduly4
Copy link

@mattrobenolt I'm having the same issue, but following a parallel (?) line of instructions located at: https://docs.sentry.io/server/installation/docker/

Here are a few notes for starting from scratch on a EC2 instance to reproduce the error:

ami-0080e4c5bc078760e
t2.large

Upgrades:

$ sudo yum update -y
$ sudo yum install git -y
$ sudo yum install docker -y
$ sudo service docker start
$ git clone https://github.com/getsentry/onpremise.git
$ cd onpremise
$ sudo make build
$ sudo docker run --detach --name sentry-redis redis:3.2-alpine
$ sudo docker run --detach --name sentry-postgres --env POSTGRES_PASSWORD=secret --env POSTGRES_USER=sentry  postgres:9.5

Sanity Check:

$ sudo docker run --rm sentry-onpremise --help
$ sudo docker run --rm sentry-onpremise config generate-secret-key
$ export SENTRY_SECRET_KEY=<returned_secret_from_above>
$ sudo docker run --link sentry-redis:redis --link sentry-postgres:postgres --env SENTRY_SECRET_KEY=${SENTRY_SECRET_KEY} --rm -it sentry-onpremise upgrade
<Enter in configure username/password>
$ sudo docker run --link sentry-redis:redis --link sentry-postgres:postgres --env SENTRY_SECRET_KEY=${SENTRY_SECRET_KEY} --name sentry-web-01 --publish 9000:9000 sentry-onpremise run web

Error:
Tue Apr 30 04:40:22 2019 - need-app requested, destroying the instance...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/sentry/wsgi.py", line 21, in <module>
    configure()
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/__init__.py", line 125, in configure
    configure(ctx, py, yaml, skip_service_validation)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/settings.py", line 156, in configure
    skip_service_validation=skip_service_validation
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 274, in initialize_app
    apply_legacy_settings(settings)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 510, in apply_legacy_settings
    "`system.secret-key` MUST be set. Use 'sentry config generate-secret-key' to get one."
sentry.runner.importer.ConfigurationError: `system.secret-key` MUST be set. Use 'sentry config generate-secret-key' to get one.

Any idea what might be the issue?

@jwillmer
Copy link
Contributor

jwillmer commented May 2, 2019

@mattrobenolt is on it: #178 (comment)

@shresthsumanifesca
Copy link

@omidraha I paste the secret key into config.yml and this issue fixed.
but this operation were not be present in the guide section in readme file

I did, as value of this line, but that did not solve.
Please reopen this issue for others. (and unsubscribe your self if you don't want to follow)

change config.yml and docker-compose build again, then docker-compose up -d seems ok.

This fixed the issue.

@jwillmer
Copy link
Contributor

jwillmer commented May 3, 2019

@omidraha I paste the secret key into config.yml and this issue fixed.
but this operation were not be present in the guide section in readme file

I did, as value of this line, but that did not solve.
Please reopen this issue for others. (and unsubscribe your self if you don't want to follow)

change config.yml and docker-compose build again, then docker-compose up -d seems ok.

This fixed the issue.

This is not a fix, it is a workaround.

@dmugtasimov
Copy link

Here are changes I made for debugging:

dmugtasimov@dmugtasimov-Latitude-E5550 ~/gitrep/ngineered-studio/dolphin-sentry $ git diff
diff --git a/docker-compose.yml b/docker-compose.yml
index 39adce7..d8a695b 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -9,7 +9,7 @@
 version: '3.4'
 
 x-defaults: &defaults
-  restart: unless-stopped
+#  restart: unless-stopped
   image: dolphin-sentry:current
   depends_on:
     - redis
diff --git a/main/sentry.conf.py b/main/sentry.conf.py
index 0a0fde1..c6aeaac 100644
--- a/main/sentry.conf.py
+++ b/main/sentry.conf.py
@@ -338,6 +338,9 @@ if 'SENTRY_RUNNING_UWSGI' not in os.environ and len(secret_key) < 32:
 # Grab the easy configuration first - these are all fixed
 # key=value with no logic behind them
 bind_env_config()
+import os
+print 'ENVIRON', os.getpid(), repr(os.environ)
+print 'OPTS', os.getpid(), repr(SENTRY_OPTIONS)
 
 # If you specify a MAILGUN_API_KEY, you definitely want EMAIL_REPLIES
 if SENTRY_OPTIONS.get('mail.mailgun-api-key'):

Log:

ENVIRON 15 {'PYTHONIOENCODING': 'UTF-8', 'SENTRY_SECRET_KEY': '!y42)p1#bm+!@btq_&*+v9^ssne@x-4n2llo(8j*e+b_8q7o#x', 'SENTRY_EMAIL_PORT': '587', 'HOME': '/home/sentry', 'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'LANG': 'C.UTF-8', 'affinity:container': '=b7f99bec5681fe82d61870fa64c3ffc7cd9e21ad3babb5d83ca640e50e887a6d', 'PYTHON_VERSION': '2.7.16', 'SHLVL': '0', 'PYTHON_PIP_VERSION': '19.1', 'SENTRY_EMAIL_USE_TLS': '1', 'DJANGO_SETTINGS_MODULE': 'sentry_config', 'SENTRY_EMAIL_HOST': 'smtp.sendgrid.net', 'SENTRY_CONF': u'/etc/sentry', 'SENTRY_VERSION': '9.1.1', 'GPG_KEY': 'C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF', 'PYTHONPATH': '/usr/src/sentry', 'SENTRY_EMAIL_PASSWORD': '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', 'SENTRY_SERVER_EMAIL': 'sentry@splashwithdolphin.com', 'SENTRY_POSTGRES_HOST': 'postgres', 'SENTRY_REDIS_HOST': 'redis', 'PIP_DISABLE_PIP_VERSION_CHECK': 'on', 'HOSTNAME': 'd1952e92f16e', 'PWD': '/usr/src/sentry', 'PIP_NO_CACHE_DIR': 'off', 'SENTRY_FILESTORE_DIR': '/var/lib/sentry/files', 'SENTRY_MEMCACHED_HOST': 'memcached', 'SENTRY_EMAIL_USER': 'apikey'}
OPTS 15 {'redis.clusters': {'default': {'hosts': {0: {'host': 'redis', 'password': '', 'db': '0', 'port': '6379'}}}}, 'mail.username': 'apikey', 'mail.port': 587, 'mail.use-tls': True, 'filestore.backend': 'filesystem', 'mail.password': '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', 'filestore.options': {'location': '/var/lib/sentry/files'}, 'system.secret-key': '!y42)p1#bm+!@btq_&*+v9^ssne@x-4n2llo(8j*e+b_8q7o#x', 'mail.from': 'sentry@splashwithdolphin.com', 'mail.host': 'smtp.sendgrid.net'}
17:17:42 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured.
17:17:47 [INFO] sentry.plugins.github: apps-not-configured
*** Starting uWSGI 2.0.18 (64bit) on [Fri May  3 17:17:47 2019] ***
compiled with version: 6.3.0 20170516 on 25 April 2019 01:46:28
os: Linux-4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017
nodename: d1952e92f16e
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /usr/src/sentry
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: enabled
uwsgi socket 0 bound to TCP address 0.0.0.0:9000 fd 3
Python version: 2.7.16 (default, Mar 27 2019, 09:57:44)  [GCC 6.3.0 20170516]
Set PythonHome to /usr/local
Python main interpreter initialized at 0x5587f98fdf50
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
setting request body buffering size to 65536 bytes
mapped 1924480 bytes (1879 KB) for 12 cores
*** Operational MODE: preforking+threaded ***
spawned uWSGI master process (pid: 15)
spawned uWSGI worker 1 (pid: 20, cores: 4)
spawned uWSGI worker 2 (pid: 21, cores: 4)
spawned uWSGI worker 3 (pid: 22, cores: 4)
ENVIRON 20 {'UWSGI_THREADS': '4', 'PYTHONIOENCODING': 'UTF-8', 'UWSGI_HTTP_SOCKET': '0.0.0.0:9000', 'UWSGI_HTTP_TIMEOUT': '30', 'SENTRY_EMAIL_PORT': '587', 'UWSGI_THUNDER_LOCK': 'true', 'SENTRY_SKIP_BACKEND_VALIDATION': '1', 'RUST_BACKTRACE': '1', 'UWSGI_VACUUM': 'true', 'HOME': '/home/sentry', 'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'UWSGI_WORKERS': '3', 'UWSGI_PROCNAME_PREFIX_SPACED': '[Sentry]', 'LANG': 'C.UTF-8', 'affinity:container': '=b7f99bec5681fe82d61870fa64c3ffc7cd9e21ad3babb5d83ca640e50e887a6d', 'TZ': 'UTC', 'PYTHON_VERSION': '2.7.16', 'UWSGI_VIRTUALENV': '/usr/local', 'SHLVL': '0', 'UWSGI_SINGLE_INTERPRETER': 'true', 'PYTHON_PIP_VERSION': '19.1', 'UWSGI_DISABLE_LOGGING': 'false', 'UWSGI_MODULE': 'sentry.wsgi:application', 'UWSGI_PROTOCOL': 'http', 'UWSGI_LOG_X_FORWARDED_FOR': 'false', 'SENTRY_EMAIL_USE_TLS': '1', 'SENTRY_RUNNING_UWSGI': '1', 'UWSGI_LAZY_APPS': 'true', 'DJANGO_SETTINGS_MODULE': 'sentry_config', 'SENTRY_EMAIL_HOST': 'smtp.sendgrid.net', 'SENTRY_CONF': '/etc/sentry', 'SENTRY_VERSION': '9.1.1', 'GPG_KEY': 'C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF', 'UWSGI_ORIGINAL_PROC_NAME': 'uwsgi', 'UWSGI_GID': '999', 'PYTHONPATH': '/usr/src/sentry', 'UWSGI_LIMIT_POST': '20971520', 'UWSGI_LOG_FORMAT': '%(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)"', 'UWSGI_NEED_APP': 'true', 'UWSGI_UID': '999', 'UWSGI_IGNORE_SIGPIPE': 'true', 'UWSGI_MASTER': 'true', 'SENTRY_EMAIL_PASSWORD': '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', 'SENTRY_SERVER_EMAIL': 'sentry@splashwithdolphin.com', 'UWSGI_RELOAD_ON_RSS': '600', 'UWSGI_BUFFER_SIZE': '32768', 'UWSGI_POST_BUFFERING': '65536', 'UWSGI_AUTO_PROCNAME': 'true', 'UWSGI_ENABLE_THREADS': 'true', 'UWSGI_DISABLE_WRITE_EXCEPTION': 'true', 'UWSGI_MEMORY_REPORT': 'true', 'PIP_DISABLE_PIP_VERSION_CHECK': 'on', 'HOSTNAME': 'd1952e92f16e', 'UWSGI_RELOADS': '0', 'PWD': '/usr/src/sentry', 'UWSGI_IGNORE_WRITE_ERRORS': 'true', 'PIP_NO_CACHE_DIR': 'off', 'UWSGI_DIE_ON_TERM': 'true', 'SENTRY_EMAIL_USER': 'apikey'}
OPTS 20 {'mail.use-tls': True, 'mail.username': 'apikey', 'mail.port': 587, 'redis.clusters': {'default': {'hosts': {0: {'host': 'redis', 'password': '', 'db': '0', 'port': '6379'}}}}, 'filestore.backend': 'filesystem', 'mail.password': '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', 'filestore.options': {'location': '/var/lib/sentry/files'}, 'mail.from': 'sentry@splashwithdolphin.com', 'mail.host': 'smtp.sendgrid.net'}
ENVIRON 21 {'UWSGI_THREADS': '4', 'PYTHONIOENCODING': 'UTF-8', 'UWSGI_HTTP_SOCKET': '0.0.0.0:9000', 'UWSGI_HTTP_TIMEOUT': '30', 'SENTRY_EMAIL_PORT': '587', 'UWSGI_THUNDER_LOCK': 'true', 'SENTRY_SKIP_BACKEND_VALIDATION': '1', 'RUST_BACKTRACE': '1', 'UWSGI_VACUUM': 'true', 'HOME': '/home/sentry', 'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'UWSGI_WORKERS': '3', 'UWSGI_PROCNAME_PREFIX_SPACED': '[Sentry]', 'LANG': 'C.UTF-8', 'affinity:container': '=b7f99bec5681fe82d61870fa64c3ffc7cd9e21ad3babb5d83ca640e50e887a6d', 'TZ': 'UTC', 'PYTHON_VERSION': '2.7.16', 'UWSGI_VIRTUALENV': '/usr/local', 'SHLVL': '0', 'UWSGI_SINGLE_INTERPRETER': 'true', 'PYTHON_PIP_VERSION': '19.1', 'UWSGI_DISABLE_LOGGING': 'false', 'UWSGI_MODULE': 'sentry.wsgi:application', 'UWSGI_PROTOCOL': 'http', 'UWSGI_LOG_X_FORWARDED_FOR': 'false', 'SENTRY_EMAIL_USE_TLS': '1', 'SENTRY_RUNNING_UWSGI': '1', 'UWSGI_LAZY_APPS': 'true', 'DJANGO_SETTINGS_MODULE': 'sentry_config', 'SENTRY_EMAIL_HOST': 'smtp.sendgrid.net', 'SENTRY_CONF': '/etc/sentry', 'SENTRY_VERSION': '9.1.1', 'GPG_KEY': 'C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF', 'UWSGI_ORIGINAL_PROC_NAME': 'uwsgi', 'UWSGI_GID': '999', 'PYTHONPATH': '/usr/src/sentry', 'UWSGI_LIMIT_POST': '20971520', 'UWSGI_LOG_FORMAT': '%(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)"', 'UWSGI_NEED_APP': 'true', 'UWSGI_UID': '999', 'UWSGI_IGNORE_SIGPIPE': 'true', 'UWSGI_MASTER': 'true', 'SENTRY_EMAIL_PASSWORD': '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', 'SENTRY_SERVER_EMAIL': 'sentry@splashwithdolphin.com', 'UWSGI_RELOAD_ON_RSS': '600', 'UWSGI_BUFFER_SIZE': '32768', 'UWSGI_POST_BUFFERING': '65536', 'UWSGI_AUTO_PROCNAME': 'true', 'UWSGI_ENABLE_THREADS': 'true', 'UWSGI_DISABLE_WRITE_EXCEPTION': 'true', 'UWSGI_MEMORY_REPORT': 'true', 'PIP_DISABLE_PIP_VERSION_CHECK': 'on', 'HOSTNAME': 'd1952e92f16e', 'UWSGI_RELOADS': '0', 'PWD': '/usr/src/sentry', 'UWSGI_IGNORE_WRITE_ERRORS': 'true', 'PIP_NO_CACHE_DIR': 'off', 'UWSGI_DIE_ON_TERM': 'true', 'SENTRY_EMAIL_USER': 'apikey'}
OPTS 21 {'mail.use-tls': True, 'mail.username': 'apikey', 'mail.port': 587, 'redis.clusters': {'default': {'hosts': {0: {'host': 'redis', 'password': '', 'db': '0', 'port': '6379'}}}}, 'filestore.backend': 'filesystem', 'mail.password': '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', 'filestore.options': {'location': '/var/lib/sentry/files'}, 'mail.from': 'sentry@splashwithdolphin.com', 'mail.host': 'smtp.sendgrid.net'}
ENVIRON 22 {'UWSGI_THREADS': '4', 'PYTHONIOENCODING': 'UTF-8', 'UWSGI_HTTP_SOCKET': '0.0.0.0:9000', 'UWSGI_HTTP_TIMEOUT': '30', 'SENTRY_EMAIL_PORT': '587', 'UWSGI_THUNDER_LOCK': 'true', 'SENTRY_SKIP_BACKEND_VALIDATION': '1', 'RUST_BACKTRACE': '1', 'UWSGI_VACUUM': 'true', 'HOME': '/home/sentry', 'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'UWSGI_WORKERS': '3', 'UWSGI_PROCNAME_PREFIX_SPACED': '[Sentry]', 'LANG': 'C.UTF-8', 'affinity:container': '=b7f99bec5681fe82d61870fa64c3ffc7cd9e21ad3babb5d83ca640e50e887a6d', 'TZ': 'UTC', 'PYTHON_VERSION': '2.7.16', 'UWSGI_VIRTUALENV': '/usr/local', 'SHLVL': '0', 'UWSGI_SINGLE_INTERPRETER': 'true', 'PYTHON_PIP_VERSION': '19.1', 'UWSGI_DISABLE_LOGGING': 'false', 'UWSGI_MODULE': 'sentry.wsgi:application', 'UWSGI_PROTOCOL': 'http', 'UWSGI_LOG_X_FORWARDED_FOR': 'false', 'SENTRY_EMAIL_USE_TLS': '1', 'SENTRY_RUNNING_UWSGI': '1', 'UWSGI_LAZY_APPS': 'true', 'DJANGO_SETTINGS_MODULE': 'sentry_config', 'SENTRY_EMAIL_HOST': 'smtp.sendgrid.net', 'SENTRY_CONF': '/etc/sentry', 'SENTRY_VERSION': '9.1.1', 'GPG_KEY': 'C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF', 'UWSGI_ORIGINAL_PROC_NAME': 'uwsgi', 'UWSGI_GID': '999', 'PYTHONPATH': '/usr/src/sentry', 'UWSGI_LIMIT_POST': '20971520', 'UWSGI_LOG_FORMAT': '%(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)"', 'UWSGI_NEED_APP': 'true', 'UWSGI_UID': '999', 'UWSGI_IGNORE_SIGPIPE': 'true', 'UWSGI_MASTER': 'true', 'SENTRY_EMAIL_PASSWORD': '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', 'SENTRY_SERVER_EMAIL': 'sentry@splashwithdolphin.com', 'UWSGI_RELOAD_ON_RSS': '600', 'UWSGI_BUFFER_SIZE': '32768', 'UWSGI_POST_BUFFERING': '65536', 'UWSGI_AUTO_PROCNAME': 'true', 'UWSGI_ENABLE_THREADS': 'true', 'UWSGI_DISABLE_WRITE_EXCEPTION': 'true', 'UWSGI_MEMORY_REPORT': 'true', 'PIP_DISABLE_PIP_VERSION_CHECK': 'on', 'HOSTNAME': 'd1952e92f16e', 'UWSGI_RELOADS': '0', 'PWD': '/usr/src/sentry', 'UWSGI_IGNORE_WRITE_ERRORS': 'true', 'PIP_NO_CACHE_DIR': 'off', 'UWSGI_DIE_ON_TERM': 'true', 'SENTRY_EMAIL_USER': 'apikey'}
OPTS 22 {'mail.use-tls': True, 'mail.username': 'apikey', 'mail.port': 587, 'redis.clusters': {'default': {'hosts': {0: {'host': 'redis', 'password': '', 'db': '0', 'port': '6379'}}}}, 'filestore.backend': 'filesystem', 'mail.password': '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', 'filestore.options': {'location': '/var/lib/sentry/files'}, 'mail.from': 'sentry@splashwithdolphin.com', 'mail.host': 'smtp.sendgrid.net'}

You may see that SENTRY_SECRET_KEY works well for main uWSGI process, but then it get removed from environment variables for uWSGI worker processes (note PIDs are different in last 3 entries).

I suggest to use different variable name SENTRY_SECRET_KEY_ as workaround:

dmugtasimov@dmugtasimov-Latitude-E5550 ~/gitrep/ngineered-studio/dolphin-sentry $ git diff
diff --git a/main/sentry.conf.py b/main/sentry.conf.py
index 0a0fde1..32536ad 100644
--- a/main/sentry.conf.py
+++ b/main/sentry.conf.py
@@ -283,7 +283,7 @@ ENV_CONFIG_MAPPING = {
     'SENTRY_SERVER_EMAIL': 'mail.from',
     'SENTRY_ENABLE_EMAIL_REPLIES': 'mail.enable-replies',
     'SENTRY_SMTP_HOSTNAME': 'mail.reply-hostname',
-    'SENTRY_SECRET_KEY': 'system.secret-key',
+    'SENTRY_SECRET_KEY_': 'system.secret-key',

@kumy
Copy link

kumy commented May 3, 2019

I just upgraded my installation and fall into the same issue :(

@dmugtasimov
Copy link

I just upgraded my installation and fall into the same issue :(

Some experience developers say: do not upgrade just to have a latest version, have a good reason for upgrade instead. You can you my workaround above.

@kumy
Copy link

kumy commented May 3, 2019

(That's not prod) I've upgraded because I was unable to bulk delete issues.

 172.18.0.1 - - [03/May/2019:16:07:12 +0000] "GET /api/0/projects/geokrety/geokrety-legacy/issues/?sort=date&shortIdLookup=1&environment=kumy&limit=25&statsPeriod=24h&query=is%3Aunresolved&cursor=1556897291000:0:1 HTTP/1.1" 200 803 "https://sentry.kumy.org/geokrety/geokrety-legacy/?environment=kumy" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0"
 Traceback (most recent call last):
   File "/usr/local/lib/python2.7/site-packages/sentry/api/base.py", line 90, in handle_exception
     response = super(Endpoint, self).handle_exception(exc)
   File "/usr/local/lib/python2.7/site-packages/sentry/api/base.py", line 190, in dispatch
     response = handler(request, *args, **kwargs)
   File "/usr/local/lib/python2.7/site-packages/sentry/api/endpoints/organization_group_index.py", line 292, in delete
     search_fn,
   File "/usr/local/lib/python2.7/site-packages/sentry/api/helpers/group_index.py", line 414, in delete_groups
     'paginator_options': {'max_limit': 1000},
   File "/usr/local/lib/python2.7/site-packages/sentry/api/endpoints/organization_group_index.py", line 40, in _search
     result = search.query(**query_kwargs)
   File "/usr/local/lib/python2.7/site-packages/sentry/search/django/backend.py", line 404, in query
     paginator_options, search_filters, **parameters)
   File "/usr/local/lib/python2.7/site-packages/sentry/search/snuba/backend.py", line 302, in _query
     search_filters=search_filters,
   File "/usr/local/lib/python2.7/site-packages/sentry/search/snuba/backend.py", line 466, in snuba_search
     sample=1,  # Don't use clickhouse sampling, even when in turbo mode.
   File "/usr/local/lib/python2.7/site-packages/sentry/utils/snuba.py", line 477, in raw_query
     raise SnubaError(err)
 SnubaError: HTTPConnectionPool(host='localhost', port=1218): Max retries exceeded with url: /query (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8066e09690>: Failed to establish a new connection: [Errno 111] Connection refused',))

However, renaming SENTRY_SECRET_KEY to SENTRY_SECRET_KEY_, then rebuild the image didn't fixed the issue for me. Am I using the wrong workaround?

@dmugtasimov
Copy link

dmugtasimov commented May 3, 2019

You should also provide SENTRY_SECRET_KEY_ in the environment. So there are two places for change in that sentry.conf.py and in your .env file (or however else you provide env vars for your container)

@kumy
Copy link

kumy commented May 3, 2019

🤦‍♂️

@dmugtasimov thanks

@kep-w
Copy link

kep-w commented May 6, 2019

@omidraha I paste the secret key into config.yml and this issue fixed.
but this operation were not be present in the guide section in readme file

I did, as value of this line, but that did not solve.
Please reopen this issue for others. (and unsubscribe your self if you don't want to follow)

@omidraha I use this method and it fixed. try to paste the key to where the value 'changme': system.secret-key: 'changme'
docker-compose down and then docker-compose up -d

@nephthys
Copy link

nephthys commented May 6, 2019

Someone was able to complete the installation entirely of Sentry following this error? I didn't succeed yesterday and I'm stuck... Thanks.

MaicolBen pushed a commit to hinthealth/onpremise that referenced this issue Jul 20, 2020
@MaicolBen
Copy link

It started happening to me as well after upgrading (on-build docker tag) 😞

@BYK
Copy link
Member

BYK commented Nov 25, 2020

@MaicolBen you should not be using the on-build tags if you are using a recent version of this repo. We have moved away from them a very long time ago.

Please file a new issue if you are still having trouble after using a recent version.

@MaicolBen
Copy link

Yeah, that worked, thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2020
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