How can I change this and have it retained across upgrades ?
If I edit the web.template.yml in /var/discourse/templates I get a problem pulling new versions.
The discussion revolves around changing the nginx log rotation period in a Discourse Docker setup. gearoid initially asks how to modify the log rotation period and retain the changes across upgrades. tgxworld suggests adding commands to the container file, and sam clarifies that custom commands can be run after the default commands, allowing persisted changes.
However, gearoid points out that editing the /etc/logrotate.d/nginx file in the container would not persist changes after a rebuild. sam advises against editing supplied templates and suggests using an after hook instead.
sam provides examples of using hooks in web_only.yml and web.template.yml. However, gearoid discovers that there is no hook available after logrotate’s configuration in web.template.yml. As a workaround, gearoid proposes using the custom commands section in app.yml.
sam invites gearoid to submit a pull request to add a hook if needed.
How can I change this and have it retained across upgrades ?
If I edit the web.template.yml in /var/discourse/templates I get a problem pulling new versions.
You can add the commands to change the rotation period in your container file ![]()
In app.yml ?
Any pointer to where I can see what I need to change or how to do this ?
— EDIT ----
Ok - I figure that logrotate is being used, I can see /etc/logrotate.d/nginx in the container.
If I edit that file in the container won’t it get destroyed when I rebuild my container and I’ll have to redo the change ?
You run your commands AFTER we run our commands, so you can change whatever and have it persisted.
Just in case I’ve got the wrong end of the stick, I need to make my change in the container in /etc/logrotate.d/nginx ?
If so - when I rebuild the container the configuration change will be lost. It’s not persisted outside the container like configuration I specify in app.yml. I need to write and run a script of my own to maintain my configuration.
Nope, you would use an after hook never edit supplies shared templates
OK - I can hook into the rebuild process after your commands ?
How and where do I do that - apologies for not being familiar with all the ins and outs of how discourse is building the containers.
Eg:
injects after:
Fantastic - I get it now ![]()
Looking at web.template.yml there’s no hooks after logrotate’s configuration
Is the custom commands section of my app.yml a suitable location to put this until there’s a hook I can use ?
## Remember, this is YAML syntax - you can only have one block with a name
run:
- exec: echo "Beginning of custom commands"
feel free to do a PR to add a hook there if you need.