-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nextcloud): Enable including custom Nginx configurations and show X-Real-IP in Nextcloud logs when Nginx is enabled #1260
Conversation
I'm wondering if we should just add an include directive in the nginx config and let users provide their own configurations. What do you think? |
That would be ideal. I would leave default Cloudflare configuration however since it's used by many users. To reduce the maintenance burden, we can generate the Cloudflare IPs on pod startup. So we could do something like this:
The What do you think ? |
I'm not sure I want having such scripts (eg for updating CF ips). I think nginx will ingore includes if there are not files matched. So we can add it unconditionally, then present a storage option in the UI for nginx confs. As for the apache log formats, what is the default/current format? |
Sure, this can anyways be done outside the app, e.g. with a cronjob.
Sounds good.
This is what's currently configured in #
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent The log format being used in logs is the
It isn't, since we're sending the header from Nginx in
But if it is, then the |
Just saw that nginx isn't always included: it's only included if a certificate ID is provided. So we should only change the Apache LogFormat directives when nginx is included. |
refactor(nextcloud): Only show the `X-Real-IP` header in Nextcloud logs when Nginx is enabled
schema: | ||
type: boolean | ||
default: false | ||
- variable: custom_conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can simplify this a lot.
for example, ix volumes makes no sense here
Also the mount toggle can be omitted and instead have a list of confs to mount.
simple strings.
Then on the compose template, we mount each one like this
/etc/nginx/includes/<idx>.conf
(So it will also be loaded in the same order as defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback. I've made the changes you suggested. Let me know if I understood them right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are failing because the files (custom confs) don't exist. Do you have a way to create them before running the tests? Or should I remove the entries from the custom_confs list?
ix-dev/stable/nextcloud/templates/test_values/https-values.yaml
Outdated
Show resolved
Hide resolved
btw, take a look here #1351 (comment) |
Co-authored-by: Stavros Kois <[email protected]>
From experience, although bundling everything in the same image seems simpler, it ends up being more of a pain in the long run because the image becomes bloated, dependencies are mixed, so changes are harder, which makes maintenance harder too. |
When I say dependencies I mean deps like pdlib, smbclient etc. |
Ah, I see. Makes sense then. While smaller images are usually better, for Nextcloud startup time is more important IMO. I don't see how this will be a breaking change though? |
setup scripts that will configure the instance declaratively. rootless. and due to the huge changes, it won't be able to guarantee non-breaking change. |
ix-dev/stable/nextcloud/CHANGELOG.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add this information on the PR description and remove this file.
There is no plan to have changelogs on the apps UI in the near future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I thought you would given that it's prepared already: https://github.com/truenas/apps_validation/blob/master/catalog_reader/app.py#L167
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, lets address the changelog comment only and merge it.
Thansk
This PR adds an option to include custom Nginx configuration. It also configures Nextcloud logs to show the X-Real-IP header when Nginx is enabled.