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

Possible to use seafile with an existing MariaDB server instead of extra container? #6

Closed
AlexanderProd opened this issue Mar 27, 2021 · 2 comments

Comments

@AlexanderProd
Copy link

AlexanderProd commented Mar 27, 2021

Hi Gerrit,

I'd like to run seafile with an existing MySQL server instead of spinning up an extra MariaDB docker container just for that.

According to this manual I'd have to create three databases (ccnet_db, seafile_db, seahub_db) and a user. (I don't have root rights on my SQL server, therefore using method two.)

Now I'm wondering if it is possible to pass information like host server and database names as well as the user credentials to seafile using env variables.

Obviously I could just follow the manual but I'd like to keep running seafile and everything else inside a container just not the database.

Thanks for your help
Alex

@ggogel
Copy link
Owner

ggogel commented Mar 27, 2021

Hi Alex,

somebody asked this over at reddit. It sounded like it was quite a hassle for him but it is doable. First you need to make sure that seafile-server and seahub can access the external database, by not declaring their network as internal or by defining an additional external network.

In initialization, seafile takes the root credentials from the environment variables and initializes the database by creating the tables and a db user. The user is always called seafile and has a randomly generated password. The db host as well as the created db credentials are written into seahub.conf, ccnet.conf and seahub_settings.py.

So you can only define the db host and db root user for first initialization. Once this is done, those variables do nothing. If you would have root access, you could simply leave the db service out and define your server and credentials instead. Without root access, it's getting tricky though.

I would try to run the first setup with the db service such that it generates the whole config. Then change the db host in all three config files and create a user in your db that matches the username and password in the config files. Then throw out the db service and redeploy. You might also need to copy over the contents of the tables. Though it could be that simply creating the empty tables is enough. I'm not sure about this.

@AlexanderProd
Copy link
Author

Thanks a lot for your detailed reply and pointing out that thread on reddit. That helped me quite a lot!

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

2 participants