Skip to content

Use standard Docker logs#3333

Merged
dvikan merged 1 commit intoRSS-Bridge:masterfrom
Alkarex:patch-1
May 10, 2023
Merged

Use standard Docker logs#3333
dvikan merged 1 commit intoRSS-Bridge:masterfrom
Alkarex:patch-1

Conversation

@Alkarex
Copy link
Contributor

@Alkarex Alkarex commented Mar 27, 2023

Instead of storing logs inside the container (where they cannot easily be seen nor rotated), consider using the standard Docker approach of writing to standard output https://docs.docker.com/config/containers/logging/

Instead of storing logs inside the container (where then cannot easily be seen not rotated), consider using the standard Docker approach of writing to standard output
https://docs.docker.com/config/containers/logging/
@Alkarex
Copy link
Contributor Author

Alkarex commented Mar 27, 2023

P.S. Ah, it is another regression due to #2721

It used to be correct as it was using a production-ready base-image https://github.com/docker-library/php/blob/3dc959846f1d44d6c3200f657dee762885847a2c/8.2/buster/apache/Dockerfile#L84-L87

@dvikan
Copy link
Contributor

dvikan commented Mar 27, 2023

Aha. Maybe just omit the error_log and access_log then?

@Alkarex
Copy link
Contributor Author

Alkarex commented Mar 27, 2023

I have not tested, but I believe omitting those lines would use default global values, which are not that
https://nginx.org/en/docs/http/ngx_http_log_module.html

@Bockiii
Copy link
Contributor

Bockiii commented Mar 28, 2023

Change is fine, I just tested it locally. Will reroute logs to stdout and stderr to be read by docker logs

@Bockiii
Copy link
Contributor

Bockiii commented Mar 30, 2023

I did some thinking. I think it's better to make this configurable by env variable. Keep the default logs as it is, add an env variable "rsslogging=docker" or so to sed the path in nginx.

I assume that there are people out there that have mounted their logfiles to the host to have them analyzed by awstats/goaccess or so. It would break those setups and require us to then make the other approach optional.

Can you redo the PR to check for an env variable and replace the text in nginx.conf if its set? you can use the docker entrypoint script

@Alkarex
Copy link
Contributor Author

Alkarex commented Mar 30, 2023

The breaking change came with #2721 as it used to be correct before (that PR did break my setup).
I suggest to follow common practices by default. The custom log paths since the breaking PR are not documented anyway.
As it is now, it is not production ready. For instance, the logs are growing uncontrolled inside the container until the disc is full or until the next update (in which case the logs are lost).
But I see your point, and rather than an environment variable, I suggest to go back to how it was done before, i.e. with a symlink, allowing the standard STDOUT behaviour out of the box, as well as custom volumes:

https://github.com/docker-library/php/blob/3dc959846f1d44d6c3200f657dee762885847a2c/8.2/buster/apache/Dockerfile#L84-L87

@dvikan
Copy link
Contributor

dvikan commented May 10, 2023

Alright I think we should go for writing to stdout/stderr by default in the docker container.

Remember that we are talking about the nginx processes here.

We can write to files from within the php app if we really want to.

Regarding @Bockiii concern, we can make a note about this change in the next release.

Who wants to make a pr?

@dvikan
Copy link
Contributor

dvikan commented May 10, 2023

oh lol this is a pr. Im gonna merge

@dvikan dvikan merged commit e99e026 into RSS-Bridge:master May 10, 2023
@Alkarex Alkarex deleted the patch-1 branch May 11, 2023 07:22
Alkarex added a commit to Alkarex/rss-bridge that referenced this pull request Jul 6, 2023
* Fix expose RSS-Bridge#3234
* Re-fix better logs RSS-Bridge#3333
* Update to Debian 12 Bookworm instead of Debian 10 Buster
* Use Debian packaging instead of having to keep track of and manually install -dev libraries, and with LTS support
* Update to PHP 8.2 instead of PHP 8.0
@Alkarex
Copy link
Contributor Author

Alkarex commented Jul 6, 2023

dvikan pushed a commit that referenced this pull request Sep 13, 2023
* Docker from Debian base image
* Fix expose #3234
* Re-fix better logs #3333
* Update to Debian 12 Bookworm instead of Debian 10 Buster
* Use Debian packaging instead of having to keep track of and manually install -dev libraries, and with LTS support
* Update to PHP 8.2 instead of PHP 8.0

* Fix php.ini location

* Minor order changes
To optimise caching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants