Bootstrap failed,' Gravatar Connection timed out'


(Yang Flincllck) #1

Today i am going to install Discourse on a new service,but when i run

sudo ./launcher bootstrap app

it always return

Connection timed out

I do not know what happend

#app.yml
templates:
 - "templates/postgres.template.yml"
 - "templates/redis.template.yml"
 - "templates/web.template.yml"
 - "templates/sshd.template.yml"
 - "templates/web.ratelimited.template.yml"
 - "templates/web.china.template.yml"
## which TCP/IP ports should this container expose?
expose:
  - "5257:80"   # fwd host port 80   to container port 80 (http)
  - "2222:22" # fwd host port 2222 to container port 22 (ssh)
env:
  LANG: en_US.UTF-8
  ## TODO: How many concurrent web requests are supported?
  ## With 2GB we recommend 3-4 workers, with 1GB only 2
  UNICORN_WORKERS: 2
  ##
  ## 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: 'qingxp9@gmail.com'
  ##
  ## TODO: The domain name this Discourse instance will respond to
  DISCOURSE_HOSTNAME: 'geek.acmclub.cn'
  ##
  ## TODO: The mailserver this Discourse instance will use
  DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org         # (mandatory)
  DISCOURSE_SMTP_PORT: 587                        # (optional)
  DISCOURSE_SMTP_USER_NAME: xxx      # (optional)
  DISCOURSE_SMTP_PASSWORD: xxx               # (optional)

log:

