Re-installing and Let's Encrypt

AI-generated summary

In a discussion about re-installing Discourse and Let’s Encrypt certificate handling, JPD asks how to safely reuse an existing Let’s Encrypt certificate during repeated rebuild-app operations to avoid rate limits, noting they experienced a timeout after about four discourse-setup runs. itsbhanusharma clarifies that rebuilds should not reissue certificates unless renewal is due — but warns that wiping and reinstalling the server will cause issues. JPD questions whether “should not” means “will not,” citing their own experience and asking whether commenting out the Let’s Encrypt template lines in app.yml preserves the existing cert or removes HTTPS entirely. pfaffman confirms that commenting out those lines results in no certificate being used, and asks whether JPD’s hostname changed after initial cert issuance — implying stability of hostname is key to certificate reuse. The thread highlights the importance of avoiding unnecessary reinstallation and preserving configuration to prevent hitting Let’s Encrypt rate limits, which can block issuance for days.

If, for any reasons (e.g. due to the failing migrations requiring re-installations or any other “experimenting”) you have to perform a few subsequent rebuild-app’s, what would be the safest way to ensure the already existing Let’s Encrypt cert is re-used and not re-issued?

As I understand (this is what I saw in some post here), after a few tries Let’s Encrypt blocks your cert for some time (days?), hence the question.

Rebuild should not reissue a certificate every time, only when it is due for renewal,

If you are wiping the server and then re-installing discourse then it will become a problem.

Are you sure? I mean, “should not” or “will not”? In my case after probably the 4th discourse-setup within the same existing installation the server finally started to “time-out” (for a few days). There are many posts here advising to use ./discourse-setup when you need to modify setup details, emails etc.
There are those 3 lines in the app.yml:

## Uncomment these two lines if you wish to add Lets Encrypt (https)
  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"

but I’m not sure whether commenting them out means the existing cert will be left/reused or there will be no cert at all.

Did it work and got a certificate and you didn’t change the hostname after that?

You get no cert if you comment them out.