# Path of theme components

**URL:** https://meta.discourse.org/t/path-of-theme-components/198110
**Category:** Support
**Created:** [July 25, 2021, 9:56am UTC](https://meta.discourse.org/t/path-of-theme-components/198110 "2021-07-25T09:56:29Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![daemon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daemon/32/256632_2.png) [@daemon](https://meta.discourse.org/u/daemon)
#### Post date: [July 25, 2021, 9:56am UTC](https://meta.discourse.org/t/path-of-theme-components/198110/1 "2021-07-25T09:56:29Z")

</div>

Hi!

I want to upgrade to the latest version, but I have some issues with some theme components.  
They’re all my own components and I moved them from GitHub to GitLab. Now if I want to upgrade discourse (not from within discourse), I get errors because they are not available anymore. I tried to delete them inside of discourse but they won’t get deleted.  
Now my question is: where is the path to delete them directly on the server? I can’t find them.

I tried the safe-mode but I can’t access the forum in safe-mode.

* * *

EDIT:

Is there a file like the app.yml where all themes and components are stored so I can delete the list and rebuild discourse without them?

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [July 25, 2021, 12:18pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/2 "2021-07-25T12:18:58Z")

</div>

> [@daemon](#):
>
> I tried to delete them inside of discourse but they won’t get deleted.

I think this is the problem you need to solve. The correct way to approach this is to delete all themes and theme components that come from the old location, and import new ones from their new locations.

---

<div class="post-metadata">

### Author: ![daemon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daemon/32/256632_2.png) [@daemon](https://meta.discourse.org/u/daemon)
#### Post date: [July 25, 2021, 12:41pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/3 "2021-07-25T12:41:14Z")

</div>

This isn’t possible because then discourse is in an infinity loop. That’s the reason why I asked how to delete them in an other way.  
I can’t even get into safe-mode.  
A reinstall isn’t also possible because the backup is too old.  
After `./launcher rebuild app` I have seen that the forum isn’t available for guests.

So how can I get it to work anymore?

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [July 25, 2021, 2:24pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/4 "2021-07-25T14:24:40Z")

</div>

> [@daemon](#):
>
> I can’t even get into safe-mode

Why not? What happens instead?

> [@daemon](#):
>
> A reinstall isn’t also possible because the backup is too old.

The age of the backup should not matter, even 5 year old backups restore without issues.

To be honest it sounds like the theme components are the least of your issues.

> [@daemon](#):
>
> That’s the reason why I asked how to delete them in an other way.

If uninstalling them is impossible through the UI then I am afraid other methods will fail as well.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [July 25, 2021, 2:39pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/5 "2021-07-25T14:39:40Z")

</div>

I think disabling components by hand in the database is the kind of solution that could be the last resort here. It is highly risky but doable if there are no options.

Disabled components at least will let the rebuild succeed which will in turn allow access to the admin interface to remove & reinstall components from gitlab.

---

<div class="post-metadata">

### Author: ![daemon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daemon/32/256632_2.png) [@daemon](https://meta.discourse.org/u/daemon)
#### Post date: [July 25, 2021, 4:27pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/6 "2021-07-25T16:27:24Z")

</div>

> [@michaeld](#):
>
> Why not? What happens instead?

Nothing happens, the site is not available in safe-mode.

> [@michaeld](#):
>
> The age of the backup should not matter, even 5 year old backups restore without issues.
> 
> To be honest it sounds like the theme components are the least of your issues.

Of course it matters, because all posts after the last backup are gone.

And no, the forum worked fine until I tried to do the update before I removed the components.

@itsbhanusharma  
Thanks for your answer. I didn’t know that the theme and the components are stored in the database.

How can I access the db?

EDIT:  
Ok, I’m in the database and I think it’s the theme\_settings table.  
How to delete all components?

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [July 25, 2021, 4:41pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/7 "2021-07-25T16:41:51Z")

</div>

> [@daemon](#):
>
> Of course it matters, because all posts after the last backup are gone.

I misread your post, I thought you said it was too old because restore failed.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [July 25, 2021, 4:42pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/8 "2021-07-25T16:42:45Z")

</div>

They’re not stored in the DB, however, their activation/deactivation state is stored in the DB itself.

I don’t exactly recall the steps but I recently fixed a similarly broken install.

The most important thing here is to know if your container is still running. If it is running, I may be able to advice on how to try to disable offending components from database.

---

<div class="post-metadata">

### Author: ![daemon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daemon/32/256632_2.png) [@daemon](https://meta.discourse.org/u/daemon)
#### Post date: [July 25, 2021, 4:57pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/9 "2021-07-25T16:57:09Z")

</div>

Yes, the container is still running.  
To disable the components would help me a lot.

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [July 25, 2021, 7:42pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/10 "2021-07-25T19:42:00Z")

</div>

> [@itsbhanusharma](#):
>
> They’re not stored in the DB

They _are_ completely stored in the database (tables starting with theme\*)

---

<div class="post-metadata">

### Author: ![daemon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daemon/32/256632_2.png) [@daemon](https://meta.discourse.org/u/daemon)
#### Post date: [July 26, 2021, 7:05am UTC](https://meta.discourse.org/t/path-of-theme-components/198110/11 "2021-07-26T07:05:58Z")

</div>

> [@michaeld](#):
>
> They _are_ completely stored in the database (tables starting with theme\*)

And how can I delete them (not everything in the table)?

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [July 26, 2021, 11:22am UTC](https://meta.discourse.org/t/path-of-theme-components/198110/12 "2021-07-26T11:22:33Z")

</div>

From the top of my head - run this from the rails console. Find the ID of the theme in the URL when viewing it.

```plaintext
t = Theme.find(123)
t.enabled = false
t.save

```

---

<div class="post-metadata">

### Author: ![daemon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daemon/32/256632_2.png) [@daemon](https://meta.discourse.org/u/daemon)
#### Post date: [July 26, 2021, 11:43am UTC](https://meta.discourse.org/t/path-of-theme-components/198110/13 "2021-07-26T11:43:06Z")

</div>

Well, ok, that’s a problem.  
Isn’t it possible to use something like pgAdmin to get access to the db directly?  
I don’t know the ID of the theme and the components because I haven’t access to the admin area anymore.

* * *

Edit:  
I have figured out the theme and components.  
Disabling them doesn’t work, so how to delete them with rails c?  
I even tried to get rid of them with rake, but rake can’t delete them too.

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [July 26, 2021, 12:32pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/14 "2021-07-26T12:32:23Z")

</div>

> [@daemon](#):
>
> Disabling them doesn’t work

> [@daemon](#):
>
> rake can’t delete them too

Can you share more details? Do you get an error? If so, what’s the error? Or does it have no effect?

---

<div class="post-metadata">

### Author: ![daemon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daemon/32/256632_2.png) [@daemon](https://meta.discourse.org/u/daemon)
#### Post date: [July 26, 2021, 12:46pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/15 "2021-07-26T12:46:49Z")

</div>

```plaintext
rake themes:uninstall https://github.com/link/to/git.git
rake aborted!
Don't know how to build task 'themes:uninstall' (See the list of available tasks with `rake --tasks`)
Did you mean? themes:install
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)

```

Or what is the right command to delete things with rake?

I get a list with commands with` rake --tasks` and `rake -AT` but there’s not a command to delete a theme or a component.

With` rails c` I can disable a theme but with a reload it’s still the old corrupted theme.

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [July 26, 2021, 12:52pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/16 "2021-07-26T12:52:25Z")

</div>

```ruby
Theme.where(user_selectable: true).update_all(user_selectable: false)
Theme.where(auto_update: true).update_all(auto_update: false)
Theme.clear_default!

```

Can you try these in the rails console and see if you can load your site afterwards? If not, can you try rebuilding?

---

<div class="post-metadata">

### Author: ![daemon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daemon/32/256632_2.png) [@daemon](https://meta.discourse.org/u/daemon)
#### Post date: [July 26, 2021, 1:10pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/17 "2021-07-26T13:10:04Z")

</div>

I had to rebuild it after your commands and it worked, and my forum is back online! 👍 🙂

Many thanks to you who helped me!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 28, 2021, 3:25pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/18 "2021-07-28T15:25:10Z")

</div>

Hey @Osama. I’ve been worried lately about the theme-components-can-break-a-rebuild issue.

I think we need a #howto to address it.

I think this fix here addresses only “build broken because github URL is broken”, right?

For builds that are broken because there’s an error in the javascript, is there a similar way to disable or remove themes from the command line that we should put in a #howto?

EDIT: like the fail when “Alternative Logos” is included. . . .

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [July 28, 2021, 6:14pm UTC](https://meta.discourse.org/t/path-of-theme-components/198110/19 "2021-07-28T18:14:28Z")

</div>

> [@pfaffman](#):
>
> the theme-components-can-break-a-rebuild issue.

I’ve been thinking about this for a while as well, and my opinion is that this makes sense for some communities but not all. Some communities treat their customizations/themes as a fundamental part of the site’s identity and they would really want to know if there are problems with their customizations when their site is deployed, and other communities use a vanilla Discourse install with a few customizations/component sprinkled on top and they could easily live a few days without them.

Maybe the `Auto update when Discourse is updated` checkbox should off by default when installing a new theme/component? It’s currently on by default and I think it should be off by default, but this needs a wider discussion…

> [@pfaffman](#):
>
> I think this fix here addresses only “build broken because github URL is broken”, right?

No, the code snippet above (the 2nd line in particular) disables auto-update-on-deploy for all themes/components that are currently installed, so it should fix any builds that are broken due to themes auto-update including JS/CSS errors. The #howto should only include the 2nd line.

---

<div class="post-metadata">

### Author: ![yanokwa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yanokwa/32/105083_2.png) [@yanokwa](https://meta.discourse.org/u/yanokwa)
#### Post date: [August 12, 2021, 5:32am UTC](https://meta.discourse.org/t/path-of-theme-components/198110/20 "2021-08-12T05:32:07Z")

</div>

I just ran into this problem too. If you have a component linked to a public repo and then you make that repo private, rebuilds fail. It’s unpleasant because users can make changes that can break the site for sysadmins months later.

The commands at [Path of theme components - #16 by Osama](https://meta.discourse.org/t/path-of-theme-components/198110/16) worked great for me. I’d add instructions on how to enter the rails console.

```sh
./launcher start app
./launcher enter app
rails c 

```

[Next page](https://meta.discourse.org/t/path-of-theme-components/198110.md?page=2)
