spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.93k stars 1.05k forks source link

arm32 of self-build matrix-registration, matrix-synapse-admin and matrix-ma1sd fails #716

Closed whowantsmybigdata closed 4 years ago

whowantsmybigdata commented 4 years ago
my vars.yml: ``` matrix_architecture: "arm32" matrix_domain: [hidden] matrix_coturn_container_image_self_build: true matrix_coturn_turn_static_auth_secret: "[hidden]" matrix_synapse_macaroon_secret_key: [hidden] matrix_client_element_enabled: false matrix_nginx_proxy_enabled: false matrix_ssl_retrieval_method: none matrix_mailer_enabled: false #matrix_synapse_enable_registration: true matrix_synapse_max_upload_size_mb: 10000 matrix_synapse_url_preview_enabled: false matrix_synapse_email_enabled: true matrix_synapse_email_smtp_host: "[hidden]" matrix_synapse_email_smtp_port: 587 matrix_synapse_email_smtp_require_transport_security: true matrix_synapse_email_smtp_user: "[hidden]" matrix_synapse_email_smtp_pass: "[hidden]" matrix_ma1sd_enabled: true matrix_ma1sd_container_image_self_build: true matrix_registration_enabled: true matrix_restistration_container_image_self_build: true matrix_registration_admin_secret: "[hidden]" matrix_synapse_admin_enabled: true matrix_synapse_admin_container_image_self_build: true ```

--tags=setup-all,start is working without errors and synapse, coturn and postgresql seem to work flawlessly (thanks a lot!!)

but it seems self-building for matrix-registration, matrix-synapse-admin and matrix-ma1sd is either not working correctly or not building for arm32 because journalctl -fu gives me
exec user process caused "exec format error" for all 3 services. Regarding the docs its supposed to work, right?! I tried to stop everything, removed all docker containers/images and start a new but with the same results.

I don't know if this is related but

in `--tags=self-check` there are errors: ``` fatal: [matrix.[hidden]]: FAILED! => {"changed": false, "elapsed": 0, "msg": "Status code was -1 and not [200]: Request failed: ", "redirected": false, "status": -1, "url": "https://matrix.[hidden]/_matrix/client/versions"} ...ignoring TASK [matrix-synapse : Fail if Matrix Client API not working] ******************************************************************************* fatal: [matrix.[hidden]]: FAILED! => {"changed": false, "msg": "Failed checking Matrix Client API is up at `matrix.[hidden]` (checked endpoint: `https://matrix.[hidden]/_matrix/client/versions`). Is Synapse running? Is port 443 open in your firewall? Full error: {'redirected': False, 'url': 'https://matrix.[hidden]/_matrix/client/versions', 'status': -1, 'elapsed': 0, 'changed': False, 'failed': True, 'msg': 'Status code was -1 and not [200]: Request failed: '}"} ```

Thanks!

whowantsmybigdata commented 4 years ago

ok luckily I solved the problem myself: for each of the services mentioned above an extra-command for the architecture "arm32" was needed!

so in vars.yml I had to put:

matrix_registration_enabled: true
matrix_registration_container_image_self_build: true
matrix_registration_architecture: "arm32"
matrix_registration_admin_secret: "[strong secret made with pwgen -s 64 1]"

matrix_synapse_admin_enabled: true
matrix_synapse_admin_architecture: "arm32"

matrix_ma1sd_enabled: true
matrix_ma1sd_architecture: "arm32"

for this 3 services to be build correctly... matrix-registration wasn't build but only pulled (for the wrong architecture) when not defining matrix_registration_container_image_self_build: true

probably this is not an intentional behavior because its written (or sounded for me) different in the docs?!

spantaleev commented 4 years ago

These variables do not exist and defining them should not affect anything:

matrix_ma1sd_architecture indeed exists, but is already supposed to be inheriting the value of your matrix_architecture variable thanks to this: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/4dbec2470f3fb8d96af2de0c9db24a1d3baf3c44/group_vars/matrix_servers#L723


