Commit Graph

43 Commits

Author SHA1 Message Date
Slavi Pantaleev
9e936e45ad Use BuildKit for ma1sd Docker building
Newer versions (`master`) use things like `--platform=...`,
which are not supported unless we enable the new BuildKit building
backend.
2021-01-14 23:48:30 +02:00
Slavi Pantaleev
05ca9357a8 Add .service suffix to systemd units list
We'll be adding `.timer` units later on, so it's good to be
more explicit.
2021-01-14 23:02:10 +02:00
Slavi Pantaleev
653d1d7924 Revert "Don't self-build ma1sd every time unless git sources changed"
This reverts commit 2a25b63bb6.

Looking at other roles, we trigger building regardless of this.
It's better to always trigger it, because it's less fragile.
If the build fails and we only trigger it on "git changes"
then we won't trigger it for a while. That's not good.

Triggering it each and every time may seem like a waste,
but it supposedly runs quickly due to Docker caching.
2021-01-14 22:20:51 +02:00
Slavi Pantaleev
2a25b63bb6 Don't self-build ma1sd every time unless git sources changed 2021-01-13 20:14:47 +02:00
Slavi Pantaleev
4805637181 Add support for custom ma1sd view sesion templates 2021-01-03 07:36:09 +02:00
Slavi Pantaleev
f84c69c164 Relocate custom ma1sd threepid email templates to config/
We used to store them in data/, but that seems inappropriate,
since it's just static configuration that the playbook can recreate.
2021-01-03 07:35:13 +02:00
Slavi Pantaleev
b5812b539b Rename ma1sd custom email template variable
Keeps up with a1f64f5159 (diff-0ccf69eb4d59a7645eb4d0a0b077e693948edb33ad06df043bba3fb30122879b)
2021-01-03 00:58:31 +02:00
Stuart Mumford
019a4d7dcd Use role relative paths for things 2020-12-23 11:34:48 +00:00
Slavi Pantaleev
15f4cc924d Rename variables (_database_db_name -> _database_name) 2020-12-22 17:10:02 +02:00
Slavi Pantaleev
af3ea67bba Add (SQLite + Postgres) support and automatic migration to matrix-ma1sd 2020-12-14 17:16:25 +02:00
Slavi Pantaleev
0ca48f3532 Separate matrix-ma1sd install/uninstall tasks 2020-12-14 16:57:51 +02:00
Slavi Pantaleev
d08b27784f Fix systemd services autostart problem with Docker 20.10
The Docker 19.04 -> 20.10 upgrade contains the following change
in `/usr/lib/systemd/system/docker.service`:

```
-BindsTo=containerd.service
-After=network-online.target firewalld.service containerd.service
+After=network-online.target firewalld.service containerd.service multi-user.target
-Requires=docker.socket
+Requires=docker.socket containerd.service
Wants=network-online.target
```

The `multi-user.target` requirement in `After` seems to be in conflict
with our `WantedBy=multi-user.target` and `After=docker.service` /
`Requires=docker.service` definitions, causing the following error on
startup for all of our systemd services:

> Job matrix-synapse.service/start deleted to break ordering cycle starting with multi-user.target/start

A workaround which appears to work is to add `DefaultDependencies=no`
to all of our services.
2020-12-10 11:43:20 +02:00
Slavi Pantaleev
7372480e95 Properly serialize some ma1sd configuration values
We've had a report of the `connection` value getting cut off,
supposedly because it contains something that breaks off the string.

Using `|to_json` takes care of it.
2020-12-06 23:59:58 +02:00
Slavi Pantaleev
be5263f397 Move self-building git repository URLs to variables (stop hardcoding) 2020-11-28 21:34:14 +02:00
Slavi Pantaleev
1fca917ad1 Replace some -v instances with --mount
`-v` magically creates the source destination as a directory,
if it doesn't exist already. We'd like to avoid this magic
and the potential breakage that it might cause.

We'd rather fail while Docker tries to find things to `--mount`
than have it automatically create directories and fail anyway,
while having contaminated the filesystem.

There's a lot more `-v` instances remaining to be fixed later on.
This is just some start.

