julienfastre / docker-sogo

Run sogo in a docker container.
GNU General Public License v2.0
28 stars 14 forks source link

Database initialisation steps #4

Closed Simon-L closed 7 years ago

Simon-L commented 7 years ago

Hello, thank you for that image!

I'm having a problem setting up this image using Postgres, views aren't created.

It isn't clear what is made automatically by sogo when views/tables are missing. From what I could understand, creating the role has to be done with that image: https://sogo.nu/files/docs/SOGoInstallationGuide.html#_database_configuration So I did this, first running docker-compose up and then creating the role: docker exec in the db container, running the commands and then restarting with docker-compose.

When restarting, SOGo picks up some missing views and creates these: sogo_user_profile and sogo_folder_info. I then try to login but it isn't working and am getting an error with that view:

sogo_1       | 2017-05-20 14:26:26.697 sogod[7] PostgreSQL72 channel 0x0x556712c4cd50 opened (connection=<0x0x556712ca86c0[PGConnection]:  connection=0x0x556712cdd0a0>)
sogo_1       | 2017-05-20 14:26:26.698 sogod[7] PG0x0x556712c4cd50 SQL: SELECT c_password FROM sogo_view WHERE c_uid = 'jdoe'
sogo_1       | May 20 14:26:26 sogod [7]: [ERROR] <0x0x556712c2e440[SQLSource]> could not run SQL 'c_uid = 'jdoe'': <PostgreSQL72Exception: 0x556712bd9db0> NAME:PostgreSQL72FatalError REASON:fatal pgsql error (channel=<0x0x556712c4cd50[PostgreSQL72Channel]: connection=<0x0x556712ca86c0[PGConnection]:  connection=0x0x556712cdd0a0>>): ERROR:  relation "sogo_view" does not exist
sogo_1       | LINE 1: SELECT c_password FROM sogo_view WHERE c_uid = 'jdoe'

But as stated in another issue, some tables are created automatically. Is it the case for sogo_view ? ° Can you also confirm that "jdoe" and "qwerty" are still the default credentials for this image?

Thanks in advance!

Related: #2

julienfastre commented 7 years ago

Hi,

If this is a role issue, the default user and password is postgres and postgres.

But you can customize those password using the variables POSTGRES_PASSWORD and POSTGRES_USER (have a look at the image documentation.

But I am not sure that I could understand well your problem: are you asking how and where to configure the login/password for users ? Or something else ?

(do not forget to re-start sogo using docker-compose up --force-recreate, or docker-compose rm sogo before a restart).

Simon-L commented 7 years ago

Indeed I can see why my explanation was a little confusing.

Simply put, I'm asking if the columns c_uid, c_name, c_password, c_cn and mail have to be added manually to the sogo_view table ?

These names are taken from https://github.com/julienfastre/docker-sogo/blob/master/sogo.default.conf#L87 and https://sogo.nu/files/docs/SOGoInstallationGuide.html#_authentication_using_sql

julienfastre commented 7 years ago

Yes, you will have to create your authentication backend manually. This image does not provides any authentication mechanism.

I have never configured sogo with a SQL authentication. If you have some schema or documentation that could improve this repository, do not hesitate to make a PR.

Simon-L commented 7 years ago

Hello,

I could configure SQL authentication with informations found on this wiki page: https://wiki.debian.org/SOGo

The interesting part is the "start mysql" section in the big bash script. For this image setup, sogo_users has to be changed to sogo_view. Only the CREATE TABLE and INSERT INTO lines were needed. Obviously, SQL auth has to be set in SoGO config, also it's best to allow password change for users, also found in SoGO config.

I will see if I can find some time to do a PR including this to the README.

Thank you!