From 1ea70513b08c6e31bc66305abc8558904101c476 Mon Sep 17 00:00:00 2001 From: phzhik Date: Sun, 28 Apr 2024 03:28:13 +0400 Subject: [PATCH] + systemd service for TG bot * Cleanup in .env --- .env.template | 5 +++-- _deploy/tg_bot.service | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 _deploy/tg_bot.service diff --git a/.env.template b/.env.template index 4f7df1d..e02a865 100644 --- a/.env.template +++ b/.env.template @@ -1,11 +1,12 @@ -APP_HOME=/var/www/poizonstore-stage +APP_HOME="/var/www/poizonstore-stage" # === Keys === # Django SECRET_KEY="" -ALLOWED_HOSTS=.crm-poizonstore.ru,127.0.0.1,localhost,45.84.227.72 +ALLOWED_HOSTS=".crm-poizonstore.ru,127.0.0.1,localhost,45.84.227.72" # Telegram bot +TG_BOT_BIN="/var/www/poizonstore-stage/env/bin/python run_tg_bot.py" TG_BOT_TOKEN="" # External API settings diff --git a/_deploy/tg_bot.service b/_deploy/tg_bot.service new file mode 100644 index 0000000..8bcece5 --- /dev/null +++ b/_deploy/tg_bot.service @@ -0,0 +1,15 @@ +[Unit] +Description=PoizonStore Telegram bot service +After=network.target + +[Service] +Type=simple +User=poizon +Group=poizon +EnvironmentFile=/var/www/poizonstore-stage/.env +WorkingDirectory=/var/www/poizonstore-stage +ExecStart=/bin/sh -c '${TG_BOT_BIN}' +Restart=always + +[Install] +WantedBy=multi-user.target \ No newline at end of file