Skip to content
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

Documentation and examples update for use with docker compose v2 #2201

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

tzerber
Copy link
Contributor

@tzerber tzerber commented Apr 18, 2024

Howdy,

I noticed #2194 and the PR but there are more problems with the examples than just the version parameter. Docker changed the file name requirements too, changed the command and some of the syntax, jwilder's proxy is now part of nginx-proxy and more. This PR addresses those changes, and few others as well.

What was changed:

  1. Docs: ( README.MD ) have commands, file names and examples updated everywhere. Minor edits to match the examples section and links.

  2. Files: All docker-compose.yml files are renamed to compose.yaml files as per docker requirements.

  3. Nginx configuration: I've been following the nginx mailing list since the problems we had with mjs file extension last year, and they wont fix it despite browsers expecting it as text/javascript. I have modified the examples to include mime-types from Nginx to the web container, and removed the "workaround" from the nginx.conf file to keep it as consistent as possible with the official Nextcloud docs. Effectively there is no difference from end user point of view.

  4. MariaDB: - Over the years we have several instances running using MariaDB and experience shows that 10.8.2 works better than 10.6 with recent versions of Nextcloud. I fully understand that it's not LTS release but we had several random problems with 10.6 that caused larger downtimes and then we switched to 10.8.2 in production, no issues whatsoever since then. It is also intentional that I didn't go newer than 10.8.2 because I cannot "promote" something to people that I hadn't tested properly myself. Considering majority of users copy-paste the examples and expect them to be working without issues - I believe this is better.

  5. Redis : I've added it on all the places it was missing. It should be there, all it does is speeding up nextcloud in general.

  6. Logging: Added a limit of 50 megabytes of log files on all containers. Recently I noticed that some instances had their log files grown to some absurd sizes (uptime for more than year without updates/downtime) and I've added that to the examples as well, for the same reason i changed the mariadb version. On few places(proxy containers, to be precise) I have intentionally added the logging driver to be syslog, because it works better with fail2ban on the host machine, it can't do any harm and it can hint to semi-sleeping sysadmins that the machine is under bots attack trying to log-in.

EDIT:

  1. php-fpm nginx config: Added the missing headers in the fpm's nginx.conf and fixed the cache control according to the official NC docs. I thought it was a typo, turns out it was quite cheeky way of adding it properly. Now it matches the official docs.

closes #2200

Copy link
Contributor

@J0WI J0WI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add the logging config everywhere?

volumes:
- certs:/etc/nginx/certs:z,ro
- certs:/etc/nginx/certs:ro:z
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- certs:/etc/nginx/certs:ro:z
- certs:/etc/nginx/certs:ro,z

volumes:
- certs:/etc/nginx/certs:z,ro
- conf.d:/etc/nginx/conf.d:z
- certs:/etc/nginx/certs:ro:z
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- certs:/etc/nginx/certs:ro:z
- certs:/etc/nginx/certs:z,ro

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those :ro:z are still wrong

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@J0WI
Copy link
Contributor

J0WI commented Apr 24, 2024

I have modified the examples to include mime-types from Nginx to the web container, and removed the "workaround" from the nginx.conf file to keep it as consistent as possible with the official Nextcloud docs.

IMHO it's bad to duplicate all default mime.types just to modify a single line. Just adding

types {
    text/javascript mjs;
}

should be enough.

Over the years we have several instances running using MariaDB and experience shows that 10.8.2 works better than 10.6 with recent versions of Nextcloud.

We use whatever Nextcloud recommends in their documenation. We also don't pin minor releases because then somebody would need to take care of updates.

All docker-compose.yml files are renamed to compose.yaml files as per docker requirements.

Fine for me but I'm not sure how used people are to docker-compose.yml and if we should stick with it for a while or if this would be more confusing for those still using docker-compose.

Redis

Initially it wasn't added everywhere because it's optional and to keep the examples simple. But technically a database server is also optional.

Logging

Logging is out of scope for the examples. We shouldn't make any assumptions about their logging system.

@J0WI J0WI added the examples Compose/Dockerfile/etc label Apr 24, 2024
@tzerber
Copy link
Contributor Author

