Problem with nginx config at install (Debian 8.6)


#1

I have installed redash using the script currently at redash/setup/ubuntu/bootstrap.sh (d22f0d4) on Debian Jessie 8.6

Passed thru various problems with postgresql… but now halted at nginx config.
I’m familiar with Apache, but nginx config is simply black magic for me… and it fails…

Current content of /etc/nginx/sites-available/redash is the standard found at redash/setup/ubuntu/files/nginx_redash_site (90128b9)

upstream rd_servers {
  server 127.0.0.1:5000;
}

server {

  server_tokens off;

  listen 80 default;

  access_log /var/log/nginx/rd.access.log;

  gzip on;
  gzip_types *;
  gzip_proxied any;

  location / {
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_pass       http://rd_servers;
  }
}

But when I point to http://myurl I simply get an error 502 “bad gateway”. When commenting out the line proxy_pass, my url displays the standard nginx welcome page.

Any hint at which errors I might have done or files that need to be changed for Debian?


#2

Make sure Redash’s web server is running on port 5000. Seems like it isn’t.


#3

Thx Arik for the fast answer!
Correct, Nothing was running on port 5000
:grin:
The script uses ubuntuwise
add_service "redash_supervisord"
while debianwise it is
service redash_supervisord start

Note:
service redash_supervisord _re_start
might not work as expected, so prefer to use
service redash_supervisord stop
service redash_supervisord start


#4

Mmhhh… seems I still have some trouble with Celery et al.

root@xxxx log/nginx# supervisorctl stop all
root@xxxx log/nginx# supervisorctl status all
redash_celery                    FATAL     Exited too quickly (process log may have details)
redash_celery_scheduled          FATAL     Exited too quickly (process log may have details)
redash_server                    FATAL     Exited too quickly (process log may have details)
root@xxxx log/nginx# supervisorctl start all
redash_celery: ERROR (abnormal termination)
redash_server: ERROR (abnormal termination)
redash_celery_scheduled: ERROR (abnormal termination)
root@xxxx log/nginx#

#5

Check the logs (/opt/redash/logs/{api_error.log,celery_error.log,supervisord.log}).


#6

B-) the logs are not that clear, see some details at the end.

I have however isolated my source of problem: I have tried to configure mail parameters in .env as defined in http://docs.redash.io/en/latest/setup.html#mail-configuration … but this nukes something, as supervisord then uses just port 9001, and no 5000.
Keeping the .env without these values allows things to run fine, except that redash seems then unable to send mails.

Will try to reintroduce one line after the other to detect the failure point… all suggestions welcome (I would appreciate a working example though)

Extract of api_error.log

Not Working
[2016-09-27 10:19:37 +0000] [30642] [INFO] Starting gunicorn 19.4.5
[2016-09-27 10:19:37 +0000] [30642] [INFO] Listening at: http://127.0.0.1:5000 (30642)
[2016-09-27 10:19:37 +0000] [30642] [INFO] Using worker: sync
[2016-09-27 10:19:37 +0000] [30650] [INFO] Booting worker with pid: 30650
[2016-09-27 10:19:37 +0000] [30650] [ERROR] Exception in worker process:
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py”, line 515, in spawn_worker
worker.init_process()

File “/opt/redash/redash.0.11.1.b2095/redash/settings.py”, line 133, in
MAIL_USE_TLS = parse_boolean(os.environ.get(‘REDASH_MAIL_USE_TLS’, ‘false’))
File “/opt/redash/redash.0.11.1.b2095/redash/settings.py”, line 41, in parse_boolean
return json.loads(str.lower())
File “/usr/lib/python2.7/json/init.py”, line 338, in loads
return _default_decoder.decode(s)
File “/usr/lib/python2.7/json/decoder.py”, line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python2.7/json/decoder.py”, line 384, in raw_decode
raise ValueError(“No JSON object could be decoded”)
ValueError: No JSON object could be decoded
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py”, line 515, in spawn_worker
worker.init_process()
File “/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py”, line 122, in init_process
self.load_wsgi()

