From: Thorsten Date: Thu, 12 Mar 2020 15:26:57 +0000 (+0100) Subject: fix deployment, make sure rabbitmq is up X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=4d8760507da2cbcb0cbb6296c177244f84aec14b;p=urlbot-v3.git fix deployment, make sure rabbitmq is up --- diff --git a/deploy/roles/urlbot/templates/urlbot-chat.service b/deploy/roles/urlbot/templates/urlbot-chat.service index eb037de..b2eaef9 100644 --- a/deploy/roles/urlbot/templates/urlbot-chat.service +++ b/deploy/roles/urlbot/templates/urlbot-chat.service @@ -2,6 +2,7 @@ Description=jabber bot entertaining and supporting activity on jabber MUCs [Service] +ExecStartPre=/home/{{ botuser }}/wait-for-rabbitmq.sh ExecStart={{ venv_chatbot }}/bin/urlbotd-chat WorkingDirectory=/home/{{ botuser }}/urlbot-v3/ StandardOutput=journal+console @@ -9,4 +10,4 @@ StandardError=journal+console Restart=always [Install] -WantedBy=multi-user.target +WantedBy=default.target diff --git a/deploy/roles/urlbot/templates/urlbot-worker.service b/deploy/roles/urlbot/templates/urlbot-worker.service index 67639eb..a035685 100644 --- a/deploy/roles/urlbot/templates/urlbot-worker.service +++ b/deploy/roles/urlbot/templates/urlbot-worker.service @@ -2,6 +2,7 @@ Description=jabber bot entertaining and supporting activity on jabber MUCs [Service] +ExecStartPre=/home/{{ botuser }}/wait-for-rabbitmq.sh ExecStart={{ venv_worker }}/bin/urlbotd-worker WorkingDirectory=/home/{{ botuser }}/urlbot-v3/ StandardOutput=journal+console @@ -9,4 +10,4 @@ StandardError=journal+console Restart=always [Install] -WantedBy=multi-user.target +WantedBy=default.target diff --git a/deploy/roles/urlbot/templates/wait-for-rabbitmq.sh b/deploy/roles/urlbot/templates/wait-for-rabbitmq.sh new file mode 100644 index 0000000..59d65ba --- /dev/null +++ b/deploy/roles/urlbot/templates/wait-for-rabbitmq.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# TODO: parse amqp_uri, insert here +while ! echo > /dev/tcp/localhost/5672; do + echo "waiting for remote service..." + sleep 5s +done