My broken Discourse install prevents theme import

AI-generated summary

The discussion revolves around a broken Discourse install that prevents theme import. ahmed_alamiry encounters issues when importing a theme, receiving a 502 error.

Johani and david attempt to troubleshoot the problem by asking for the Discourse version, confirming the deploy key, and checking the about.json file for syntax errors.

After ahmed_alamiry shares the about.json file, david successfully imports the theme and provides a wrapped-up .tar.gz file for import. ahmed_alamiry still encounters issues with importing the remote theme but successfully imports it using http://theme-creator.discourse.org/.

david suspects the issue lies with ahmed_alamiry’s local Discourse setup, which is being automated using Ansible. ahmed_alamiry expresses gratitude for david’s support and inquires about installing the theme.tar.gz file from the CLI. david provides guidance on how to import the theme using the rails console.

ahmed_alamiry successfully imports the theme and sets it as the default theme using set_default!.

what does this mean

Did you add the deploy key to the repository?

yes

Great, thanks for confirming.

What version of Discourse are you on?
Can you confirm that the about.json file in the theme doesn’t have any syntax errors?

Newer versions of Discourse give you much clearer messages in the case of incorrect json syntax, but I have to ask since I don’t know what version you’re on.

Are you behind Cloudflare?
Do you see any errors in the browser console?

this is the version

and here is the about.json

I am running dicourse in my local lab (on a vm ).

I need the color scheme to be imported along with theme, I tried with local theme export and then import but no luck with the color scheme.

Can you upload the about.json file here, so we can test it?

about.json (590 Bytes)

here the about.json

Importing that works for me. Here’s it wrapped up in a .tar.gz file for import:

test-theme.tar.gz (785 Bytes)

Can you describe the exact steps you are taking which cause the error?

Thank you David, I tried the file uploaded and it worked with me.

Regarding the steps of importing my remote theme as follow and I still face issue.

I used discourse theme CLI and then put in github as private, I then import from the web as bellow

After I click import it take a while then it give me bellow error

Can you try using theme-creator.discourse.org to import the private git theme, and see if you get the same error?

502 is not an error that should be thrown by import issues… it suggests there could be something wrong with your local discourse setup.

successfully imported in http://theme-creator.discourse.org/

So it is about my discourse setup :confounded:

Yes, I think so. How have you configured the development environment? Did you use one of our setup guides?

I actually trying to automate the installation of discourse using Ansible, I followed the official guide to install discourse docker. I Successfully did all things remaining theme importing, I just want to run my ansible role on plan VM and then have docker/discourse installed, configured, admin activated, notification email sitted, and also theme imported.

@david
Thank you for your support, the wrapped up theme in a .tar.gz file works with me and it will be good enough for me to continue.

@david
one thing remaining ,
is there any way to install theme.tar.gz from CLI (through rails or …).
I used discourse theme cli to create may themes. and now I import theme.tar.gz through GUI.

You could do it on the rails console. Take a look at the code for the theme importer to see how:

To import a new theme, I think it would be as simple as

RemoteTheme.update_tgz_theme("/path/to/theme.tar.gz", user: Discourse.system_user)

@david Thanks a million

to whom looking to the same thing, to set the theme as default theme we can use set_default!

s = RemoteTheme.update_tgz_theme( "/path/to/theme.tar.gz", user: Discourse.system_user)
s.set_default!