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
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:
@@ -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}}
|
||||||
|
|||||||
@@ -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,22 +43,20 @@ 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();
|
||||||
|
console.log(
|
||||||
|
`Healthcheck server running on http://${hostname}:${port}/health`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
promise.then(() => {
|
// Закрываем сервер при активации AbortController
|
||||||
console.log(
|
controller.signal.addEventListener("abort", () => {
|
||||||
`Healthcheck server running on http://${hostname}:${port}/health`,
|
console.log("Healthcheck server shutting down due to abort signal.");
|
||||||
);
|
reject();
|
||||||
|
server.close();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Закрываем сервер при активации AbortController
|
|
||||||
controller.signal.addEventListener("abort", () => {
|
|
||||||
console.log("Healthcheck server shutting down due to abort signal.");
|
|
||||||
reject();
|
|
||||||
server.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user