Test & activation emails are sent with port 4000 included

AI-generated summary

Test & activation emails are sent with port 4000 included

The issue occurs when a Discourse database is imported from a development environment. apotry reports that test and activation links in emails include port 4000, despite no port being specified in app.yml. codinghorror suggests checking for “WARNING: DEVELOPER ONLY” settings, which are not present in this case (apotry).

The problem is caused by importing a database dump from a development environment (apotry). zogstrip suggests using the discourse remap script to fix the issue.

apotry also notices load times displayed on the left side of the screen, but zogstrip explains that this is normal for administrators in production mode.

The solution is provided by elberet, who suggests running a command to reset SiteSetting.port to an empty string. apotry confirms that this fixes the email issue.

Everthing is working, including e-mail delivery - but: the activation/test links in the emails are of the form:

http://discuss.mysite.com:4000/…

I’ve checked my app.yml and there’s no port 4000 in there. Is the system somehow thinking it’s running in development mode?

Do you have any of the WARNING: DEVELOPER ONLY settings set? Is this installed using our Docker guide?

Installed via Docker, but imported a vBulletin database from inside the development environment (using git clone … → vagrant up → vagrant ssh → ruby script/import_scripts/vbulletin.rb etc.). Inside vagrant I then took a database dump using:

pg_dump -xOf ./discourse-backup.sql -n public discourse_development

Then copied this dump to my production discourse install and did inside psql:

drop schema public cascade;
create schema public;
…
Then on the command line
sudo -u postgres psql -f /shared/discourse-backup.sql discourse

Noticed that the gravatar paths are all wrong as well. Since the vBulletin import took ~8 hours (200 000 posts), I’m reluctant to start over. Can the email-path be edited inside the database (couldn’t find anything doing a simply ‘grep’ on the dump)?

Why didn’t you use the backup/restore feature in Discourse?

The discourse remap script might help you here.

Actually also noticed that the load times (in ms) show up on the left side of the screen. Does that mean my discourse is running in development mode and not in production?

How can I change this?

codinghorror: where do I find the “WARNING: DEVELOPER ONLY” settings?

It’s only displayed for administrators, even in production.

If you search for DEVELOPER ONLY in the site settings and you have results, then you’re definitely running in development mode (we hide them when running in production mode).

No, nothing comes up when I do that - No results found.

But if you imported a database from a development mode import, that setting might be present, I guess.

The odd thing is that it’s port 4000. That’s used for Unicorn, not the dev-mode webserver (which defaults to 3000, as does SiteSetting.port)…

Anyway, try:

/var/discourse/launcher enter app
rails c 
SiteSetting.port = ""
SiteSetting.force_hostname = ""
SiteSetting.queue_jobs = true

SiteSetting.port returned 4000, so setting this to “” fixed the email issue. Thank you!