Discourse_enable_cors

AI-generated summary

The discussion revolves around whether the DISCOURSE_ENABLE_CORS environment variable can be set on a running self-hosted Discourse site without rebuilding the app image. csmu asks about this, and pfaffman explains that it’s possible by destroying and restarting the app container, though csmu reports the change didn’t take effect. csmu concludes they had to rebuild. pfaffman suggests a two-container setup to minimize downtime, mentioning a future less expensive option. csmu considers building the image on a different device, and pfaffman clarifies that the two-container method achieves this by keeping the old container running during the build process, reducing downtime to about a minute.

Can DISCOURSE_ENABLE_CORS be set on a running discourse self-hosted site without rebuilding the app image?

I don’t think that the environment variable is used in the rebuild, so you should be able to do this:

./launcher destroy app
./launcher start app

You can do it on a single line with a ; between the two commands. Your site will be down for about a minute while the new container starts up.

Looks like that failed to change.

/var/discourse/launcher destroy app;/var/discourse/launcher start app 

+ /usr/bin/docker stop -t 10 app

app

+ /usr/bin/docker rm app

app

 ./launcher enter app

app:/var/www/discourse# echo $DISCOURSE_ENABLE_CORS

true

Ended up doing a rebuild.

If it’s the downtime that’s bumming you out, you should move to a two container setup so that downtime is under a minute. I currently charge a premium for this but may have a less expensive offering in the next month.

Cool :slight_smile:

The downtime is a slight hassle and I was wondering about doing a build on a different device and moving that image over.

That’s sort-of what the two-container thing does. It leaves the old web container running while it builds the new one (and migrates the database and such). When the new image is built, you destroy the old image and crank up the new one. Down time is about a minute.