I’m running w/ Docker on Ubuntu on Digital Ocean. I have tried updating the hostname in the app.yml file then doing a launcher rebuild, but it doesn’t change anything. I also tried manually navigating into the directory of the docker container and updating discourse.conf to have the correct hostname and not my IP address, but emails still get sent out with the IP address. What am I missing?
What do you mean … have you pointed the old DNS entry ad /dev/null and the new one at your current discourse ip ?
If the setting did not take you would see incorrect domains in emails, but nothing really on front page hit.
Sorry I wasn’t particularly detailed in my post. The only problem I’m experiencing is the emails sending my current IP address rather than my domain name. I originally entered just my IP address as the host name when setting up the application, as my DNS wasn’t configured yet (I have to get someone else to do that for me as I don’t have access) and everything works, but despite what I’ve done I can’t get the emails to have my domain name rather than just my IP address.
So edit the discourse hostname setting as specified in the install guide, then rebuild the container. Using an IP address as your Discourse name isn’t a good idea; you can access the server via the http://192.168.1.1 IP address regardless.
Yeah that was my stupid mistake, I was just in a hurry and not thinking things through. For whatever reason, updating the hostname setting and rebuilding the container didn’t change what got sent out in the emails, but then I found and tried using force hostname in site_settings.yml and it works fine now.
Force hostname is a developer setting, you should not be using that. You should fix your install.
Similar issue here. Initially I ran discourse with a test hostname. When the new name registered I did the following on the same machine:
- in OLD /var/discourse ./launcher stop app
- mv /var/discourse/ /var/BACKUP/
- mkdir /var/discourse <=== !!! create the whole thing from scratch
- git clone “discourse_url” /var/discourse
- cd /var/discourse
- edited containers/app.yml with the new data, including new DISCOURSE_HOSTNAME
- ./launcher bootstrap app
- ./launcher start app
All is fine but as James says emails are coming from the test domain (IP in his case). Activate account link in the first email points to the OLD test domain. Activation worked but old domain must go! Did some grepping, found old domain name in the following files in the NEW directory /var/discourse:
It must be redis / ruby / rails / docker who remembers the old test hostname!
I found my test domain in /var/lib/docker/devicemapper/devicemapper/data on the host. Looking how to clean docker data. The second installation must have reused some docker bits from the first installation.
using “docker ps” and “docker images -a” found various docker bits. using “docker rm container_ID” and “docker rmi image_ID” - removed everything.
/var/lib/docker/devicemapper/devicemapper/data is still there and still has my old domain name in it…
Thinking what will be faster - install discourse again (with no old container and images), or redeploy the VM.
[root@mymachine /var/discourse]# ./launcher bootstrap app which: no docker.io in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin) Unable to find image 'samsaffron/discourse:1.0.6' locally Pulling repository samsaffron/discourse
Aha! Got you!
I can confirm that the old hostname persists through “./launcher rebuild app” and “./launcher bootstrap app” no matter what it set in containers/app.yml as DISCOURSE_HOSTNAME. Bug?
Same problem here…
I previously installed a server and entered it’s IP address as the hostname. After I got around to setting up a DNS entry I tried to change it the new hostname. It almost works. All the links in the emails etc are correct, but browsing to the server via it’s DNS name redirects to the IP address.The logo image also still links to the IP address (not the hostname).
I followed the instruction here Change the domain name or rename my Discourse? and did this:
- Change hostname in app.yml and rebuilt server (./launcher rebuild app)
- Changed all references in the admin panel from IP to hostname (I used a setting search with the IP addresss so I don’t believe I missed anything).
- Remap and rebake
I haven’t yet started digging into the rails app or docker container.
How can I change hostname in development environment? My upload urls are baked with localhost address…
[update] Seems like /config/discourse.conf only affects production…
I’ve solved this by setting my domain in admin panel
(DEVELOPER ONLY! WARNING! Specify a hostname in the URL. Leave blank for default.
and then running
I can’t get in the admin because I incorrectly setup the domain in the app.yml before building it (I used http://x.y.z instead of http://y.x.z). Should I just set up a new server? Updating the app.yml doesn’t fix where the emails come from.
If you do a
./launcher rebuild the new name will take effect, but it requires a rebuild.
Did a launcher rebuild, everything looks great (here is the output)
+ /usr/bin/docker run -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=3 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e DISCOURSE_HOSTNAME=staging.discourse.jewelbots.com -e 'DISCOURSE_DEVELOPER_EMAILSemail@example.com, firstname.lastname@example.org' -e DISCOURSE_SMTP_ADDRESS=smtp.mandrillapp.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=Jewelbots -e DISCOURSE_SMTP_PASSWORD=oops -e DISCOURSE_SMTP_ENABLE_START_TLS=true -h staging-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 80:80 -p 443:443 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:ae:82:3d:cd:ea local_discourse/app /sbin/boot
However, the email still comes from http://staging.jewelbots.discourse.com
I don’t think the app.yml was updated correctly, because the above says
What does it look like when you edit the
It looks like this:
## TODO: The domain name this Discourse instance will respond to DISCOURSE_HOSTNAME: 'staging.discourse.jewelbots.com'
That IS the correct URL.
The incorrect URL is staging.jewelbots.discourse.com which is where the emails are still coming from.
./launcher rebuild is complete, I can’t think of any reason the old site URL would still be hanging around.
Did you search Admin, Site Settings to see if the old URL form is in any of your site settings?
I can’t get into the admin as the admin has never registered, it’s a new instance. I restarted the server to see if the change was made and no dice.
I’m guessing the best thing to do is nuke this instance and start another?