ONLYOFFICE / Docker-DocumentServer

ONLYOFFICE Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
GNU Affero General Public License v3.0
1.48k stars 508 forks source link

K8S, Need a bare-bones Dockerfile for ONLYOFFICE - no bundled services, just the core, any help? #773

Open gowy222 opened 2 months ago

gowy222 commented 2 months ago

Hey ONLYOFFICE team, I'm trying to deploy ONLYOFFICE in a Kubernetes environment, and current Dockerfile is overkill. It's packing a bunch of services I don't need.

Potential improvement to consider: A Dockerfile that builds ONLY the ONLYOFFICE core No bundled database services (PostgreSQL, MySQL) No bundled message queue (RabbitMQ) No bundled cache (Redis) No bundled web server (Nginx)

Why? using external cloud services for all of the above K8S handles load balancing, so no need for Nginx Current Dockerfile is too heavy and inflexible for K8S deployments

The ideal Dockerfile would: Build core ONLYOFFICE components Include only necessary DB client libs (for PostgreSQL/MySQL) Skip all other service installations

This would make ONLYOFFICE way more flexible for cloud-native deployments. Simplified maintenance and updates easily connect it to any external services.

Thanks for considering this! It would be a huge help for K8S users.

igwyd commented 2 months ago

Hello @gowy222, i think you looking for this repository https://github.com/ONLYOFFICE/Kubernetes-Docs and the images form here https://github.com/ONLYOFFICE/Docker-Docs.

gowy222 commented 2 months ago

Hello @gowy222, i think you looking for this repository https://github.com/ONLYOFFICE/Kubernetes-Docs and the images form here https://github.com/ONLYOFFICE/Docker-Docs.

First of all, thank you very much. I studied https://github.com/ONLYOFFICE/Docker-Docs/blob/master/Dockerfile.noplugins, but I am still confused

  1. As for the basic ds-service, what is the purpose of rpm2cpio? Python:2.7 is also required to install redis. If a third-party cloud redis is used, can this step be ignored? Secondly, nginx seems to be forced to be built-in. Considering the external third-party gateway load balancing and the later migration of rust gateway (such as Pingora), is there a chance to isolate the nginx layer independently, so that it is convenient to customize the use of other load balancing and proxy gateways later? The biggest difficulty at present is https://github.com/ONLYOFFICE/Docker-Docs/blob/master/proxy-docker-entrypoint.sh and https://github.com/ONLYOFFICE/Docker-Docs/blob/master/docker-entrypoint.sh. These two need to be fully understood and related before secondary customization

  2. Regarding fonts, documentserver-generate-allfonts.sh true, I prefer to use dockerfile to build fonts in multiple stages independently, and then copy fonts between stages, especially Chinese fonts, and open source finished fonts can be copied between them. I hope to reduce the size of docker images

  3. The rest of the research is not clear yet.. It needs to be studied continuously, and it is a little complicated overall

  4. It seems that there is no way to build completely independently and modularly at present. Each stage is closely related to each other. One wrong step may cause the rest to not work

  5. Of course, if there is a chance, I hope to use ubuntu/debian to build, amazonlinux:2 is not very familiar

the end: I have an idea, for example, the onlyoffice service is independent, simplified, and not bound to anything.

Then the second independent image is used as a gateway entry and launcher to start and configure the onlyoffice service and document conversion service, how to start, how to connect to the corresponding database, etc.

This has an advantage, no matter how the onlyoffice version is updated, this is independent and deployed separately. Therefore, there is no need to come back to study whether the sh script is adapted every time a cross-version update is made.

igwyd commented 2 months ago

Python:2.7 is also required to install redis. If a third-party cloud redis is used, can this step be ignored?

yes, you can ignore it because it was added for other k8s distribution - https://github.com/ONLYOFFICE/Kubernetes-Docs-Shards

Secondly, nginx seems to be forced to be built-in

nginx is separated container, builds as proxy

Regarding fonts

For adding your fonts - guide is here https://github.com/ONLYOFFICE/Docker-Docs?tab=readme-ov-file#building-onlyoffice-docs

Of course, if there is a chance, I hope to use ubuntu/debian to build, amazonlinux:2 is not very familiar

It's because we use RPM here

About the rest - i have forwarded your comments to the developers.

gowy222 commented 2 months ago

@igwyd

HI, I've been analyzing the dockerfile https://github.com/ONLYOFFICE/Docker-Docs/blob/master/Dockerfile.noplugins and still have a few questions and challenges that I'd like your assistance with.

I have retained the key stages:

ds-base
ds-service
docservice
converter
proxy

I have removed the non-essential stages:

redis-lib
builder
utils
metrics
db
example

After these changes, I have a few questions:

  1. Including Client Libraries for External Services: In the original Dockerfile, client libraries for Redis and databases (e.g., redis, psycopg2, PyMySQL, pika) are installed in separate stages (redis-lib, builder, utils) and then copied into the service stages. Since I have removed these stages, I understand that I need to install these client libraries elsewhere to ensure that docservice and converter can connect to external services. Question: Where and how should I install the necessary client libraries in the slimmed-down Dockerfile? What is the recommended way to include them to ensure proper functionality?

  2. Purpose of builder and utils Stages: The builder stage installs various Python client libraries, and its outputs are used in the utils stage. However, the utils stage is not referenced in subsequent stages. Are the builder and utils stages necessary for the core functionality of ONLYOFFICE Document Server, or can they be safely removed without impacting essential services?

Any insights or assistance on these points would be greatly appreciated. Thank you again.

igwyd commented 4 weeks ago

Including Client Libraries for External Services:

You don't need the libs we install for Python for utils image and redis-lib for docservice. It do not need to be installed in other places either, because all the necessary libraries for connecting to dependencies are in the documentserver.

Purpose of builder and utils Stages:

They are not required for the documentserver. These are used to build the docs-utils image, which is used in Helm Docs in Jobs and helm test. You can get docs-utils in the docker hub if you need, so you can just delete the steps with redis-lib, builder и utils