-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
postgres: create databases for all services #740
postgres: create databases for all services #740
Commits on Dec 10, 2020
-
WIP: postgres: create databases for all services
If a service is enabled, a database for it is created in postgres with a uniqque password. The service can then use this database for data storage instead of relying on sqlite.
Configuration menu - View commit details
-
Copy full SHA for d9f4914 - Browse repository at this point
Copy the full SHA d9f4914View commit details
Commits on Dec 13, 2020
-
Configuration menu - View commit details
-
Copy full SHA for 77a5c7c - Browse repository at this point
Copy the full SHA 77a5c7cView commit details -
Configuration menu - View commit details
-
Copy full SHA for dac0d3a - Browse repository at this point
Copy the full SHA dac0d3aView commit details -
Relocate Postgres additional database creation logic
Moving it above the "uninstalling" set of tasks is better. Extracting it out to another file at the same time, for readability, especially given that it will probably have to become more complex in the future (potentially installing `jq`, etc.)
Configuration menu - View commit details
-
Copy full SHA for 527d5f5 - Browse repository at this point
Copy the full SHA 527d5f5View commit details -
Allow username of additional Postgres databases to be different
We'll most likely use one that matches the database name, but it's better to have it configurable.
Configuration menu - View commit details
-
Copy full SHA for 0641106 - Browse repository at this point
Copy the full SHA 0641106View commit details -
Fix syntax issues in matrix_postgres_additional_databases
Quotes are necessary around dictionary field names. There was a missing `}` as well.
Configuration menu - View commit details
-
Copy full SHA for d251764 - Browse repository at this point
Copy the full SHA d251764View commit details -
Configuration menu - View commit details
-
Copy full SHA for f47e8a9 - Browse repository at this point
Copy the full SHA f47e8a9View commit details -
Determine matrix-postgres IP address without relying on jq
To avoid needing to have `jq` installed on the machine, we could: - try to run jq in a Docker container using some small image providing that - better yet, avoid `jq` altogether
Configuration menu - View commit details
-
Copy full SHA for e2952f1 - Browse repository at this point
Copy the full SHA e2952f1View commit details -
> Invalid data passed to 'loop', it requires a list, got this instead: matrix_postgres_additional_databases. Hint: If you passed a list/dict of just one element, try adding wantlist=True to your lookup invocation or use q/query instead of lookup. Well, or working around it, as I've done in this commit (which seems more sane than `wantlist=True` stuff).
Configuration menu - View commit details
-
Copy full SHA for c765ceb - Browse repository at this point
Copy the full SHA c765cebView commit details -
Do not execute additional databases creation code if not necessary
The tasks in `create_additional_databases.yml` will likely ensure `matrix-postgres.service` is started, etc. If no additional databases are defined, we'd rather not execute that file and all these tasks that it may do in the future.
Configuration menu - View commit details
-
Copy full SHA for bbc09d0 - Browse repository at this point
Copy the full SHA bbc09d0View commit details -
Do not use the postgresql_user/postgresql_db modules
While these modules are really nice and helpful, we can't use them for at least 2 reasons: - for us, Postgres runs in a container on a private Docker network (`--network=matrix`) without usually being exposed to the host. These modules execute on the host so they won't be able to reach it. - these modules require `psycopg2`, so we need to install it before using it. This might or might not be its own can of worms.
Configuration menu - View commit details
-
Copy full SHA for da4cb2f - Browse repository at this point
Copy the full SHA da4cb2fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a037a5 - Browse repository at this point
Copy the full SHA 3a037a5View commit details -
Use "password" for additional Postgres databases, not "pass"
Being more explicit sounds better.
Configuration menu - View commit details
-
Copy full SHA for 46a4034 - Browse repository at this point
Copy the full SHA 46a4034View commit details -
Make appservice-discord support both SQLite and Postgres
People can toggle between them now. The playbook also defaults to using SQLite if an external Postgres server is used. Ideally, we'd be able to create databases/users in external Postgres servers as well, but our initialization logic (and `docker run` command, etc.) hardcode too many things right now.
Configuration menu - View commit details
-
Copy full SHA for a374d30 - Browse repository at this point
Copy the full SHA a374d30View commit details -
Configuration menu - View commit details
-
Copy full SHA for 183d2a1 - Browse repository at this point
Copy the full SHA 183d2a1View commit details -
Simplify password for additional Postgres databases
Using the result of `password_hash` works for creating them, but authentication seems to be failing with some tools like pgloader. It's possible that we're not escaping things properly somewhere. Ideally, it'd be nice to solve that. But the easier (and still relatively safe/good) solution is to just turn that password hash into a UUID that's safe for passing around without worrying about escaping.
Configuration menu - View commit details
-
Copy full SHA for dd99499 - Browse repository at this point
Copy the full SHA dd99499View commit details -
Configuration menu - View commit details
-
Copy full SHA for b87b754 - Browse repository at this point
Copy the full SHA b87b754View commit details -
Configuration menu - View commit details
-
Copy full SHA for c66c084 - Browse repository at this point
Copy the full SHA c66c084View commit details
Commits on Dec 14, 2020
-
Add --tags=import-generic-sqlite-db (pgloader import)
This can be used by various bridges, etc., to import an SQLite (or some other supported) database into Postgres.
Configuration menu - View commit details
-
Copy full SHA for cb969c6 - Browse repository at this point
Copy the full SHA cb969c6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4617984 - Browse repository at this point
Copy the full SHA 4617984View commit details -
Configuration menu - View commit details
-
Copy full SHA for b217a2e - Browse repository at this point
Copy the full SHA b217a2eView commit details -
Configuration menu - View commit details
-
Copy full SHA for f1e85f7 - Browse repository at this point
Copy the full SHA f1e85f7View commit details -
Configuration menu - View commit details
-
Copy full SHA for d91aa5a - Browse repository at this point
Copy the full SHA d91aa5aView commit details -
Configuration menu - View commit details
-
Copy full SHA for c0edacb - Browse repository at this point
Copy the full SHA c0edacbView commit details -
Rename Postgres-related variables (
matrix*database_*
-> `matrix*pos……tgres_*`) `matrix_SERVICE_database_engine` remains as it is - the only one with a `_database_` infix. Postgres-related ones move to `_postgres_`.
Configuration menu - View commit details
-
Copy full SHA for 2a99e84 - Browse repository at this point
Copy the full SHA 2a99e84View commit details -
Make --tags=import-generic-sqlite-db commands not pass a sensitive co…
…nnection string around Instead of passing the connection string, we can now pass a name of a variable, which contains a connection string. Both are supported for having extra flexibility.
Configuration menu - View commit details
-
Copy full SHA for 5dba0c0 - Browse repository at this point
Copy the full SHA 5dba0c0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2d99ade - Browse repository at this point
Copy the full SHA 2d99adeView commit details -
Configuration menu - View commit details
-
Copy full SHA for a3406a1 - Browse repository at this point
Copy the full SHA a3406a1View commit details -
Add (Postgres + SQLite) support to matrix-mautrix-telegram bridge
I don't use this bridge, so this is completely untested.
Configuration menu - View commit details
-
Copy full SHA for 9bf8ce8 - Browse repository at this point
Copy the full SHA 9bf8ce8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 05dd091 - Browse repository at this point
Copy the full SHA 05dd091View commit details -
Fix typo (matrix_telegram_facebook_postgres_hostname -> matrix_mautri…
…x_telegram_postgres_hostname) Related to 9bf8ce8.
Configuration menu - View commit details
-
Copy full SHA for 6a2dd80 - Browse repository at this point
Copy the full SHA 6a2dd80View commit details -
Remove some remaining
_database_password
usage in favor of `_postgr……es_pasword` The only one that remains is `matrix_synapse_database_password`, but that's something old and should be dealt with separately in the future (unless it remains as it is).
Configuration menu - View commit details
-
Copy full SHA for 2848322 - Browse repository at this point
Copy the full SHA 2848322View commit details -
Add (Postgres + SQLite) support to matrix-mautrix-whatsapp bridge
I don't use this bridge, so this is completely untested.
Configuration menu - View commit details
-
Copy full SHA for 6c77eae - Browse repository at this point
Copy the full SHA 6c77eaeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 43d6ff2 - Browse repository at this point
Copy the full SHA 43d6ff2View commit details -
Add (Postgres + SQLite) support to matrix-mautrix-hangouts bridge
I don't use this bridge, so this is completely untested.
Configuration menu - View commit details
-
Copy full SHA for ce21ea3 - Browse repository at this point
Copy the full SHA ce21ea3View commit details -
Rename
matrix_*_postgres_*
back tomatrix_*_database_*
I was thinking that it makes sense to be more specific, and using `_postgres_` also separated these variables from the `_database_` variables that ended up in bridge configuration. However, @jdreichmann makes a good point (spantaleev#740 (comment)) that we don't need to be so specific and can allow for other engines (like MySQL) to use these variables.
Configuration menu - View commit details
-
Copy full SHA for 087dbe4 - Browse repository at this point
Copy the full SHA 087dbe4View commit details -
add postgres support for mx-puppet-* with fallback to sqlite in role …
…and migration notice
Configuration menu - View commit details
-
Copy full SHA for 5d70bc1 - Browse repository at this point
Copy the full SHA 5d70bc1View commit details -
Rename some remaining
matrix_*_postgres_*
vars back to `matrix_*_da……tabase_*` Looks like there are some that I missed in 087dbe4
Configuration menu - View commit details
-
Copy full SHA for b9a04a7 - Browse repository at this point
Copy the full SHA b9a04a7View commit details -
Configuration menu - View commit details
-
Copy full SHA for aa828ff - Browse repository at this point
Copy the full SHA aa828ffView commit details -
Configuration menu - View commit details
-
Copy full SHA for dde1c9f - Browse repository at this point
Copy the full SHA dde1c9fView commit details -
Add (Postgres + SQLite) support to matrix-reminder-bot
This has been tested and appears to work.
Configuration menu - View commit details
-
Copy full SHA for e3a0c9a - Browse repository at this point
Copy the full SHA e3a0c9aView commit details -
add postgres support mx-appservice-[slack|irc] with fallback to nedb …
…in role and migration notice
Configuration menu - View commit details
-
Copy full SHA for 54da61f - Browse repository at this point
Copy the full SHA 54da61fView commit details -
Configuration menu - View commit details
-
Copy full SHA for bc376c2 - Browse repository at this point
Copy the full SHA bc376c2View commit details -
Configuration menu - View commit details
-
Copy full SHA for dc7850e - Browse repository at this point
Copy the full SHA dc7850eView commit details -
Configuration menu - View commit details
-
Copy full SHA for ac37091 - Browse repository at this point
Copy the full SHA ac37091View commit details -
Configuration menu - View commit details
-
Copy full SHA for c1431b2 - Browse repository at this point
Copy the full SHA c1431b2View commit details -
Configuration menu - View commit details
-
Copy full SHA for bbc0872 - Browse repository at this point
Copy the full SHA bbc0872View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3ba8520 - Browse repository at this point
Copy the full SHA 3ba8520View commit details -
Configuration menu - View commit details
-
Copy full SHA for 86a8091 - Browse repository at this point
Copy the full SHA 86a8091View commit details -
Configuration menu - View commit details
-
Copy full SHA for 13f84e2 - Browse repository at this point
Copy the full SHA 13f84e2View commit details -
Configuration menu - View commit details
-
Copy full SHA for cba973d - Browse repository at this point
Copy the full SHA cba973dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7248eb3 - Browse repository at this point
Copy the full SHA 7248eb3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0ca48f3 - Browse repository at this point
Copy the full SHA 0ca48f3View commit details -
Configuration menu - View commit details
-
Copy full SHA for af3ea67 - Browse repository at this point
Copy the full SHA af3ea67View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3ab7dd1 - Browse repository at this point
Copy the full SHA 3ab7dd1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 13d8a9b - Browse repository at this point
Copy the full SHA 13d8a9bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 516ccb2 - Browse repository at this point
Copy the full SHA 516ccb2View commit details -
Prepare matrix-registation for (SQLite + Postgres) support
Auto-migration and everything seems to work. It's just that matrix-registration cannot load the Python modules required for talking to a Postgres database. Tracked here: zeratax/matrix-registration#44 Until this gets fixed, we'll continue default to 'sqlite'.
Configuration menu - View commit details
-
Copy full SHA for 8d74593 - Browse repository at this point
Copy the full SHA 8d74593View commit details -
Configuration menu - View commit details
-
Copy full SHA for 374f437 - Browse repository at this point
Copy the full SHA 374f437View commit details -
Add support for matrix_dimension_systemd_{required,wanted}_services_list
We were referencing them from `group_vars/matrix_servers` since recently, but there were no such variables and they weren't being put to use.
Configuration menu - View commit details
-
Copy full SHA for 0790a7b - Browse repository at this point
Copy the full SHA 0790a7bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a502db - Browse repository at this point
Copy the full SHA 2a502dbView commit details -
Fix Postgres database importing/upgrading conflicts
We were running into conflicts, because having initialized the roles (users) and databases, trying to import leads to errors (role XXX already exists, etc.). We were previously ignoring the Synapse database (`homeserver`) when upgrading/importing, because that one gets created by default whenever the container starts. For our additional databases, it's a similar situation now. It's not created by default as soon as Postgres starts with an empty database, but rather we create it as part of running the playbook. So we either need to skip those role/database creation statements while upgrading/importing, or to avoid creating the additional database and rely on the import for that. I've gone for the former, because it's already similar to what we were doing and it's simpler (it lets `setup_postgres.yml` be the same in all scenarios).
Configuration menu - View commit details
-
Copy full SHA for dd797ba - Browse repository at this point
Copy the full SHA dd797baView commit details -
Configuration menu - View commit details
-
Copy full SHA for e2ba46b - Browse repository at this point
Copy the full SHA e2ba46bView commit details
Commits on Dec 15, 2020
-
Configuration menu - View commit details
-
Copy full SHA for 3289298 - Browse repository at this point
Copy the full SHA 3289298View commit details -
Add support for executing additional DB migration statements
In cases where pgloader is not enough and we need to do some additional migration work after it, we can now use `additional_psql_statements_list` and `additional_psql_statements_db_name`. This is to be used when migrating `matrix-registration`'s data at the very least.
Configuration menu - View commit details
-
Copy full SHA for 1bd5c24 - Browse repository at this point
Copy the full SHA 1bd5c24View commit details -
Make matrix-registration use Postgres by default
Now that 0.7.2 is out, the Docker image supports Postgres and we can do the (SQLite -> Postgres) migration. I've also found out that we needed to fix up the `tokens.ex_date` column data type a bit to prevent matrix-registration from raising exceptions when comparing `datetime.now()` with `ex_date` coming from the database. Example: > File "/usr/local/lib/python3.8/site-packages/matrix_registration/tokens.py", line 58, in valid > expired = self.ex_date < datetime.now() > TypeError: can't compare offset-naive and offset-aware datetimes
Configuration menu - View commit details
-
Copy full SHA for a197968 - Browse repository at this point
Copy the full SHA a197968View commit details
Commits on Dec 16, 2020
-
Configuration menu - View commit details
-
Copy full SHA for 0f4649a - Browse repository at this point
Copy the full SHA 0f4649aView commit details
Commits on Dec 22, 2020
-
Configuration menu - View commit details
-
Copy full SHA for 6488e11 - Browse repository at this point
Copy the full SHA 6488e11View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b4bf73 - Browse repository at this point
Copy the full SHA 9b4bf73View commit details -
Configuration menu - View commit details
-
Copy full SHA for 149872e - Browse repository at this point
Copy the full SHA 149872eView commit details -
Configuration menu - View commit details
-
Copy full SHA for e64758c - Browse repository at this point
Copy the full SHA e64758cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 44c9f4d - Browse repository at this point
Copy the full SHA 44c9f4dView commit details -
Ensure mx-puppet-discord directories are created before attempting mi…
…gration Our old (base-path -> data-path) SQLite migration can't work otherwise. It's probably not necessary to keep it anymore, but since we still do, at least we should take care to ensure it works.
Configuration menu - View commit details
-
Copy full SHA for d135cd9 - Browse repository at this point
Copy the full SHA d135cd9View commit details -
Configuration menu - View commit details
-
Copy full SHA for e49eb07 - Browse repository at this point
Copy the full SHA e49eb07View commit details -
Configuration menu - View commit details
-
Copy full SHA for 262a25f - Browse repository at this point
Copy the full SHA 262a25fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 69cc214 - Browse repository at this point
Copy the full SHA 69cc214View commit details -
Configuration menu - View commit details
-
Copy full SHA for ab6563c - Browse repository at this point
Copy the full SHA ab6563cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 15f4cc9 - Browse repository at this point
Copy the full SHA 15f4cc9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 815a80c - Browse repository at this point
Copy the full SHA 815a80cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 715bdf2 - Browse repository at this point
Copy the full SHA 715bdf2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b95e19 - Browse repository at this point
Copy the full SHA 9b95e19View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8675ded - Browse repository at this point
Copy the full SHA 8675dedView commit details
Commits on Dec 23, 2020
-
Configuration menu - View commit details
-
Copy full SHA for ad1425e - Browse repository at this point
Copy the full SHA ad1425eView commit details