Compare commits
13 Commits
de0359d681
...
be4458032d
Author | SHA1 | Date |
---|---|---|
Alexey Skobkin | be4458032d | |
Alexey Skobkin | c52ab29263 | |
mitsuha_s | 41b7eb32b6 | |
mitsuha_s | 8a82511618 | |
mitsuha_s | 90ac75fc11 | |
mitsuha_s | 7e466a9384 | |
mitsuha_s | a3327a505c | |
mitsuha_s | dcc7dda040 | |
mitsuha_s | 505e5f1ad5 | |
mitsuha_s | 6381661232 | |
mitsuha_s | 2b4684275e | |
mitsuha_s | dcba2e3b80 | |
mitsuha_s | b8c91b351a |
|
@ -0,0 +1,17 @@
|
||||||
|
# Python
|
||||||
|
.venv
|
||||||
|
__pycache__
|
||||||
|
|
||||||
|
# GIT
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
#CI configuration
|
||||||
|
.drone.yml
|
||||||
|
pylama.ini
|
||||||
|
|
||||||
|
# Bot documentation
|
||||||
|
README.md
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
.env
|
||||||
|
.env.dist
|
20
.drone.yml
20
.drone.yml
|
@ -30,3 +30,23 @@ steps:
|
||||||
- pull_request
|
- pull_request
|
||||||
branch:
|
branch:
|
||||||
exclude: master
|
exclude: master
|
||||||
|
- name: docker-build
|
||||||
|
# https://github.com/drone/drone-plugin-index/blob/main/plugins/docker/original.md
|
||||||
|
image: plugins/docker
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
settings:
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_token
|
||||||
|
repo:
|
||||||
|
from_secret: docker_repo
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
# https://docs.drone.io/pipeline/environment/reference/
|
||||||
|
- ${DRONE_COMMIT_SHA:0:10}
|
||||||
|
- ${DRONE_TAG}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
RSSBOT_TG_TOKEN=1234567890:yourbotstoken
|
||||||
|
|
||||||
|
# Optional variables
|
||||||
|
# RSSBOT_DSN=xxx
|
||||||
|
# POSTGRES_USER=xxx
|
||||||
|
# POSTGRES_PASSWORD=xxx
|
||||||
|
# POSTGRES_DB=xxx
|
||||||
|
# LOG_LEVEL=INFO
|
|
@ -5,5 +5,5 @@
|
||||||
/.venv
|
/.venv
|
||||||
/__pycache__
|
/__pycache__
|
||||||
|
|
||||||
# Database
|
# Environment
|
||||||
/*.db
|
.env
|
|
@ -0,0 +1,21 @@
|
||||||
|
FROM python:3.10-alpine
|
||||||
|
|
||||||
|
WORKDIR /bot
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
# App settings
|
||||||
|
# https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
|
||||||
|
ENV RSSBOT_DSN=postgres://username:password@hostname/database_name
|
||||||
|
# https://core.telegram.org/bots#6-botfather
|
||||||
|
ENV RSSBOT_TG_TOKEN=1234567890:yourbotstoken
|
||||||
|
# https://docs.python.org/3/howto/logging.html#logging-levels
|
||||||
|
ENV LOG_LEVEL=INFO
|
||||||
|
|
||||||
|
ENTRYPOINT [ "python" ]
|
||||||
|
|
||||||
|
CMD [ "bot.py" ]
|
25
README.md
25
README.md
|
@ -44,3 +44,28 @@ export RSSBOT_TG_TOKEN=xxx
|
||||||
export RSSBOT_DSN=xxx
|
export RSSBOT_DSN=xxx
|
||||||
python update.py
|
python update.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Runnig the bot with Docker
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker build . -t tg_bot
|
||||||
|
docker run tg_bot
|
||||||
|
```
|
||||||
|
|
||||||
|
## Runnig the update with Docker
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker run tg_bot update.py
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running the bot with docker-compose
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker-compose up
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running the update with docker-compose
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker-compose run app update.py
|
||||||
|
```
|
|
@ -0,0 +1,32 @@
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
image: miroslavsckaya/tg_rss_bot
|
||||||
|
environment:
|
||||||
|
# DSN schema: postgres://username:password@hostname/database_name
|
||||||
|
# https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
|
||||||
|
- "RSSBOT_DSN=postgres://${BOT_DB_USER:-bot}:${BOT_DB_PASSWORD:-dev}@${BOT_DB_HOST:-db}/${BOT_DB_NAME:-bot}"
|
||||||
|
# https://core.telegram.org/bots#6-botfather
|
||||||
|
- "RSSBOT_TG_TOKEN=${RSSBOT_TG_TOKEN}"
|
||||||
|
# https://docs.python.org/3/howto/logging.html#logging-levels
|
||||||
|
- "LOG_LEVEL=${LOG_LEVEL:-INFO}"
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:14-alpine
|
||||||
|
environment:
|
||||||
|
# Postgres settings
|
||||||
|
# https://hub.docker.com/_/postgres
|
||||||
|
- "POSTGRES_USER=${BOT_DB_USER:-bot}"
|
||||||
|
- "POSTGRES_PASSWORD=${BOT_DB_PASSWORD:-dev}"
|
||||||
|
- "POSTGRES_DB=${BOT_DB_NAME:-bot}"
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/postgresql/data
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db-data:
|
Loading…
Reference in New Issue