I, [2014-12-03T09:37:22.967684 #47]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
[187] 03 Dec 09:37:35.200 * 10 changes in 300 seconds. Saving...
[187] 03 Dec 09:37:35.202 * Background saving started by pid 18706
[18706] 03 Dec 09:37:35.217 * DB saved on disk
[18706] 03 Dec 09:37:35.218 * RDB: 6 MB of memory used by copy-on-write
[187] 03 Dec 09:37:35.302 * Background saving terminated with success
rake aborted!
Errno::ETIMEDOUT: Connection timed out - connect(2)
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:46:in `eval'
/var/www/discourse/lib/file_helper.rb:17:in `block in download'
/var/www/discourse/lib/file_helper.rb:16:in `open'
/var/www/discourse/lib/file_helper.rb:16:in `download'
/var/www/discourse/app/models/user_avatar.rb:20:in `update_gravatar!'
/var/www/discourse/app/models/user.rb:645:in `refresh_avatar'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:424:in `block in make_lambda'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:221:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:221:in `block in halting_and_conditional'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:215:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:215:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:86:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:86:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/callbacks.rb:302:in `create_or_update'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/persistence.rb:103:in `save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/validations.rb:51:in `save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/attribute_methods/dirty.rb:21:in `save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record

/transactions.rb:268:in `block (2 levels) in save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:329:in `block in with_transaction_returning_stat
us'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:199:in `tran
saction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:326:in `with_transaction_returning_status'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:268:in `block in save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:283:in `rollback_active_record_state!'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:267:in `save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/seeder.rb:74:in `seed_record'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/seeder.rb:36:in `block (2 levels) in seed'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/seeder.rb:36:in `map'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/seeder.rb:36:in `block in seed'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:199:in `tran
saction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/seeder.rb:35:in `seed'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/active_record_extension.rb:32:in `seed'
(eval):9:in `block (2 levels) in run_file'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:46:in `eval'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:46:in `block (2 levels) in run_file'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:58:in `block in open'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:57:in `open'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:57:in `open'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:36:in `block in run_file'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `bloc
k in transaction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `with
in_new_transaction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `tran
saction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:35:in `run_file'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:26:in `block in run'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:25:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:25:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu/runner.rb:25:in `run'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/seed-fu-2.3.3/lib/seed-fu.rb:29:in `seed'
/var/www/discourse/lib/tasks/db.rake:4:in `block in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2014-12-10T01:37:11.083735 #46]  INFO -- : 
== Seed from /var/www/discourse/db/fixtures/001_categories.rb
== Seed from /var/www/discourse/db/fixtures/002_groups.rb
== Seed from /var/www/discourse/db/fixtures/003_post_action_types.rb
……
……
……
I, [2014-12-10T01:37:11.089864 #46]  INFO -- : Terminating async processes
I, [2014-12-10T01:37:11.090020 #46]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postg
res:postgres:ssl-cert /usr/lib/postgresql/9.3/bin/postmaster -D /etc/postgresql/9.3/main pid: 73
2014-12-10 01:37:11 UTC LOG:  received fast shutdown request
2014-12-10 01:37:11 UTC LOG:  aborting any active transactions
2014-12-10 01:37:11 UTC LOG:  autovacuum launcher shutting down
2014-12-10 01:37:11 UTC LOG:  shutting down
I, [2014-12-10T01:37:11.090169 #46]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 186
[186 | signal handler] (1418175431) Received SIGTERM scheduling shutdown...
[186] 10 Dec 01:37:11.163 # User requested shutdown...
[186] 10 Dec 01:37:11.163 * Saving the final RDB snapshot before exiting.
[186] 10 Dec 01:37:11.173 * DB saved on disk
[186] 10 Dec 01:37:11.173 # Redis is now ready to exit, bye bye...
2014-12-10 01:37:11 UTC LOG:  database system is shut down


FAILED
--------------------
RuntimeError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 18692 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:105:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --wi
thout development'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
080b3d967731b6f579fe48603f8de06c3cf41441b94c1cb76406d5d69123f38e
FAILED TO BOOTSTRAP

(Sam Saffron) #2

what kind of a server do you have there ?


(Yang Flincllck) #3

Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-40-generic x86_64)


(Sam Saffron) #4

what kind of hardware? does this repeat every time you try to bootstrap?


(Yang Flincllck) #5

i used Aliyun ECS.
And yes,i have meet it a whole day,


(Sam Saffron) #6

I strongly suspect you are running on severely under powered hardware.


(Yang Flincllck) #7

but i have installed successful a other discourse on Aliyun ECS.


(Yang Flincllck) #8

@fantasticfears 能帮我看一下吗,我在把阿里云服务器重新初始化了还是遇到同样的问题


(Erick Guan) #9

You should configure http proxy in the configuration file.

This is because:
Gravatar and its CDN was taken down by GFW. This also blocks the sidekiq queue.

@sam we need fallback to use default.


(Sam Saffron) #10

We need site setting added to disable gravatar, can you work on a PR?


(Yang Flincllck) #11

So how can i disable gravatar?
Unless necessary,i don’t want to use proxy


(Yang Flincllck) #12

it seems that duoshuo made a gravatar mirror:
http://gravatar.duoshuo.com
Maybe we can use it or others likes https://ruby-china.org, https://cdn.v2ex.com/gravatar, http://cn.gravatar.com,


(Erick Guan) #13

@sam There is already a site setting called automatically_download_gravatars.

Plan:

  1. Gravatar mirror env
  2. Settings to disable user changing their gravatar on user profile page.
  3. Change automatically_download_gravatars to enable_gravatar and automatically_refresh_gravatars
  4. Also need to include system user’s avatar.
    Is that good?

@flincllck However, you can’t disable it in the app.yml. You have to manually toggle it in config/site_settings.yml.


(Sam Saffron) #14

Seems like a reasonable plan to me.


(Yang Flincllck) #15

@sam, Before solving it,please merge this pull request.

I add a line to disable automatically_download_gravatars in web.china.template.yml:

- sed -i "$(sed -n '/automatically_download_gravatars/=' /var/www/discourse/config/site_settings.yml)s/true/false/" /var/www/discourse/config/site_settings.yml

otherwise it will cases bootstrap failed and can’t creating new account


(Sam Saffron) #16

sed on site_settings is no good, we just need to be more forgiving for gravatar download issues and always ensure they are done async.


(Yang Flincllck) #17

Yes, I mean it is a temporary solution…Some Chinese users may be confused on it


(Sam Saffron) #18

I the sed solution is very risky, fixing the root problem is simpler here, we should only be downloading gravatar for system in bg job.