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

Add more database config options and other cleanup #1

Merged
merged 2 commits into from
Jul 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions roles/matrix-bot-maubot/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ matrix_bot_maubot_bot_server_public: "https://{{ matrix_server_fqn_matrix }}"
matrix_bot_maubot_proxy_management_interface: false
matrix_bot_maubot_expose_management_interface: true


matrix_bot_maubot_secret: ''
matrix_bot_maubot_admin_user: ''
matrix_bot_maubot_admin_password: ''
matrix_mau_environment_variables_extension: ''
matrix_bot_database_uri: 'sqlite:///data/maubot.db'
matrix_bot_maubot_port: 29316
matrix_bot_maubot_secret: 'generate'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this is a good default, but we should make it have a default.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default for port and database are fine. I don't see why you added matrix_bot_maubot_secret as this should be set by a user and it would be unsafe to have a default value. We currently enforce the user to set it manually which is fine I think


# A list of extra arguments to pass to the container
matrix_bot_maubot_container_extra_arguments: []
Expand Down
16 changes: 8 additions & 8 deletions roles/matrix-bot-maubot/tasks/setup_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
matrix_bot_maubot_matrix_nginx_proxy_configuration: |
location ~ ^/(_matrix/maubot/.*) {
{% if matrix_nginx_proxy_enabled|default(False) %}
{# Use the embedded DNS resolver in Docker containers to discover the service #}
resolver 127.0.0.11 valid=5s;
set $backend "matrix-maubot:{{ matrix_bot_maubot_port }}/$1";
proxy_pass http://$backend;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
{# Use the embedded DNS resolver in Docker containers to discover the service #}
resolver 127.0.0.11 valid=5s;
set $backend "matrix-bot-maubot:29316/$1";
proxy_pass http://$backend;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
{% else %}
{# Generic configuration for use outside of our container setup #}
proxy_pass http://127.0.0.1:{{ matrix_bot_maubot_port }}/$1;
{# Generic configuration for use outside of our container setup #}
proxy_pass http://127.0.0.1:{{ matrix_bot_maubot_port }}/$1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
{% endif %}
Expand Down
6 changes: 4 additions & 2 deletions roles/matrix-bot-maubot/templates/config/config.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# Format examples:
# SQLite: sqlite:///filename.db
# Postgres: postgresql://username:password@hostname/dbname
database: sqlite:////data/maubot.db
database: {{ matrix_bot_maubot_database_uri|to_json }}

# Separate database URL for the crypto database. "default" means use the same database as above.
crypto_database: default
crypto_database:
type: default
postgres_uri: {{ matrix_bot_maubot_database_uri|to_json }}

# Additional arguments for asyncpg.create_pool() or sqlite3.connect()
# https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool
Expand Down