Problems with Sparkpost email on install


(Jestyr27) #1

Hey guys,

I’ve been working on getting Discourse setup on my website and cannot get the email confirmation to go through, or to pass through sparkpost

Here’s my error log:

Started GET "/about.json" for 64.71.168.196 at 2017-07-20 20:21:42 +0000
Processing by AboutController#index as JSON
Completed 200 OK in 23ms (Views: 0.4ms | ActiveRecord: 4.9ms)
Started GET "/site/basic-info.json" for 64.71.168.196 at 2017-07-20 20:21:42 +0000
Processing by SiteController#basic_info as JSON
Completed 200 OK in 4ms (Views: 0.5ms | ActiveRecord: 0.0ms)
Started GET "/site/basic-info.json" for 64.71.168.196 at 2017-07-20 20:21:42 +0000
Processing by SiteController#basic_info as JSON
Completed 200 OK in 2ms (Views: 0.3ms | ActiveRecord: 0.0ms)
Started GET "/" for 169.54.233.119 at 2017-07-20 20:25:17 +0000
Processing by FinishInstallationController#index as HTML
  Rendered finish_installation/index.html.erb within layouts/finish_installation (2.6ms)
  Rendered common/_special_font_face.html.erb (1.1ms)
  Rendered layouts/_head.html.erb (26.8ms)
Completed 200 OK in 365ms (Views: 216.0ms | ActiveRecord: 48.8ms)
Started GET "/" for 169.54.233.119 at 2017-07-20 20:27:06 +0000
Processing by FinishInstallationController#index as HTML
  Rendered finish_installation/index.html.erb within layouts/finish_installation (3.4ms)
  Rendered common/_special_font_face.html.erb (1.2ms)
  Rendered layouts/_head.html.erb (43.3ms)
Completed 200 OK in 93ms (Views: 55.9ms | ActiveRecord: 11.3ms)
Started GET "/robots.txt" for 216.244.66.197 at 2017-07-20 20:27:12 +0000
Processing by RobotsTxtController#index as */*
  Rendered robots_txt/index.erb (2.0ms)
Completed 200 OK in 21ms (Views: 18.2ms | ActiveRecord: 0.0ms)
Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:345:in `rescue in establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:331:in `establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:101:in `block in connect'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:293:in `with_reconnect'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:100:in `connect'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:364:in `ensure_connected'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:221:in `block in process'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:306:in `logging'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:220:in `process'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:134:in `block in call_loop'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:280:in `with_socket_timeout'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:133:in `call_loop'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/subscribe.rb:43:in `subscription'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/subscribe.rb:12:in `subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis.rb:2765:in `_subscription'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis.rb:2143:in `block in subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis.rb:58:in `block in synchronize'", "/usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis.rb:58:in `synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis.rb:2142:in `subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.0.2/lib/message_bus/backends/redis.rb:304:in `global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.0.2/lib/message_bus.rb:513:in `global_subscribe_thread'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.0.2/lib/message_bus.rb:461:in `block in new_subscriber_thread'"]
Job exception: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)

Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:345:in `rescue in establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:331:in `establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:101:in `block in connect'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:293:in `with_reconnect'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:100:in `connect'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:364:in `ensure_connected'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:221:in `block in process'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:306:in `logging'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:220:in `process'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:120:in `call'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis.rb:862:in `block in get'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis.rb:58:in `block in synchronize'", "/usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis.rb:58:in `synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.3/lib/redis.rb:861:in `get'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.0.2/lib/message_bus/backends/redis.rb:252:in `process_global_backlog'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.0.2/lib/message_bus/backends/redis.rb:287:in `block in global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.0.2/lib/message_bus/backends/redis.rb:301:in `global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.0.2/lib/message_bus.rb:513:in `global_subscribe_thread'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.0.2/lib/message_bus.rb:461:in `block in new_subscriber_thread'"]
Started GET "/" for x at 2017-07-20 20:40:21 +0000
Processing by FinishInstallationController#index as HTML
  Rendered finish_installation/index.html.erb within layouts/finish_installation (2.8ms)
  Rendered common/_special_font_face.html.erb (1.1ms)
  Rendered layouts/_head.html.erb (25.4ms)
Completed 200 OK in 397ms (Views: 194.2ms | ActiveRecord: 56.3ms)
Started GET "/stylesheets/wizard_800b272d44aacea94c32f35ad7798ca7c2b76fe3.css?__ws=community.synthesis.games" for 216.6.179.9 at 2017-07-20 20:40:21 +0000
Processing by StylesheetsController#show as HTML
  Parameters: {"__ws"=>"community.synthesis.games", "name"=>"wizard_800b272d44aacea94c32f35ad7798ca7c2b76fe3"}
Sent file /var/www/discourse/tmp/stylesheet-cache/wizard_800b272d44aacea94c32f35ad7798ca7c2b76fe3.css (0.2ms)
Completed 200 OK in 4ms (ActiveRecord: 0.8ms)
Started GET "/finish-installation/register" for x at 2017-07-20 20:40:39 +0000
Processing by FinishInstallationController#register as HTML
  Rendered finish_installation/register.html.erb within layouts/finish_installation (3.6ms)
  Rendered common/_special_font_face.html.erb (0.2ms)
  Rendered layouts/_head.html.erb (0.4ms)
