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

[Kubernetes] Allow passing pre-generated, readonly configuration files into Seafile container #332

Open
NiklasRosenstein opened this issue Mar 5, 2023 · 3 comments

Comments

@NiklasRosenstein
Copy link

Hi 👋 I'm trying to run Seafile Pro on Kubernetes by installing it via a handcrafted Helm chart.

The issue I am encountering is that Seafile attempts to generate configuration files on startup. The environment variables that can be used to influence that config-generation step are not sufficient (such as S3 configuration), so I would like to generate the configuration files via Helm and put them into the appropriate place.

However, I can't get Seafile to not try and generate these files, and it always fails with en error like this:

Traceback (most recent call last):                                                                                                                                                                                                       File "setup-seafile-mysql.py", line 1598, in <module>                                                                                                                                                                                    main()                                                                                                                                                                                                                               File "setup-seafile-mysql.py", line 1547, in main                                                                                                                                                                                        seafile_config.generate()                                                                                                                                                                                                            File "setup-seafile-mysql.py", line 933, in generate                                                                                                                                                                                     with open(self.seafile_conf, 'w') as fp:                                                                                                                                                                                           OSError: [Errno 30] Read-only file system: '/opt/seafile/conf/seafile.conf'        

That's because the configuration files are mounted into the container by Kubernetes.

# ...
            - mountPath: /shared/seafile/conf/ccnet.conf
              name: seafile-conf
              subPath: "ccnet.conf"
              readOnly: true
            - mountPath: /shared/seafile/conf/seafile.conf
              name: seafile-conf
              subPath: "seafile.conf"
              readOnly: true
            - mountPath: /shared/seafile/conf/seafdav.conf
              name: seafile-conf
              subPath: "seafdav.conf"
              readOnly: true
            - mountPath: /shared/seafile/conf/seahub_settings.py
              name: seafile-conf
              subPath: "seahub_settings.py"
              readOnly: true

Setting them to readOnly: false doesn't help. When the container restarts, those changes would be lost but Seafile is not going to configure itself another time. Also it would require that the container "merges" with the existing configuration and prefers it.

Ideally there would be an option for the container to entirely skip config generation, yet Database initialization should still happen.

It would also need to skip any Mysql "root" checks, as I wouldn't be giving it any root credentials. I can make sure the seafile user exists when Seafile starts up.

@mjohnson9
Copy link

Did you find a suitable solution to this? I'm running into the same inflexibility.

@SkywalkerSpace
Copy link
Contributor

@NiklasRosenstein
Copy link
Author

Did you find a suitable solution to this? I'm running into the same inflexibility.

I've built my own Seafile container image that allows me to mount config as a read only file and runs only one Seafile service per container.

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

No branches or pull requests

3 participants