ente/infra/services/nginx/nginx.service
Manav Rathi e2c894f87f
[infra] Limit the maximum size of the nginx stdout logs
nginx logs to stdout, which is captured by docker and put into a file at
/var/lib/docker/containers/<nginx-cont-id>/<id>-json.log

By default, the size of this file is unbounded. Add a maximum limit of 1 GB to this.

References:
- https://docs.docker.com/config/containers/logging/local/
- https://stackoverflow.com/questions/31829587/docker-container-logs-taking-all-my-disk-space
2024-04-10 09:23:48 +05:30

22 lines
630 B
Desktop File

[Unit]
Documentation=https://www.docker.com/blog/how-to-use-the-official-nginx-docker-image/
Requires=docker.service
After=docker.service
[Install]
WantedBy=multi-user.target
[Service]
ExecStartPre=docker pull nginx
ExecStartPre=-docker stop nginx
ExecStartPre=-docker rm nginx
ExecStart=docker run --name nginx \
--add-host=host.docker.internal:host-gateway \
-p 443:443 \
-v /root/nginx/cert.pem:/etc/ssl/certs/cert.pem:ro \
-v /root/nginx/key.pem:/etc/ssl/private/key.pem:ro \
-v /root/nginx/conf.d:/etc/nginx/conf.d:ro \
--log-opt max-size=1g \
nginx
ExecReload=docker exec nginx nginx -s reload