Completed 200 OK in 10ms (Views: 6.6ms | ActiveRecord: 0.0ms)
Started POST "/finish-installation/register" for x at 2017-07-20 20:40:57 +0000
Processing by FinishInstallationController#register as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>x", "email"=>"digitus@mail.synthesis.games", "username"=>"digitus", "password"=>"[FILTERED]", "commit"=>"Register"}
Redirected to http://community.synthesis.games/finish-installation/confirm-email
Completed 302 Found in 746ms (ActiveRecord: 43.8ms)
Started GET "/finish-installation/confirm-email" for x at 2017-07-20 20:40:57 +0000
Processing by FinishInstallationController#confirm_email as HTML
  Rendered finish_installation/confirm_email.html.erb within layouts/finish_installation (3.2ms)
  Rendered common/_special_font_face.html.erb (2.8ms)
  Rendered layouts/_head.html.erb (58.2ms)
Completed 200 OK in 100ms (Views: 90.4ms | ActiveRecord: 5.5ms)

Here’s the resources I’ve been using, if you could help at all it would be appreciated!

And here’s where the app.yml looks like

## this is the all-in-one, standalone Discourse Docker container template
##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  #- "templates/web.ssl.template.yml"
  #- "templates/web.letsencrypt.ssl.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
  - "8080:80"   # http
  - "4433:443" # https
  - "2222:22"  #ssh in the container

params:
  db_default_text_search_config: "pg_catalog.english"

  ## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  db_shared_buffers: "1024MB"

  ## can improve sorting performance, but adds memory usage per-connection
  #db_work_mem: "40MB"

  ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed

env:
  LANG: en_US.UTF+5
  # DISCOURSE_DEFAULT_LOCALE: en

  ## How many concurrent web requests are supported? Depends on memory and CPU cores.
  ## will be set automatically by bootstrap based on detected CPUs, or you can override
  UNICORN_WORKERS: 4

  ## TODO: The domain name this Discourse instance will respond to
  DISCOURSE_HOSTNAME: community.synthesis.games

  ## Uncomment if you want the container to be started with the same
  ## hostname (-h option) as specified above (default "$hostname-$config")
  #DOCKER_USE_HOSTNAME: true

  ## TODO: List of comma delimited emails that will be made admin and developer
  ## on initial signup example 'user1@example.com,user2@example.com'
  DISCOURSE_DEVELOPER_EMAILS: 'x'

  ## TODO: The SMTP mail server used to validate new accounts and send notifications
  DISCOURSE_SMTP_ADDRESS: smtp.sparkpostmail.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: SMTP_Injection
  DISCOURSE_SMTP_PASSWORD: "DELETED"
  DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
  #LETSENCRYPT_ACCOUNT_EMAIL: me@example.com

  ## The CDN address for this Discourse instance (configured to pull)
  ## see https://meta.discourse.org/t/14857 for details
  #DISCOURSE_CDN_URL: //discourse-cdn.example.com

## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git

## Any custom commands to run after building
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  - exec: rails r "SiteSetting.notification_email='noreply@synthesis.games'"
  - exec: echo "End of custom commands"

Thank you!


Troubleshooting email on a new Discourse install
(Eli the Bearded) #2

Did you see the post right before yours about not using the first API key from Sparkpost? Did you try that?


(Matt Palmer) #3

I don’t see anything in the log you provided about e-mail, but I did notice a big “Can’t connect to Redis” error, which is going to cause you just about every kind of pain possible.


(Jestyr27) #4

I’ve tried 3 API keys so far, and this is a fresh install of Discourse. Just removed the docker image and files from our server and redownloaded. Do you think the redis connection is causing the issue? Is that port 6379? My firewall only allows the ports I select through.

And sorry I accidentally forgot the final piece of the error log.

Here’s the email error

Redirected to http://community.synthesis.games/finish-installation/confirm-email
Completed 302 Found in 746ms (ActiveRecord: 43.8ms)
Started GET "/finish-installation/confirm-email" for x at 2017-07-20 20:40:57 +0000
Processing by FinishInstallationController#confirm_email as HTML
  Rendered finish_installation/confirm_email.html.erb within layouts/finish_installation (3.2ms)
  Rendered common/_special_font_face.html.erb (2.8ms)
  Rendered layouts/_head.html.erb (58.2ms)
Completed 200 OK in 100ms (Views: 90.4ms | ActiveRecord: 5.5ms)

Sent mail to digitus@mail.synthesis.games (652.0ms)
Job exception: 535 5.7.8 Sorry.

Here’s my netstat -ltnp

no output for :::6379 shows up

tcp6       0      0 :::2222                 :::*                    LISTEN      15416/docker-pr                                      
tcp6       0      0 :::8080                 :::*                    LISTEN      15389/docker-pr                                      
tcp6       0      0 :::4433                 :::*                    LISTEN      15403/docker-pr

(Connor P Doherty) #5

I’m working with Jestre27 on this, and yes, we’re on like our third or fourth SparkPost API key by now.


(Matt Palmer) #6

What do Sparkport support say about why a 5.7.8 DSN can be returned? Seems like they’re the ones you should be speaking to initially, since they’re the ones rejecting the e-mail.


(Jestyr27) #7

that’s from their support page. I can try reaching out to them, but we’ve checked everything they said would be an issue for that error code.

I’ll try a new API key in the mean time.


(Jestyr27) #8

Thank you for your help guys! I tried a new ACCOUNT! and API key and it happened to work the first time, the REDIS error I’ve no idea what’s going on there, but the emails were sent out :wink: