Stable branch assets won't compile

I was attempting to do the stable branch update so rebuilding the container and it failed to work when pre-compiling the assets. So I looked around and similar issues happen when people have plugins installed so I double checked and we have none other than the defaults.

Then I went into the container and manually run the command with --trace and this is what I got back.

rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "stylesheet_cache" does not exist
LINE 1: SELECT  1 AS one FROM "stylesheet_cache"  WHERE "stylesheet_...
                              ^
: SELECT  1 AS one FROM "stylesheet_cache"  WHERE "stylesheet_cache"."target" = 'desktop' AND "stylesheet_cache"."digest" = '8817ec6e89b25fc3a01911bcd0000a3515671e5d' LIMIT 1
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.9.3/lib/patches/db/pg.rb:90:in `exec'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.9.3/lib/patches/db/pg.rb:90:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `block in exec_no_cache'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract_adapter.rb:378:in `block in log'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract_adapter.rb:372:in `log'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `exec_no_cache'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:954:in `select'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:24:in `select_all'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:30:in `select_one'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:35:in `select_value'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/relation/finder_methods.rb:298:in `exists?'
/var/www/discourse/lib/sass/discourse_stylesheets.rb:83:in `compile'
/var/www/discourse/lib/sass/discourse_stylesheets.rb:39:in `block in compile'
/var/www/discourse/lib/sass/discourse_stylesheets.rb:36:in `synchronize'
/var/www/discourse/lib/sass/discourse_stylesheets.rb:36:in `compile'
/var/www/discourse/lib/tasks/assets.rake:82:in `block (3 levels) in <top (required)>'
/var/www/discourse/lib/tasks/assets.rake:81:in `each'
/var/www/discourse/lib/tasks/assets.rake:81:in `block (2 levels) in <top (required)>'
/var/www/discourse/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb:86:in `block in each_connection'
/var/www/discourse/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb:84:in `each'
/var/www/discourse/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb:84:in `each_connection'
/var/www/discourse/lib/tasks/assets.rake:76:in `block in <top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/var/www/discourse/lib/tasks/assets.rake:136:in `block in <top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/var/www/discourse/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile:css

Migrations run and everything so not sure why something would just not exist? We were previously on tests-passed but not updating, waiting for the next stable release to go stable.

This is also a multi site setup and our container.yml file could be out of date I guess.

I manually did things in the container and everything appears to be working but obviously I want a proper rebuild done.

/cc @rodrigofarcas

I was hoping it had failed to compile some last not really needed asset but there was a lot of missing assets so reverted to our checked out version of tests-passed.

Hmm… so you were on tests-passed from a long time ago, updated your yml file to use the stable branch, and then did ./launcher rebuild? The db migrations happen first, so the “stylesheet_cache” table should have been found. But I think I’ve seen this kind of error before. Running rebuild a second time usually succeeded.

You should definitely compare your yml file with the latest discourse_docker yml files.

I have had similar issues I think so made sure to try rebuild a few times. I even manually tried the migrate command more than once.

I’ll compare the yaml tomorrow and get back to you.

1 Like

I am hitting a similar problem and if I understand correctly it seems this is specific to multisite configuration. For multisite the multisite:migrate occurs in the hook after_bundle_exec but the assets:precompile is trying to do its thing for each db configured. Meaning, for multisite the db migrations are actually happening after the asset compilation.

At least that is my guess!

The best solution I could think of was to edit web.template.yml to perform the multisite:migrate directly prior to assets:precompile. This works for me temporarily at least.

What does your yml file look like. Does the hooks section match what’s in the howto?

@neil yes, I made sure it was the same and up to date as well as confirming that it was synced with any changes to the samples. As soon as I moved the multisite:migrate from my yml into web.template.yml it works fine.

1 Like

We use multisite as well. I have made the same changes above but the other way around. I moved the compile toafter the multisite:migrate in my own container and deleted it from the web.template.yml.

And with those changes, update working. Thanks.

Can you update the multisite howto to reflect it is wiki