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

Roundcube user & DB missing in postgresql image #1471

Closed
muhlemmer opened this issue May 1, 2020 · 6 comments
Closed

Roundcube user & DB missing in postgresql image #1471

muhlemmer opened this issue May 1, 2020 · 6 comments
Labels
priority/p0 Critical bug without workaround / Must have type/bug Bug. Not working as intended

Comments

@muhlemmer
Copy link
Member

muhlemmer commented May 1, 2020

#1268 added PostgreSQL support to roundcube. I generate a new config using Setup Utility and select the Mailu provided PostgreSQL image. This sets DB_FLAVOR=postgresql. In turn, Roundcube also goes in PostgreSQl mode and tries to connect to the database service with defaults:

os.environ.get("ROUNDCUBE_DB_USER","roundcube"),
os.environ.get("ROUNDCUBE_DB_PW"),
os.environ.get("ROUNDCUBE_DB_HOST",os.environ.get("DB_HOST","database")),
os.environ.get("ROUNDCUBE_DB_NAME","roundcube")

However, the PostgreSQL startup script does not create this user and DB:

# Mailu user
queries.create_mailu_user(conn)
queries.update_pw(conn, pw=os.environ.get("DB_PW"))
# Healthcheck user
queries.create_health_user(conn)
queries.grant_health(conn)
conn.commit()
# create db cannot be atomic. But this script is the only active connection, this is kinda safe.
if not queries.check_db(conn):
conn.set_isolation_level(0)
queries.create_db(conn)
conn.set_isolation_level(1)
conn.close()

A choice has to be made:

  1. Extend the script (and pg_hba.conf) to add this user and DB. Slight increase in complexity, while we are looking to retire the image.
  2. Change the default roundcube user / DB to mailu & mailu to use current settings. Does Roundcube use prefixed tables?
  3. Start shipping stock PostgreSQL image asap and cleanup the mess. This might take a bit of time and meanwhile this deployment will remain broken. Ship stock PostgreSQL images from setup #1216

Opinions welcome. I'll implement, no worries.

PS: If we ship a stock image for PostgreSQL, by default it only creates 1 user and 1 database which names can be set by environment variables. If we need to use more users, some scripts would still be needed. https://github.com/docker-library/docs/blob/master/postgres/README.md#initialization-scripts

cc: @micw @kaiyou

@dhoppe
Copy link
Contributor

dhoppe commented Jun 8, 2020

I just upgraded from 1.7 to Master because I wanted to test Roundcube including CalDAV and Enigmail.

I would be happy about a solution to this problem and I think Roundcube should use a dedicated database.

@dhoppe
Copy link
Contributor

dhoppe commented Jun 15, 2020

I have solved the problem temporarily by adding the following line to the mailu.env file:

ROUNDCUBE_DB_FLAVOR=sqlite

The last commit was almost a month ago, and for a Docker based project, the last release was also a relatively long time ago.

I also noticed that all Docker images are based on Apline 3.10, which makes tools like Rspamd very outdated. Version 1.9.4 for example was released in May 2019.

I would like to support you in the development of Mailu, but I do not understand why even small pull requests like #1532 are not merged.

@Nebukadneza
Copy link
Member

Nebukadneza commented Aug 16, 2020

Hi There,

The Mailu-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue.

To help with that, we are currently trying to find out which issues are actively keeping users from using Mailu, which issues have someone who want to work on them — and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again.

In order for us to better assess this, it would be helpful if you could put a reaction on this post (use the 😃 icon to the top-right).

  • 👍️ if you need this to be able to use Mailu. Ideally, you’d also be able to test this on your installation, and provide feedback …
  • 🎉 if you find it a nice bonus, but no deal-breaker
  • 🚀 if you want to work on it yourself!
    We want to keep this voting open for 2 weeks from now, so please help out!

@stale
Copy link

stale bot commented Sep 23, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status/response_needed Waiting for a response from the author label Sep 23, 2020
@Diman0 Diman0 added backlog Features or bugs that will be considered for some future release. type/bug Bug. Not working as intended labels Sep 25, 2020
@stale stale bot removed the status/response_needed Waiting for a response from the author label Sep 25, 2020
@lub lub added priority/p0 Critical bug without workaround / Must have and removed backlog Features or bugs that will be considered for some future release. labels Oct 3, 2020
@parisni
Copy link
Contributor

parisni commented May 30, 2021

In order to get both roundcube and mailu on postgresql one have to add those configs to the env. This might be added to the documentation because currently roundcube crashes fallowing the postgres migration docs

ROUNDCUBE_DB_FLAVOR=postgresql
ROUNDCUBE_DB_USER=roundcube
ROUNDCUBE_DB_PW=password
ROUNDCUBE_DB_HOST=host
ROUNDCUBE_DB_NAME=roundcube

bors bot added a commit that referenced this issue Jun 29, 2021
1831: Fix roundcube database env configuration r=mergify[bot] a=parisni

## What type of PR?

bug-fix

## What does this PR do?

Both roundcube and mailu admin website can be backed by postgres/mysql. Before this PR, the `DB_FLAVOR` is shared by both services. However, the other roundcube dedicated DB params are prefixed with `ROUNDCUBE_`. (eg: `ROUNDCUBE_DB_NAME`)
There is no reason to share the DB_FLAVOR for both: This PR makes them be considered independently to make things clear and avoid bugs.
Also, the roundcube_db_flavor and db_flavor are made separated in this PR. However for simplicity, the template generator bind them : roundcube_db_flavor = db_flavor. This makes the template generator UI more simple. I considered most of the time people want to have both roundcube and mailu share the same RDBMS.

Also, AFAIK the internal postgresql service is deprecated and will be removed in 1.9. This is why this PR does not integrate roundcube in postgres when the internal DB is choosen: in case of internal postgres, the roundcube is backed with sqlite.

Both documentation and setup website have been updated accordingly.

### Related issue(s)
- Auto close an issue like: closes #1648 #1471

## Prerequistes
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [X] In case of feature or enhancement: documentation updated accordingly
- [X] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file.


Co-authored-by: parisni <nicolas.paris@riseup.net>
Co-authored-by: Nicolas Paris <nicolas.paris@riseup.net>
@parisni
Copy link
Contributor

parisni commented Jun 29, 2021

Fixed in #1831

@parisni parisni closed this as completed Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/p0 Critical bug without workaround / Must have type/bug Bug. Not working as intended
Projects
None yet
Development

No branches or pull requests

6 participants