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.79k stars 1.03k forks source link

matrix-bot-buscarron.service was not detected to be running #1785

Closed ghost closed 2 years ago

ghost commented 2 years ago

Describe the bug

failed: [matrix.domain.tld] (item=matrix-bot-buscarron.service) => changed=false 
  ansible_loop_var: item
  item: matrix-bot-buscarron.service
  msg: matrix-bot-buscarron.service was not detected to be running. It's possible that there's a configuration problem or another service on your server interferes with it (uses the same ports, etc.). Try running `systemctl status matrix-bot-buscarron.service` and `journalctl -fu matrix-bot-buscarron.service` on the server to investigate. If you're on a slow or overloaded server, it may be that services take a longer time to start and that this error is a false-positive. You can consider raising the value of the `matrix_common_after_systemd_service_start_wait_for_timeout_seconds` variable. See `roles/matrix-common-after/defaults/main.yml` for more details about that.

systemctl status matrix-bot-buscarron.service

matrix-bot-buscarron.service - Matrix web forms bot
     Loaded: loaded (/etc/systemd/system/matrix-bot-buscarron.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) since Mon 2022-04-25 07:18:23 UTC; 15s ago
    Process: 1386886 ExecStartPre=/usr/bin/env sh -c /usr/bin/env docker kill matrix-bot-buscarron 2>/dev/null || true (code=exited, status=0/SUCCESS)
    Process: 1386895 ExecStartPre=/usr/bin/env sh -c /usr/bin/env docker rm matrix-bot-buscarron 2>/dev/null || true (code=exited, status=0/SUCCESS)
    Process: 1386904 ExecStart=/usr/bin/env docker run --rm --name matrix-bot-buscarron --log-driver=none --user=997:1002 --cap-drop=ALL --read-only --network=matrix --env-file=/matrix/buscarr>
    Process: 1387028 ExecStop=/usr/bin/env sh -c /usr/bin/env docker kill matrix-bot-buscarron 2>/dev/null || true (code=exited, status=0/SUCCESS)
    Process: 1387037 ExecStop=/usr/bin/env sh -c /usr/bin/env docker rm matrix-bot-buscarron 2>/dev/null || true (code=exited, status=0/SUCCESS)
   Main PID: 1386904 (code=exited, status=0/SUCCESS)

journalctl -fu matrix-bot-buscarron.service

Apr 25 07:44:42 matrix matrix-bot-buscarron[1421878]: buscarron.INFO #############################
Apr 25 07:44:42 matrix matrix-bot-buscarron[1421878]: buscarron.INFO Buscarron latest
Apr 25 07:44:42 matrix matrix-bot-buscarron[1421878]: buscarron.INFO Matrix: true
Apr 25 07:44:42 matrix matrix-bot-buscarron[1421878]: buscarron.INFO HTTP: true
Apr 25 07:44:42 matrix matrix-bot-buscarron[1421878]: buscarron.INFO Forms: 1
Apr 25 07:44:42 matrix matrix-bot-buscarron[1421878]: buscarron.INFO #############################
Apr 25 07:44:42 matrix matrix-bot-buscarron[1421878]: store.ERROR cannot load session credentials: sql: no rows in result set
Apr 25 07:44:42 matrix matrix-bot-buscarron[1421878]: matrix.ERROR cannot authorize using login and password: failed to POST /_matrix/client/r0/login: M_FORBIDDEN (HTTP 403): Invalid password
Apr 25 07:44:42 matrix matrix-bot-buscarron[1421878]: buscarron.FATAL cannot initialize matrix bot: failed to POST /_matrix/client/r0/login: M_FORBIDDEN (HTTP 403): Invalid password
Apr 25 07:44:42 matrix systemd[1]: matrix-bot-buscarron.service: Succeeded.
Apr 25 07:45:13 matrix systemd[1]: matrix-bot-buscarron.service: Scheduled restart job, restart counter is at 58.
Apr 25 07:45:13 matrix systemd[1]: Stopped Matrix web forms bot.
Apr 25 07:45:13 matrix systemd[1]: Starting Matrix web forms bot...
Apr 25 07:45:13 matrix systemd[1]: Started Matrix web forms bot.

To Reproduce My vars.yml file looks like this:

# set the target architecture
matrix_architecture: "arm64"

# The bare domain name which represents your Matrix identity.
# Matrix user ids for your server will be of the form (`@user:<matrix-domain>`).
#
# Note: this playbook does not touch the server referenced here.
# Installation happens on another server ("matrix.<matrix-domain>").
#
# If you've deployed using the wrong domain, you'll have to run the Uninstalling step,
# because you can't change the Domain after deployment.
#
# Example value: example.com
matrix_domain: domain.tld

# This is something which is provided to Let's Encrypt when retrieving SSL certificates for domains.
#
# In case SSL renewal fails at some point, you'll also get an email notification there.
#
# If you decide to use another method for managing SSL certificates (different than the default Let's Encrypt),
# you won't be required to define this variable (see `docs/configuring-playbook-ssl-certificates.md`).
#
# Example value: someone@example.com
matrix_ssl_lets_encrypt_support_email: 'help@domain.tld'

