# Stable branch assets won't compile

**URL:** https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656
**Category:** Support
**Created:** [6월 4, 2015, 4:18오후 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656 "2015-06-04T16:18:57Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![robbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbo/32/115517_2.png) [@robbo](https://meta.discourse.org/u/robbo)
#### Post date: [6월 4, 2015, 4:18오후 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656/1 "2015-06-04T16:18:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![robbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbo/32/115517_2.png) [@robbo](https://meta.discourse.org/u/robbo)
#### Post date: [6월 4, 2015, 4:23오후 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656/2 "2015-06-04T16:23:19Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [6월 4, 2015, 9:12오후 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656/3 "2015-06-04T21:12:38Z")

</div>

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](https://github.com/discourse/discourse_docker/tree/master/samples).

---

<div class="post-metadata">

### Author: ![robbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbo/32/115517_2.png) [@robbo](https://meta.discourse.org/u/robbo)
#### Post date: [6월 4, 2015, 9:14오후 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656/4 "2015-06-04T21:14:55Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![brahn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brahn/32/109267_2.png) [@brahn](https://meta.discourse.org/u/brahn)
#### Post date: [6월 12, 2015, 1:58오후 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656/5 "2015-06-12T13:58:00Z")

</div>

> [@neil](#):
>
> The db migrations happen first, so the “stylesheet\_cache” table should have been found.

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.

> <https://github.com/discourse/discourse/blob/9ce66038647bc4ff63167fe9c74857a01acc0875/lib/tasks/assets.rake#L76>

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.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [6월 12, 2015, 2:39오후 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656/6 "2015-06-12T14:39:58Z")

</div>

What does your yml file look like. Does the hooks section match what’s in [the howto](https://meta.discourse.org/t/multisite-configuration-with-docker/14084)?

---

<div class="post-metadata">

### Author: ![brahn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brahn/32/109267_2.png) [@brahn](https://meta.discourse.org/u/brahn)
#### Post date: [6월 12, 2015, 2:47오후 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656/7 "2015-06-12T14:47:43Z")

</div>

@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.

 ![](https://global.discourse-cdn.com/meta/original/3X/d/9/d93e3fa1b3aaf4fb049c3051ecc02db9f0036110.png)

---

<div class="post-metadata">

### Author: ![robbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbo/32/115517_2.png) [@robbo](https://meta.discourse.org/u/robbo)
#### Post date: [6월 12, 2015, 8:59오후 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656/8 "2015-06-12T20:59:43Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [6월 23, 2015, 4:02오전 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656/9 "2015-06-23T04:02:38Z")

</div>

Can you update the multisite howto to reflect it is wiki

> [@Multisite configuration with Docker](https://meta.discourse.org/t/multisite-configuration-with-docker/14084):
>
> warning While multisite is supported in the Discourse application, this is an advanced sysadmin setup. If you don’t know what you’re doing, do not set up multisite. The Discourse team is unable to provide multisite configuration support. If you wish to host multiple domains on a singled Docker setup, you’ll need a multisite configuration. Here are the basic building blocks for one. Understand hooks Multisite is a fairly advanced topic. Before attempting a multisite build, spend some time…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [6월 23, 2015, 4:02오전 UTC](https://meta.discourse.org/t/stable-branch-assets-wont-compile/29656/10 "2015-06-23T04:02:50Z")

</div>


