Strange error during bootstrap (db:migrate) on Mac


(Rafael Escobar) #1

Hello, guys!

I am trying to run Discourse (with discourse_docker) as a “web only” container, with separated Redis and PostgreSQL services. The latter is running with AWS RDS while, for the former, I will use AWS Elasticache, but I am currently running it on my computer (on the host, not inside a container).

The problem

After executing ./launcher bootstrap app, I received the following message:

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 187 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --without development'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
19a40972edaa2d70f5a58c2748591b7cd1cd0d6b15c50072977a17453a8dcf4b
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

I have found some messages that could represent the cause of the error, but I know neither their meaning, nor how to fix them.

  • Error during bundle install
Bundler::HTTPError: Net::HTTPTooManyRequests: <html>
<head><title>429 Too Many Requests</title></head>
<body bgcolor="white">
<center><h1>429 Too Many Requests</h1></center>
<hr><center>nginx</center>
</body>
</html>

/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/fetcher/downloader.rb:36:in `fetch'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/fetcher/compact_index.rb:116:in `call'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/compact_index_client/updater.rb:43:in `block in update'
  /usr/local/lib/ruby/2.4.0/tmpdir.rb:89:in `mktmpdir'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/compact_index_client/updater.rb:30:in `update'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/compact_index_client.rb:81:in `update'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/compact_index_client.rb:97:in `update_info'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/compact_index_client.rb:54:in `block in dependencies'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/fetcher/compact_index.rb:87:in `block (3 levels) in compact_index_client'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/worker.rb:63:in `apply_func'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/worker.rb:58:in `block in process_queue'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/worker.rb:55:in `loop'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/worker.rb:55:in `process_queue'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/worker.rb:89:in `block (2 levels) in create_threads'