# A shared secret (between Coturn and Synapse) used for authentication.
# You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`).
matrix_coturn_turn_static_auth_secret: '**********************************************************'

# A secret used to protect access keys issued by the server.
# You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`).
matrix_synapse_macaroon_secret_key: '**********************************************************'

# A Postgres password to use for the superuser Postgres user (called `matrix` by default).
#
# The playbook creates additional Postgres users and databases (one for each enabled service)
# using this superuser account.
matrix_postgres_connection_password: '************************'

# All secrets keys are now derived from `matrix_homeserver_generic_secret_key`, not from `matrix_synapse_macaroon_secret_key`.
# To keep them all the same, define `matrix_homeserver_generic_secret_key` in terms of `matrix_synapse_macaroon_secret_key`.
# Using a new secret value for this configuration key is also possible and should not cause any problems.
#
# Fun fact: new installations (based on the new `examples/vars.yml` file) do this in reverse.
# That is, the Synapse macaroon secret is derived from `matrix_homeserver_generic_secret_key`.
matrix_homeserver_generic_secret_key: "{{ matrix_synapse_macaroon_secret_key }}"

matrix_nginx_proxy_base_domain_serving_enabled: true
matrix_nginx_proxy_base_domain_homepage_template: |-
  <!doctype html>
  <meta charset="utf-8" />
  <meta http-equiv="refresh" content="0; url=https://www.{{ matrix_domain }}">
    <script type="text/javascript">
        window.location.href = "https://www.{{ matrix_domain }}"
    </script>
    <title>myteam Redirection</title>
  <html>
    <body>
        If you are not redirected automatically, follow this <a href="https://www.{{ matrix_domain }}">link</a>.
    </body>
  </html>

matrix_coturn_turn_external_ip_address: ***.***.***.***
matrix_synapse_ext_password_provider_shared_secret_auth_enabled: true
matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret: '**********************************************************'
matrix_synapse_admin_enabled: true

# Adjusting email-sending settings
matrix_mailer_sender_address: 'matrix@domain.tld'
matrix_mailer_relay_use: true
matrix_mailer_relay_host_name: 'smtp.gmail.com'
matrix_mailer_relay_host_port: 587
matrix_mailer_relay_auth: true
matrix_mailer_relay_auth_username: 'matrix@domain.tld'
matrix_mailer_relay_auth_password: '**********************************************************'

