# Best practices for customizing deployment

**URL:** https://meta.discourse.org/t/best-practices-for-customizing-deployment/290048
**Category:** Self-hosting
**Created:** [December 29, 2023, 9:25pm UTC](https://meta.discourse.org/t/best-practices-for-customizing-deployment/290048 "2023-12-29T21:25:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![aas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aas/32/289331_2.png) [@aas](https://meta.discourse.org/u/aas)
#### Post date: [December 29, 2023, 9:25pm UTC](https://meta.discourse.org/t/best-practices-for-customizing-deployment/290048/1 "2023-12-29T21:25:27Z")

</div>

It is common to edit `app.yml` in order to tweak Discourse settings.

Additionally, in [How to avoid throttling limits with admin API key? - #7 by aas](https://meta.discourse.org/t/how-to-avoid-throttling-limits-with-admin-api-key/274206/7) I discovered that I need to modify the nginx config to avoid rate-limiting API requests.

My question is, what are the recommended best practices for things like:

- Versioning files such as `app.yml`
  - I’d need to version it outside of `/var/discourse` and move it to `/var/discourse/containers/` any time I change it.

- Modifying, overriding, or adding new templates
  - [templates/web.ratelimited.template.yml](https://github.com/discourse/discourse_docker/blob/fcce1376043adeb09e21ec1ec079a41e4d29fe6e/templates/web.ratelimited.template.yml) is not ignored bit git. While it hasn’t changed for 6 years, editing it directly doesn’t seem wise. It is possible that `./launcher rebuild` would clobber it. Or the `git pull` commands would fail.

**Possible solution** :

- Create my own git repo with `app.yml` and a template.
- Write a GitHub action that uses Ansible to copy `app.yml` into `/var/discourse/containers/` and also copies the template to the server running Discourse
  - in this case, I could remove [templates/web.ratelimited.template.yml](https://github.com/discourse/discourse_docker/blob/fcce1376043adeb09e21ec1ec079a41e4d29fe6e/templates/web.ratelimited.template.yml) from the templates section of `app.yml` and replace it with my own template.

**Questions**

- Where would be a good place to put my custom template?

---

<div class="post-metadata">

### Author: ![aas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aas/32/289331_2.png) [@aas](https://meta.discourse.org/u/aas)
#### Post date: [December 29, 2023, 9:28pm UTC](https://meta.discourse.org/t/best-practices-for-customizing-deployment/290048/2 "2023-12-29T21:28:11Z")

</div>

> [@aas](#):
>
> Where would be a good place to put my custom template?

It looks like I can add `replace` sections directly to `app.yml` instead of using templates as mentioned here:

> [@How can I update nginx.conf without resetting it on rebuild?](https://meta.discourse.org/t/how-can-i-update-nginx-conf-without-resetting-it-on-rebuild/48102/2):
>
> You have to use replace commands in your app.yml to make the edits to the config files as part of the build process. There’s [lots of examples in the discourse\_docker repo](https://github.com/discourse/discourse_docker/search?utf8=%E2%9C%93&q=replace).

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [December 30, 2023, 12:14am UTC](https://meta.discourse.org/t/best-practices-for-customizing-deployment/290048/3 "2023-12-30T00:14:17Z")

</div>

Yes you can say with App.yml you can create backup copies and name them as per your needs

If your changing a particular section you can also add comments. Myself as self hosted I have my plugins organized by official, pavilion and other. I add a comment when installing a new plugin in the appropriate section.

Others though may have better ideas than mine.