tzerber commented Apr 25, 2024

I have modified the examples to include mime-types from Nginx to the web container, and removed the "workaround" from the nginx.conf file to keep it as consistent as possible with the official Nextcloud docs.

IMHO it's bad to duplicate all default mime.types just to modify a single line. Just adding

types {
    text/javascript mjs;
}

should be enough.

You are quite correct here, this is the most "clean" way of doing it. Instead of adding js and mjs, only mjs is added. Thanks !

Over the years we have several instances running using MariaDB and experience shows that 10.8.2 works better than 10.6 with recent versions of Nextcloud.

We use whatever Nextcloud recommends in their documenation. We also don't pin minor releases because then somebody would need to take care of updates.

I thought so, reverted back to 10.6 as per docs.

All docker-compose.yml files are renamed to compose.yaml files as per docker requirements.

Fine for me but I'm not sure how used people are to docker-compose.yml and if we should stick with it for a while or if this would be more confusing for those still using docker-compose.

Docker put the notice of deprecation of V1 syntax quite a long time ago. As per docker docs and requirements, it must be named compose.yaml or compose.yml and this should have been done long ago. docker-compose.yml is the old V1 syntax and it can create more confusion if people update their docker / docker compose plugin.

More info here and here

Redis

Initially it wasn't added everywhere because it's optional and to keep the examples simple. But technically a database server is also optional.

Logging

Logging is out of scope for the examples. We shouldn't make any assumptions about their logging system.

Removed the logging sections too. While I agree with the fact we should not make assumptions, and people using these should take care of that, I think we might mention this problems with the logs somewhere. On a busy instances with more than few users these logs can get quite large and actually cause problems. Nginx and LE compaion tend to output a lot of stuff, most of the time harmless, but they can pile up if all goes well for longer time periods.

Also fixed the random typos here and there, didn't noticed them the last 3 times I've read the changes.

EDIT: I removed the conf volume. It's also based on some assumptions that shouldn't be assumed. It is usually helpful if someone is injecting additional stuff in the proxy, but in a general-use-case where the proxy is used only for NC, that volume is not needed.

volumes:
- certs:/etc/nginx/certs:z,ro
- conf.d:/etc/nginx/conf.d:z
- certs:/etc/nginx/certs:ro:z
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those :ro:z are still wrong

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@J0WI
Copy link
Contributor

J0WI commented May 13, 2024

I thought so, reverted back to 10.6 as per docs.

Removed the logging sections too.

Needs to be reverted in the README too

@schnillerman
Copy link

schnillerman commented May 16, 2024

I still have the mjs problem and spent 4 hours yesterday (just to say I'm not just lazily expecting help) to see how modifying nginx.conf might help with the well known error message about the mjs mime type. No success. I only mount the nginx.conf specifically in the container from outside, not the mime.types.

I'm working off of this one with the fpm alpine docker compose:

.examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf

Some of the posts I read through suggest it has something to do with DNS / domain entries, but a curl to an mjs file from inside the container yields results, so it doesn't seem it's a URL issue.

@tzerber
Copy link
Contributor Author

tzerber commented May 16, 2024

I still have the mjs problem and spent 4 hours yesterday (just to say I'm not just lazily expecting help) to see how modifying nginx.conf might help with the well known error message about the mjs mime type. No success. I only mount the nginx.conf specifically in the container from outside, not the mime.types.

I'm working off of this one with the fpm alpine docker compose:

.examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf

Some of the posts I read through suggest it has something to do with DNS / domain entries, but a curl to an mjs file from inside the container yields results, so it doesn't seem it's a URL issue.
Hi,

Use the nginx.conf from this commit, it works fine without the need of mounting the mime-types file. ->> 05353cf

Signed-off-by: Kaloyan Nikolov <[email protected]>
@tzerber
Copy link
Contributor Author

tzerber commented May 16, 2024

I thought so, reverted back to 10.6 as per docs.

Removed the logging sections too.

Needs to be reverted in the README too

Reverted the README me, my bad. Also removed the GH-specific markdown. Fixed the little ":" too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Compose/Dockerfile/etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs and examples update, again
3 participants