Things like `matrix_synapse_container_additional_volumes` and
`matrix_nginx_proxy_container_additional_volumes` were not changed to
use `--mount`, as options for each one are passed differently
(`ro` is `ro`, but `rw` doesn't exist and `slave` is `bind-propagation=slave`).
To avoid breaking people's custom volume mounts, we keep it as it is for now.

A deficiency with `--mount` is that it lacks the `z` option (SELinux
ownership changes), and some of our `-v` instances use that. I'm not
sure how supported SELinux is for us right now, but it might be,
and breaking that would not be a good idea.
2020-11-24 10:26:05 +02:00
Slavi Pantaleev
5eed874199 Improve self-building experience (avoid conflict with pullable images)
Fixes https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/716

This patch makes us use more fully-qualified container image names
(either prefixed with docker.io/ or with localhost/).

The latter happens when self-building is enabled.

We've recently had issues where if an image was removed manually
and the service was restarted (making `docker run` fetch it from Docker Hub, etc.),
we'd end up with a pulled image, even though we're aiming for a self-built one.
Re-running the playbook would then not do a rebuild, because:
- the image with that name already exists (even though it's something
else)
- we sometimes had conditional logic where we'd build only if the git
repo changed

By explicitly changing the name of the images (prefixing with localhost/),
we avoid such confusion and the possibility that we'd automatically pul something
which is not what we expect.

Also, I've removed that condition where building would happen on git
changes only. We now always build (unless an image with that name
already exists). We just force-build when the git repo changes.
2020-11-14 23:00:49 +02:00
vractal
627c225101 Enable ma1sd hashing by default 2020-07-29 12:38:07 -04:00
Slavi Pantaleev
28855d1bb4
Document matrix_ma1sd_docker_src_files_path naming 2020-07-17 11:47:15 +03:00
Slavi Pantaleev
ab188018f3
Move when statement to block
The when statement is supposed to be on the block, not on the individual task.

It affects all tasks within the block (they're all to be executed when ma1sd is enabled and self-building is requested0.
2020-07-17 11:44:26 +03:00
Matt Cengia
fede58fe96 Correctly tag self-built ma1sd Docker image 2020-07-17 17:12:16 +10:00
Matt Cengia
b0e984136f Fix issues building ma1sd Docker image
The tag format used in the `ma1sd` repo have change. Versions no longer
start with 'v', and when building for non-amd64, we also need to strip
off the '-$arch' bit from the Docker image name.

Further, when building the .jar file, `ma1sd` currently names the .jar
based on the project's directory, which we call 'docker-src'. This means
other parts of the `ma1sd` build can't find the .jar file. Remedy this
by ensuring that the dir is called `docker-src/ma1sd`.
2020-07-17 13:57:47 +10:00
shadow
6293f1bdb0 Run all API self checks in check_mode 2020-07-04 15:24:33 +02:00
Slavi Pantaleev
635f385971 Use pre-built arm64 image for ma1sd
ma1sd 2.4.0 announced experimental support for arm64.
We're making use of those arm64 images instead of self-building.
2020-06-29 14:53:23 +03:00
teutat3s
4cf59098ad
Update ma1sd to v2.4.0 2020-06-28 21:47:19 +02:00
Slavi Pantaleev
5da31ba579 Move configuration templates outside of defaults/main.yml files 2020-06-03 09:33:28 +03:00
Chris van Dijk
6334f6c1ea Remove hardcoded command paths in systemd unit files
Depending on the distro, common commands like sleep and chown may either
be located in /bin or /usr/bin.

Systemd added path lookup to ExecStart in v239, allowing only the
command name to be put in unit files and not the full path as
historically required. At least Ubuntu 18.04 LTS is however still on
v237 so we should maintain portability for a while longer.
2020-05-27 23:14:54 +02:00
Slavi Pantaleev
a3259bbd77
Add |to_json to some variables 2020-05-19 21:15:23 +03:00
louis
a03e95b7eb enable by default v2 api prefix for ma1sd 2020-05-19 17:06:11 +02:00
Chris van Dijk
7585bcc4ac Allow the matrix user username and groupname to be configured separately
No migration steps should be required.
2020-05-01 19:59:32 +02:00
Slavi Pantaleev
5927ed56b0 Fix matrix_ma1sd_service_stat.stat.exists sometimes being undefined 2020-04-03 13:55:23 +03:00
Slavi Pantaleev
c3efd2966f Fix mxisd -> ma1sd migration for older versions of Ansible 2020-04-03 13:12:03 +03:00
Slavi Pantaleev
a0b82d2234 Fix mxisd -> ma1sd data migration (mxisd.db -> ma1sd.db) 2020-04-03 09:54:05 +03:00
Slavi Pantaleev
a4ea2f850b Provide a friendlier migration message from people using matrix_mxisd_ variables 2020-04-03 09:42:14 +03:00
Slavi Pantaleev
be19511338 Add missing container self-build variables for ma1sd 2020-04-03 09:28:44 +03:00
Slavi Pantaleev
59ccff9bab Fix mxisd -> ma1sd file copying
When the playbook executes on a remote host (as it usually does),
we need to explicitly say `src` is a remote file and not relative
to the playbook.
2020-04-03 09:27:22 +03:00
Marcel Partap
4172345d34 Fix regex matching against old variable names in ma1sd validation task 2020-04-02 17:20:06 +02:00
Marcel Partap
e4ceeccd14 Add mxisd => ma1sd migration task 2020-04-02 17:19:40 +02:00
Marcel Partap
92672f8949 matrix-ma1sd/tasks/validate_config.yml: can ansible process regex in when statements? 2020-04-02 11:31:59 +02:00
Marcel Partap
ed34d0ac39 fix "noeol" ("No newline at end of file" == missing 0A byte at file end) 2020-04-02 11:31:59 +02:00
Marcel Partap
c2d384d2ef some more mxisd to ma1sd string/URL replacements 2020-04-02 11:31:38 +02:00
Marcel Partap
8c5c2e5eec Bump ma1sd version to 2.3.0 2020-04-02 11:31:38 +02:00
Marcel Partap
9d0803cdf9 Specify up-to-date version 2.2.2 of ma1sd docker image 2020-04-02 11:26:30 +02:00
Marcel Partap
187dedf920 Duplicate matrix-mxisd role for matrix-ma1sd fork
(adapting strings and URLs)
2020-04-02 11:26:30 +02:00