tom1984 set up a non-Docker Discourse dev environment on Ubuntu 22.04.3, manually installing Node.js, Ruby, and ImageMagick from source after encountering version issues. Despite successful setup, user avatar uploads failed: the image appeared in the upload dialog but reverted to the default avatar after saving, while topic images worked fine. merefield suggested checking avatar URLs via browser dev tools and noted potential WSL networking issues, though tom1984 clarified they were using Ubuntu VM, not WSL. Further investigation revealed the avatar URL used 127.0.0.1 instead of localhost, which tom1984 fixed via Rails console by setting SiteSetting.force_hostname = "localhost" and SiteSetting.port = 4200. Still no success, so tom1984 checked development.log and found ImageMagick lacked JPEG delegate support. After uninstalling ImageMagick, installing required JPEG and other image libraries (libjpeg-turbo8-dev, etc.), and reinstalling ImageMagick from source with proper configure flags, avatar uploads began working. tom1984 admitted they’d overcomplicated the issue by focusing on hostname mismatches instead of basic ImageMagick configuration, but ultimately succeeded after learning valuable lessons.
Install imagemagik manually, the latest version (make sure you go to the " Install latest version of ImageMagick from the source code (for advanced and desperate users)" section: https://itsfoss.com/install-imagemagick-ubuntu
Only after all of this was I able to log on to the instance….
So after spending the entire day getting the dev instance up and running, I was pretty pleased…everything seems to be ok, except uploading avatars. Specifically, as a user I can upload an avatar and in the avatar upload box it shows correctly, but when I click save it just displays the placeholder avatar…..no errors in log…
this is quite important to me as I set up the dev instance to test a migration and one of those tests is that it gets avatars …so I want to make sure they work before going ahead with a test import.
Uploaded images in topics appear correctly, no issue
Make sure you are starting your local server with FORCE_HOSTNAME=localhost:4200 bin/ember-cli -u
It’s better to use a test instance in the cloud to mimic your final destination … in fact, I would recommend you test migrations in the cloud ultimately.
I’m so tired after spending the entire day getting this local dev environment to where it is, I can’t bring myself to think it was all pointless now thought I was there!
My thought process for a local dev environment was:
run the import script locally, backup discord, put it on the proper cloud production instance when all looks good…
First problem - avatar path was ip address 127.0.0.1 whereas all the other urls were localhost - would that make a difference? I changed it anyway, by going into rails c (as it didn’t seem to pick the parameters up from the command line to start discourse (FORCE_HOST=localhost etc), they were blank in rails.
rails c
SiteSetting.force_hostname = "localhost"
SiteSetting.port = 4200
exit
then avatar paths were localhost and not ip address after I restarted the site. Avatars still weren’t working though.
further investigation of logs as soon as I did an avatar import:
tail -n 200 log/development.log
revealed:
convert: no decode delegate for this image format jpeg:/home/bob/discourse/public/uploads/default/original/1X/92bb0d46e6a4b8a1333505b9d2da59a5ed1721ec.jpeg[0]' @ error/constitute.c/ReadImage/752.\nconvert: no images defined jpeg:/tmp/discourse-thumbnail20260202-4096-qjyo93.jpeg' @ error/deprecate.c/ConvertImageCommand/3368.\n">
and after some digging I found out that it was because I had installed imagemagick but not the jpeg delegates FIRST. uninstalled Imagemagick, installed jpeg delegates (and others):
restarted the discourse server and avatars instantly worked
I’m annoyed at myself for getting fixated on the ip/locahost url references instead of checking the basics….but there we go, I learned quite a bit in the last couple of days and it’s working now