# Elenent web
matrix_server_fqn_element: 'app.{{ matrix_domain }}'
matrix_client_element_welcome_logo_link: 'https://www.domain.tld'
matrix_client_element_brand: "myteam Network's Element"
matrix_client_element_welcome_logo: 'https://res.cloudinary.com/domain/image/upload/v1633805025/app_riixbj.svg'
matrix_client_element_branding_authFooterLinks: [{"text": "Home", "url": "https://www.domain.tld"}, {"text": "Code", "url": "https://code.domain.tld"}, {"text": "Privacy Policy", "url": "https:/>
matrix_client_element_showLabsSettings: true
#matrix_client_element_welcome_user_id: "@honoroit:domain.tld"
matrix_client_element_disable_guests: false
matrix_client_element_branding_welcomeBackgroundUrl: 'https://images.unsplash.com/photo-14616309657649-3adb30342434e4c8'
matrix_client_element_default_theme: 'dark'

# Synapse Settings
matrix_synapse_auto_join_rooms: ['#hello:domain.tld', '#help:domain.tld', '#news:domain.tld', '#status:domain.tld']

matrix_synapse_configuration_extension_yaml: |
  server_notices:
   system_mxid_localpart: server
   system_mxid_display_name: "Server Notices"
   system_mxid_avatar_url: "mxc://domain.tld/moEZYnlxiDBZVTjEgKuHZCZM"
   room_name: "Server Notices"
  retention:
    enabled: true
    default_policy:
      min_lifetime: 1d
      max_lifetime: 1y
    allowed_lifetime_min: 1d
    allowed_lifetime_max: 1y
    purge_jobs:
     - longest_max_lifetime: 3d
       interval: 12h
     - shortest_max_lifetime: 3d
       interval: 1d

# # # # # # # # # # # # # #
# Bridging other networks #
# # # # # # # # # # # # # #
# WhatsApp
matrix_mautrix_whatsapp_enabled: true

# Facebook
matrix_mautrix_facebook_enabled: true
matrix_mautrix_facebook_configuration_extension_yaml: |
  bridge:
    encryption:
      allow: true
      default: true

# Google Hangouts
matrix_mautrix_hangouts_enabled: true

# Google Chat
matrix_mautrix_googlechat_enabled: true

# Instagram
matrix_mautrix_instagram_enabled: true

# Signal
matrix_mautrix_signal_enabled: true

# Telegram
matrix_mautrix_telegram_enabled: true
matrix_mautrix_telegram_api_id: ****************
matrix_mautrix_telegram_api_hash: **************************************

# Discord
matrix_mx_puppet_discord_enabled: true
matrix_appservice_discord_client_id: "************"
matrix_appservice_discord_bot_token: "**********************************************************"

# Email2Matrix
matrix_email2matrix_enabled: true

matrix_email2matrix_matrix_mappings:
  - MailboxName: "me"
    MatrixRoomId: "!PAZCzmacKXNyKvDlqZ:domain.tld"
    MatrixHomeserverUrl: "https://matrix.domain.tld"
    MatrixUserId: "@mailman:domain.tld"
    MatrixAccessToken: "syt_bWFphfgbG1hbg_**********************l_4********E"
    IgnoreSubject: false
    IgnoreBody: false
    SkipMarkdown: false

# Webhooks
matrix_appservice_webhooks_enabled: true
matrix_appservice_webhooks_api_secret: '**********************************************************'

# GroupMe
matrix_mx_puppet_groupme_enabled: true

# Heisenbridge
matrix_heisenbridge_enabled: true
matrix_heisenbridge_owner: "@me:domain.tld"
matrix_heisenbridge_identd_enabled: true

# Mautrix Twitter
matrix_mautrix_twitter_enabled: true

# Honoroit
matrix_bot_honoroit_enabled: true
matrix_bot_honoroit_password: **********************************************************
matrix_bot_honoroit_roomid: "!iPPgAIIERiFTlzxJdh:domain.tld"
matrix_bot_honoroit_text_greetings: 'Thank you for reaching out to us. Your message was sent to customer support agents. Please, keep calm and wait for answer, usually it takes 1-2 days.'

# Skype
#matrix_mx_puppet_skype_enabled: true
#matrix_mx_puppet_skype_container_self_build: true

# Slack
matrix_mx_puppet_slack_enabled: true
# Client ID must be quoted so YAML does not parse it as a float.
matrix_mx_puppet_slack_oauth_client_id: "********************************"
matrix_mx_puppet_slack_oauth_client_secret: "********************************"

# Grafana
matrix_prometheus_enabled: true
matrix_prometheus_node_exporter_enabled: true
matrix_grafana_enabled: true
matrix_grafana_anonymous_access: true
matrix_grafana_anonymous_access_org_name: 'myteam'
matrix_grafana_allow_embedding: true
# This has no relation to your Matrix user id. It can be any username you'd like.
# Changing the username subsequently won't work.
matrix_grafana_default_admin_user: "me"
# Changing the password subsequently won't work.
matrix_grafana_default_admin_password: "********************************"

#Buscarron
matrix_bot_buscarron_enabled: true
matrix_bot_buscarron_password: ********************************
matrix_bot_buscarron_forms:
  - name: contact
    room: "!lxjtsirLJwMDvrigGN:domain.tld"
    redirect: https://www.domain.tld/thankyou
    ratelimit: 1r/m
    extensions: []

matrix_bot_buscarron_spam_hosts: [] # (optional) list of email domains/hosts that should be rejected automatically
matrix_bot_buscarron_spam_emails: [] # (optional) list of email addresses that should be rejected automatically

Expected behavior A clear and concise description of what you expected to happen.

Matrix Server:

Additional context

TASK [matrix-nginx-proxy : Attempt initial SSL certificate retrieval with standalone authenticator (directly)] **********************************************************************************
fatal: [matrix.domain.tld]: FAILED! => changed=true 
  cmd: /usr/bin/env docker run --rm --name=matrix-certbot --user=997:1002 --cap-drop=ALL -p 80:8080 --mount type=bind,src=/matrix/ssl/config,dst=/etc/letsencrypt --mount type=bind,src=/matrix/ssl/log,dst=/var/log/letsencrypt docker.io/certbot/certbot:arm64v8-v1.23.0 certonly --non-interactive --work-dir=/tmp --http-01-port 8080   --key-type rsa --standalone --preferred-challenges http --agree-tos --email=help@domain.tld -d buscarron.domain.tld
  delta: '0:00:00.193398'
  end: '2022-04-25 07:13:29.246954'
  msg: non-zero return code
  rc: 125
  start: '2022-04-25 07:13:29.053556'
  stderr: 'docker: Error response from daemon: driver failed programming external connectivity on endpoint matrix-certbot (adc45aca69004299af05562f2e5a2df064ebed6b447d612b6267d4d244b97dce): Bind for 0.0.0.0:80 failed: port is already allocated.'
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>
...ignoring
sagat79 commented 2 years ago

What user did you register for the bot @rdaries ? If it's different from a bot.buscarron, it's a good idea to add a matrix_bot_buscarron_login variable to your vars.yml

ghost commented 2 years ago

My mistake, thank you. Everything works perfectly. Maybe @etkecc needs to correct the instructions for manual registration of the bot ...

ansible-playbook -i inventory/hosts setup.yml --extra-vars='username=bot.buscarron password=PASSWORD_FOR_THE_BOT admin=no' --tags=register-user
aine-etke commented 2 years ago

Oh, you right, the username was changed during review