Query List: ["rake", "msgpack", "bootsnap", "i18n", "minitest", "thread_safe", "tzinfo", "activesupport", "builder", "erubis", "mini_portile2", "nokogiri", "rails-deprecated_sanitizer", "rails-dom-testing", "loofah", "rails-html-sanitizer", "actionview", "rack", "rack-test", "actionpack", "globalid", "activejob", "mime-types", "mail", "actionmailer", "activemodel", "arel", "activerecord", "thor", "railties", "concurrent-ruby", "sprockets", "sprockets-rails", "rails", "seed-fu", "hiredis", "redis", "redis-namespace", "active_model_serializers", "fast_blank", "htmlentities", "moneta", "multi_json", "mustache", "crass", "nokogumbo", "sanitize", "onebox", "http_accept_language", "ember-source", "ember-data-source", "execjs", "barber", "ember-handlebars-template", "jquery-rails", "ember-rails", "babel-source", "babel-transpiler", "message_bus", "rails_multisite", "fast_xs", "rake-compiler", "fast_xor", "fastimage", "jmespath", "aws-sdk-core", "aws-sdk-resources", "aws-sdk", "excon", "unf_ext", "unf", "email_reply_trimmer", "exifr", "fspath", "image_size", "in_threads", "progress", "discourse_image_optim", "hashie", "omniauth", "ruby-openid", "rack-openid", "omniauth-openid", "openid-redis-store", "multipart-post", "faraday", "jwt", "multi_xml", "oauth2", "omniauth-oauth2", "omniauth-facebook", "oauth", "omniauth-oauth", "omniauth-twitter", "omniauth-instagram", "omniauth-github-discourse", "omniauth-google-oauth2", "oj", "pg", "coderay", "method_source", "slop", "pry", "pry-rails", "r2", "domain_name", "http-cookie", "netrc", "rest-client", "rinku", "connection_pool", "rack-protection", "sidekiq", "tilt", "sinatra", "libv8", "mini_racer", "highline", "uglifier", "rtlit", "public_suffix", "addressable", "safe_yaml", "crack", "hashdiff", "webmock", "fakeweb", "timecop", "test_after_commit", "rspec-support", "rspec-core", "diff-lcs", "rspec-expectations", "rspec-mocks", "rspec", "mock_redis", "rb-fsevent", "ffi", "rb-inotify", "ruby_dep", "listen", "certified", "fabrication", "discourse-qunit-rails", "metaclass", "mocha", "rspec-rails", "shoulda-context", "shoulda-matchers", "shoulda", "rspec-html-matchers", "spork", "spork-rails", "pry-nav", "byebug", "lru_redux", "flamegraph", "rack-mini-profiler", "kgio", "raindrops", "unicorn", "puma", "trollop", "rbtrace", "gc_tracer", "guess_html_encoding", "ruby-readability", "simple-rss", "stackprof", "memory_profiler", "rmmseg-cpp", "logster", "sass", "sassc"]
Query Gemcutter Dependency Endpoint API: rake,msgpack,bootsnap,i18n,minitest,thread_safe,tzinfo,activesupport,builder,erubis,mini_portile2,nokogiri,rails-deprecated_sanitizer,rails-dom-testing,loofah,rails-html-sanitizer,actionview,rack,rack-test,actionpack,globalid,activejob,mime-types,mail,actionmailer,activemodel,arel,activerecord,thor,railties,concurrent-ruby,sprockets,sprockets-rails,rails,seed-fu,hiredis,redis,redis-namespace,active_model_serializers,fast_blank,htmlentities,moneta,multi_json,mustache,crass,nokogumbo,sanitize,onebox,http_accept_language,ember-source,ember-data-source,execjs,barber,ember-handlebars-template,jquery-rails,ember-rails,babel-source,babel-transpiler,message_bus,rails_multisite,fast_xs,rake-compiler,fast_xor,fastimage,jmespath,aws-sdk-core,aws-sdk-resources,aws-sdk,excon,unf_ext,unf,email_reply_trimmer,exifr,fspath,image_size,in_threads,progress,discourse_image_optim,hashie,omniauth,ruby-openid,rack-openid,omniauth-openid,openid-redis-store,multipart-post,faraday,jwt,multi_xml,oauth2,omniauth-oauth2,omniauth-facebook,oauth,omniauth-oauth,omniauth-twitter,omniauth-instagram,omniauth-github-discourse,omniauth-google-oauth2,oj,pg,coderay,method_source,slop,pry,pry-rails,r2,domain_name,http-cookie,netrc,rest-client,rinku,connection_pool,rack-protection,sidekiq,tilt,sinatra,libv8,mini_racer,highline,uglifier,rtlit,public_suffix,addressable,safe_yaml,crack,hashdiff,webmock,fakeweb,timecop,test_after_commit,rspec-support,rspec-core,diff-lcs,rspec-expectations,rspec-mocks,rspec,mock_redis,rb-fsevent,ffi,rb-inotify,ruby_dep,listen,certified,fabrication,discourse-qunit-rails,metaclass,mocha,rspec-rails,shoulda-context,shoulda-matchers,shoulda,rspec-html-matchers,spork,spork-rails,pry-nav,byebug,lru_redux,flamegraph,rack-mini-profiler,kgio,raindrops,unicorn,puma,trollop,rbtrace,gc_tracer,guess_html_encoding,ruby-readability,simple-rss,stackprof,memory_profiler,rmmseg-cpp,logster,sass,sassc
  • Error on rake db:migrate
INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
Rails Error: Unable to access log file. Please ensure that /var/www/discourse/log/production.log exists and is writable (ie, make it writable for user and group: chmod 0664 /var/www/discourse/log/production.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
rake aborted!
Errno::EEXIST: File exists @ dir_s_mkdir - /var/www/discourse/public/uploads
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:46:in `eval'
/var/www/discourse/lib/file_store/local_store.rb:75:in `copy_file'
/var/www/discourse/lib/file_store/local_store.rb:8:in `store_file'
/var/www/discourse/lib/file_store/base_store.rb:7:in `store_upload'
/var/www/discourse/lib/upload_creator.rb:93:in `block (2 levels) in create_for'
/var/www/discourse/lib/upload_creator.rb:92:in `open'
/var/www/discourse/lib/upload_creator.rb:92:in `block in create_for'
/var/www/discourse/lib/distributed_mutex.rb:21:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:5:in `synchronize'
/var/www/discourse/lib/upload_creator.rb:34:in `create_for'
/var/www/discourse/app/models/user_avatar.rb:83:in `import_url_for_user'
(eval):21:in `block (2 levels) in run_file'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:46:in `eval'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:46:in `block (2 levels) in run_file'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:58:in `block in open'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:57:in `open'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:57:in `open'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:36:in `block in run_file'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:220:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:35:in `run_file'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:26:in `block in run'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:25:in `each'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu/runner.rb:25:in `run'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/seed-fu-2.3.5/lib/seed-fu.rb:29:in `seed'
/var/www/discourse/lib/tasks/db.rake:8:in `block in <top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

YAML file

templates:
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"

expose:
  - "80:80"
  - "2222:22"

docker_args: ' --net=host --add-host localhost:<lo0 alias> '

params:

env:
  LANG: en_US.UTF-8

  DISCOURSE_DB_SOCKET: ''
  DISCOURSE_DB_HOST: <postgresql url>
  DISCOURSE_DB_USERNAME: <postgresql username>
  DISCOURSE_DB_PASSWORD: <postgresql password>
  
  DISCOURSE_REDIS_HOST: <lo0 alias>
  
  DISCOURSE_DEVELOPER_EMAILS: <my email>
  DISCOURSE_HOSTNAME: <my hostname>
  
  DISCOURSE_SMTP_ADDRESS: <smtp url>
  DISCOURSE_SMTP_PORT: <smtp port>
  DISCOURSE_SMTP_USER_NAME: <smtp username>
  DISCOURSE_SMTP_PASSWORD: <smtp password>

volumes:
  - volume:
      host: /var/discourse/shared/app
      guest: /shared
  - volume:
      host: /var/discourse/shared/app/log/var-log
      guest: /var/log

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git

run:
  - exec: awk -F\# '{print $1;}' ~/.ssh/authorized_keys | awk 'BEGIN { print "Authorized SSH keys for this container:"; } NF>=2 {print $NF;}'

Some (maybe) useful information:

  • I have passed through many other errors before reaching this one, but I have managed to solve them

  • I have defined an lo0 alias to make Redis accessible inside the container

  • On my Linux, I executed the “standalone” version, the “web_only” + “data” version and a custom “web_only” + “cache” + “db” version and all of them worked, but I tested it neither with Redis running on the host nor with the PostgreSQL on the cloud

  • On my Mac, I could not run Discourse in any way, but the error logs and some researches led me to believe it was a problem with the database on this specific OS

  • Software versions

    • Docker: 17.03.1-ce
    • PostgreSQL: 9.6.2
    • Redis: 3.2.9

Final thoughts

Am I missing something or doing something wrong? Do you need any missing information? Please, let me know!

I want to set it running as fast as possible, but I have been stucked in this the whole day.

Thank you all in advance for any help!


(Matt Palmer) #2

We’ve been here before, quite recently. See this topic (and particularly this post), as well as this earlier topic.


(Robby O'Connor) #3

In the future – do a simple search of the forums. Asking questions that have already been answered clutters the forums. Instead you should seaech the error – or even better Google it first before asking here. Odds are a post from Meta will appear in your Google search too!


(Rafael Escobar) #4

I thought I have searched everything, but I was definitely wrong. :confused:

I am terribly sorry for the inconvenience. I will look into those topics.

Thank you!


(Robby O'Connor) #5

No need to be sorry. This google search answers the question directly.

Always Google your errors.


(Alan Tan) #6

(Alan Tan) #7