fix bot heathcheck
Deploy app frontend / app frontend (push) Successful in 2m44s
Deploy service couchdb / service couchdb (push) Successful in 27s
Deploy db-migrations / db-migrations (push) Successful in 1m41s
Deploy service tg-bot / service tg-bot (push) Successful in 1m49s
Deploy service message-delivery-method-web-push / service message-delivery-method-web-push (push) Successful in 1m35s

This commit is contained in:
2024-12-12 20:48:30 +02:00
parent 1cb840eac3
commit 5d2aca3c7b
4 changed files with 20 additions and 21 deletions
+4 -4
View File
@@ -46,7 +46,7 @@ jobs:
run: TG_BOT_TAG=commit-${{env.GITHUB_SHA}} docker compose -p hereconnect build tg-bot run: TG_BOT_TAG=commit-${{env.GITHUB_SHA}} docker compose -p hereconnect build tg-bot
- name: start container - name: start container
run: TG_BOT_TAG=commit-${{env.GITHUB_SHA}} docker compose -p hereconnect up -d --pull never --wait tg-bot run: TG_BOT_DEBUG='grammy*' TG_BOT_TAG=commit-${{env.GITHUB_SHA}} docker compose -p hereconnect up -d --pull never --wait tg-bot
- name: rename to latest - name: rename to latest
run: docker tag hereconnect/service-tg-bot:commit-${{env.GITHUB_SHA}} hereconnect/service-tg-bot:latest run: docker tag hereconnect/service-tg-bot:commit-${{env.GITHUB_SHA}} hereconnect/service-tg-bot:latest
@@ -57,6 +57,6 @@ jobs:
COUCHDB_TAG: latest COUCHDB_TAG: latest
run: docker compose -p hereconnect up -d --pull never --wait tg-bot run: docker compose -p hereconnect up -d --pull never --wait tg-bot
# - name: cleanup docker image - name: cleanup docker image
# if: always() if: always()
# run: docker rmi hereconnect/service-tg-bot:commit-${{env.GITHUB_SHA}} run: docker rmi hereconnect/service-tg-bot:commit-${{env.GITHUB_SHA}}
+1
View File
@@ -70,6 +70,7 @@ services:
- API_URL=http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb:5984 - API_URL=http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb:5984
- BOT_TOKEN=${BOT_TOKEN:-} - BOT_TOKEN=${BOT_TOKEN:-}
- READ_BASE_URL=${READ_BASE_URL:-} - READ_BASE_URL=${READ_BASE_URL:-}
- DEBUG=${TG_BOT_DEBUG:-}
depends_on: depends_on:
couchdb: couchdb:
condition: service_healthy condition: service_healthy
@@ -43,11 +43,10 @@ export function startHealthServer(
} }
}); });
const { promise, resolve, reject } = Promise.withResolvers<void>(); return new Promise<void>((resolve, reject) => {
server.once("error", reject); server.once("error", reject);
server.listen(port, hostname, resolve); server.listen(port, hostname, () => {
resolve();
promise.then(() => {
console.log( console.log(
`Healthcheck server running on http://${hostname}:${port}/health`, `Healthcheck server running on http://${hostname}:${port}/health`,
); );
@@ -59,6 +58,5 @@ export function startHealthServer(
reject(); reject();
server.close(); server.close();
}); });
});
return promise;
} }
+1 -1
View File
@@ -54,7 +54,7 @@ bot.on("callback_query:data", callbackQueryHandler);
await setupCommands(bot); await setupCommands(bot);
// Запуск бота // Запуск бота
await bot.start(); bot.start();
await startHealthServer(abortController); await startHealthServer(abortController);