[2016-09-27 10:19:37 +0000] [30653] [INFO] Worker exiting (pid: 30653)
Traceback (most recent call last):
File “/usr/local/bin/gunicorn”, line 11, in
sys.exit(run())
File “/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py”, line 74, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File “/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py”, line 192, in run
super(Application, self).run()
File “/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py”, line 72, in run
Arbiter(self).run()
File “/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py”, line 206, in run
self.halt(reason=inst.reason, exit_status=inst.exit_status)
File “/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py”, line 302, in halt
self.stop()
File “/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py”, line 347, in stop
time.sleep(0.1)
File “/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py”, line 219, in handle_chld
self.reap_workers()
File “/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py”, line 464, in reap_workers
raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer ‘Worker failed to boot.’ 3>

Working:
[2016-09-27 10:30:39 +0000] [31494] [INFO] Starting gunicorn 19.4.5
[2016-09-27 10:30:39 +0000] [31494] [INFO] Listening at: http://127.0.0.1:5000 (31494)
[2016-09-27 10:30:39 +0000] [31494] [INFO] Using worker: sync
[2016-09-27 10:30:39 +0000] [31517] [INFO] Booting worker with pid: 31517
[2016-09-27 10:30:39 +0000] [31518] [INFO] Booting worker with pid: 31518
[2016-09-27 10:30:39 +0000] [31520] [INFO] Booting worker with pid: 31520
[2016-09-27 10:30:39 +0000] [31526] [INFO] Booting worker with pid: 31526
[2016-09-27 10:31:22,191][PID:31518][INFO][metrics] method=GET path=/favicon.ico endpoint=redash.send_static status=200 content_type=image/vnd.microsoft.icon content_length=1150 duration=3.14 query_count=0 query_duration=0.00
[2016-09-27 10:31:22,191][PID:31518][INFO][metrics] method=GET path=/favicon.ico endpoint=redash.send_static status=500 content_type=? content_length=-1 duration=3.45 query_count=0 query_duration=0.00


#7

Updating .env
It seems that some values do create a malfunction, even if empty!!

export REDASH_MAIL_SERVER="" # default: localhost
#export REDASH_MAIL_PORT="" # default: 25
#export REDASH_MAIL_USE_TLS="" # default: false
#export REDASH_MAIL_USE_SSL="" # default: false
export REDASH_MAIL_USERNAME="" # default: None
export REDASH_MAIL_PASSWORD="" # default: None
export REDASH_MAIL_DEFAULT_SENDER="yyy@xxx.fr" # Email address to send from

export REDASH_HOST="http://yyy.xxx.fr" # base address of your Re:dash instance, for example: "https://demo.redash.io"

But REDASH_MAIL_DEFAULT_SENDER seems to have no real effect, eg

# /opt/redash/current/manage.py check_settings|grep -i mail MAIL_DEFAULT_SENDER = None MAIL_MAX_EMAILS = None COMMON_CLIENT_CONFIG = {'allowScriptsInUserInput': False, 'dateFormat': 'DD/MM/YY', 'mailSettingsMissing': True, 'allowAllToEditQueries': True, 'logoUrl': '/images/redash_icon_small.png', 'dateTimeFormat': 'DD/MM/YY HH:mm'} MAIL_USERNAME = None MAIL_USE_SSL = False default_destinations = ['redash.destinations.email', 'redash.destinations.slack', 'redash.destinations.webhook', 'redash.destinations.hipchat'] enabled_destinations = ['redash.destinations.email', 'redash.destinations.slack', 'redash.destinations.webhook', 'redash.destinations.hipchat'] MAIL_SERVER = localhost DESTINATIONS = ['redash.destinations.email', 'redash.destinations.slack', 'redash.destinations.webhook', 'redash.destinations.hipchat'] MAIL_USE_TLS = False MAIL_PASSWORD = None MAIL_ASCII_ATTACHMENTS = False MAIL_PORT = 25


#8

If I had to guess the problem is with the boolean flags (USE_SSL, USE_TLS). If you don’t give it a valid value (true/false) it will crash .


#9

Thx.
:grimacing: will test that.
Seems that the “default” is not!