If matrix_architecture is defined correctly as non-amd64, then matrix_registration_container_image_self_build is true thanks to this: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/4dbec2470f3fb8d96af2de0c9db24a1d3baf3c44/group_vars/matrix_servers#L1079

Likewise for matrix_synapse_admin_container_self_build: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/4dbec2470f3fb8d96af2de0c9db24a1d3baf3c44/group_vars/matrix_servers#L1048


matrix_ma1sd_enabled: true is also unnecessary, as it's the default for the playbook.

whowantsmybigdata commented 4 years ago

hm but that was the first time at least matrix-synapse-admin worked and I didnt make anything different besides the mentioned... now when trying to recreate this the build is working correctly with and without the architecture statement (so you're right as the code says as well and I'm confused)

But I just found out that matrix-registration and ma1sd still don't work!

matrix-registration is first started correctly but if I try to e.g. reach https://matrix.[domain]/matrix-registration it forwards to https://matrix.[domain]/matrix-registration/registration but fails with 502 bad gateway and afterwards the services status is failed and the reason is the same as before, sometimes its also not even starting but the log is always the same:

Nov 12 23:08:35 Pi4 systemd[1]: Starting matrix-registration...
Nov 12 23:08:35 Pi4 matrix-registration[10824]: Error response from daemon: Cannot kill container: matrix-registration: No such container: matrix-registration
Nov 12 23:08:36 Pi4 matrix-registration[10833]: Error: No such container: matrix-registration
Nov 12 23:08:36 Pi4 systemd[1]: Started matrix-registration.
Nov 12 23:08:37 Pi4 matrix-registration[10843]: standard_init_linux.go:211: exec user process caused "exec format error"
Nov 12 23:08:38 Pi4 systemd[1]: matrix-registration.service: Main process exited, code=exited, status=1/FAILURE
Nov 12 23:08:38 Pi4 systemd[1]: matrix-registration.service: Failed with result 'exit-code'.

and it starts restarting, failing, restarting, failing, restarting, failing....

In the logs of --tags=setup-all I found:

TASK [Ensure matrix-registration image is pulled] ************************************************************
skipping: [matrix.[domain hidden]]

TASK [Ensure matrix-registration repository is present when self-building] ***********************************
ok: [matrix.[domain hidden]]

TASK [Ensure matrix-registration Docker image is built] ******************************************************
skipping: [matrix.[domain hidden]]

why is it skipping the built? I'm always stopping all the services with --tags=stop and deleting the docker container with docker rmi devture/zeratax-matrix-registration:v0.7.0 before retrying

ma1sd has no errors on the serverside but when I try to choose an Identity-server in Elements I get suggested to use my server-domain but when choosing it it fails with: java.lang.RuntimeException: MatrixError(code=M_UNAUTHORIZED, message=Supplied credentials are invalid, consentUri=null,limitType=null, adminUri=null, retryAfterMilis=null, isSoftLogout=false, newLookupPepper=null)

Maybe this helps: this is when I press Tabulator-key after typing docker rmi:

alpine:3.12                                 ma1uta/ma1sd:latest-dev
awesometechnologies/synapse-admin:0.5.0     matrixdotorg/synapse:v1.22.1
devture/zeratax-matrix-registration:v0.7.0  nginx:alpine
instrumentisto/coturn:4.5.1.3               openjdk:8-jre-alpine
ma1uta/ma1sd:2.4.0                          postgres:13.0-alpine
ma1uta/ma1sd:2.4.0-arm32     
whowantsmybigdata commented 4 years ago

With great help of @spantaleev in the support-chat #matrix-docker-ansible-deploy:devture.com the problem got solved: e.g. for matrix-registration

  1. be sure you put matrix_architecture=arm32 in your inventory/host_vars/[your domain name]/vars.yml (cat /proc/cpuinfo to find out your architecture)
  2. stop all matrix services, e.g. ansible-playbook -i inventory/hosts setup.yml --tags=stop
  3. rm -rf /matrix/matrix-registration/docker-src
  4. ansible-playbook -i inventory/hosts setup.yml --tags=setup-matrix-registration,start

Voilá!