mattermost / docs

Mattermost documentation
https://docs.mattermost.com
BSD 3-Clause "New" or "Revised" License
210 stars 580 forks source link

Help Wanted: Cannot connect to AWS Lightsail Postgres instance with sslmode=disable #6760

Closed tleyden closed 3 weeks ago

tleyden commented 1 year ago

Summary

The sslmode=disable as suggested by the instructions don't seem to be compatible with AWS Lightsail Postgres instances.

Steps to reproduce

  1. Create an AWS Lightsail Postgres instance
  2. Follow instructions to setup mattermost database
  3. Follow instructions to update mattermost config to use database.

Expected behavior

It should be able to connect to the database

Observed behavior (that appears unintentional)

It gives the following error:

Nov 03 16:20:03 ip-172-26-5-245 mattermost[6201]: {"timestamp":"2023-11-03 16:20:03.028 Z","level":"error","msg":"failed to initialize platform: cannot create store: error setting up connections: pq: no pg_hba.conf entry for host \"172.26.5.245\", user \"mmuser\", database \"mattermost\", no encryption","caller":"commands/server.go:76"}

Note that AWS Lightsail is a managed postgres and does not allow direct control over pg_hba.conf

Possible fixes

Workaround: Changing the config to sslmode=require worked for me.

Fix: Update the docs to mention that the sslmode setting may depend on your particular environment.

QA Validation Criteria

In a generated docs preview:

cwarnermm commented 1 year ago

Thanks, @tleyden, for logging this issue. Are you open to creating a docs PR with your proposed changes?

tleyden commented 1 year ago

Yes @cwarnermm I can create a docs PR, but it might be good if someone more familiar with these settings could review it. I was literally just doing "trial and error" to get it working 😄

cwarnermm commented 1 year ago

Understood completely, @tleyden! I would welcome your help with this docs PR and can ensure it's reviewed by Engineering for technical accuracy. Thank you!

tleyden commented 1 year ago

@cwarnermm Are there any instructions on creating the docs PR? Is this the repo? https://github.com/mattermost/mattermost-developer-documentation

cwarnermm commented 1 year ago

Great question! The easiest way to get started with a docs PR is to visit the page that needs an update and select the Edit on GitHub option located in the top right corner of the docs page. That will take you directly to the correct repository and source file in GitHub.

Rutam21 commented 6 months ago

@cwarnermm I would love to take this up. Feel free to assign this to me. Thanks.

As per my understanding, we just need to add a Note on that particular section in the Install Ubuntu stating that the sslmode setting depends on the working environment and one needs to refer to the native environment docs to figure it out We can also add an example of the Lightsail in the Note.

Let me know if you have any further suggestions.

Rutam21 commented 3 weeks ago

@cwarnermm If this issue is still relevant and we want to publish the above discussed solution to the Docs, I would like to work on this. Feel free to assign this to me.

cwarnermm commented 3 weeks ago

Thanks, @Rutam21!