How to change nginx log rotation period

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.

1 Like

You can add the commands to change the rotation period in your container file :slight_smile:

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.

3 Likes

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:

https://github.com/discourse/discourse_docker/blob/master/samples/web_only.yml#L69-L70

injects after:

https://github.com/discourse/discourse_docker/blob/master/templates/web.template.yml#L83

2 Likes

Fantastic - I get it now :slight_smile:

Looking at web.template.yml there’s no hooks after logrotate’s configuration
https://github.com/discourse/discourse_docker/blob/master/templates/web.template.yml#L202

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.

3 Likes