Skip to content

Commit

Permalink
Develop (#72)
Browse files Browse the repository at this point in the history
* Bump pre-commit from 3.6.2 to 3.7.1 (#71)

Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.6.2 to 3.7.1.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](pre-commit/pre-commit@v3.6.2...v3.7.1)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump orjson from 3.10.3 to 3.10.5 (#70)

Bumps [orjson](https://github.com/ijl/orjson) from 3.10.3 to 3.10.5.
- [Release notes](https://github.com/ijl/orjson/releases)
- [Changelog](https://github.com/ijl/orjson/blob/master/CHANGELOG.md)
- [Commits](ijl/orjson@3.10.3...3.10.5)

---
updated-dependencies:
- dependency-name: orjson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump pydantic-settings from 2.2.1 to 2.3.3 (#69)

Bumps [pydantic-settings](https://github.com/pydantic/pydantic-settings) from 2.2.1 to 2.3.3.
- [Release notes](https://github.com/pydantic/pydantic-settings/releases)
- [Commits](pydantic/pydantic-settings@v2.2.1...v2.3.3)

---
updated-dependencies:
- dependency-name: pydantic-settings
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump pytest from 8.2.1 to 8.2.2 (#68)

Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.2.1 to 8.2.2.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@8.2.1...8.2.2)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump aiogram-dialog from 2.2.0a3 to 2.2.0a4 (#67)

Bumps [aiogram-dialog](https://github.com/tishka17/aiogram_dialog) from 2.2.0a3 to 2.2.0a4.
- [Commits](Tishka17/aiogram_dialog@2.2.0a3...2.2.0a4)

---
updated-dependencies:
- dependency-name: aiogram-dialog
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* bumps reqs && reformat k8s files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
bralbral and dependabot[bot] authored Jun 20, 2024
1 parent 9b4657f commit 8c57848
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 158 deletions.
12 changes: 10 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,21 @@ And use this image with [docker-compose.yml](./deploy/example.docker-compose.yml

> Stable release with `main` tag on [dockerhub](https://hub.docker.com/r/bral1488/telegram-youtube-notifier/tags)
Just copy [deployment.yml](deploy%2Fk8s%2Fexample.deployment.yml) and fill in sections in `ConfigMap`, `PersistentVolume` sections.
Manifests located in [k8s](deploy%2Fk8s) directory.

It consists of `Namespace`, `ConfigMap`, `PersistenVolume`, `PersistentVolumeClaim`, and `Deployment` files.

You need fill sections in [01_configmap.yaml](deploy%2Fk8s%2F01_configmap.yaml) and [02_persistent_volume.yaml](deploy%2Fk8s%2F02_persistent_volume.yaml) files.

> ⚠️ Deployment use `storageClassName: local-path`. A detailed description can be found [here](https://kubernetes.io/docs/concepts/storage/storage-classes/#local)
Apply deployment:

`kubectl apply -f deployment.yml`
`kubectl apply -f <directory with configs>`

Or you can do it step by step:

`kubectl apply -f <file from config dir>`

## Setup Cookies

Expand Down
5 changes: 5 additions & 0 deletions deploy/k8s/00_namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# create separate namespace
apiVersion: v1
kind: Namespace
metadata:
name: yt-notifier-namespace
51 changes: 51 additions & 0 deletions deploy/k8s/01_configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# create config map
# for config.yaml
# and cookies.txt (optional)
apiVersion: v1
kind: ConfigMap
metadata:
name: yt-notifier-config
namespace: yt-notifier-namespace
data:
config.yaml: |
bot:
token: XXXXXXXXXXXXXXXXXXXXX
chat_id: -100XXXXXXXXXXXXXXXXX
temp_chat_id: -100XXXXXXXXXXXX
report:
template: |
<h1>✅ СЕЙЧАС В ЭФИРЕ:</h1>
<br/>
<ol type='1'>
{% for channel in channels %}
<li>
<b><a href='{{channel.url}}'>{{channel.label}}</a></b> <br/>
{% if channel.concurrent_view_count is not none %}
<b>👀{{channel.concurrent_view_count}}</b>
{% endif %}
{% if channel.like_count is not none %}
<b>👍{{channel.like_count}}</b>
{% endif %}
{% if channel.duration is not none %}
<b>🕑{{channel.duration}}</b>
{% endif %}
</li>
<br/>
{% endfor %}
</ol>
<hr/>
<i>💬 Заходите в наш <a href='https://t.me/Discordovchat'>чат</a>.</i>
<br/>
<i>🤖 <a href='https://t.me/discordovo_feedback_bot'>Бот-предложка</a>, присылайте интересные ссылки на каналы/видео/картинки. </i>
empty: |
<b>🤷 Интересных стримов сейчас нет.</b>
<hr/>
<i>💬 Заходите в наш <a href='https://t.me/Discordovchat'>чат</a>.</i>
<br/>
<i>🤖 <a href='https://t.me/discordovo_feedback_bot'>Бот-предложка</a>, присылайте интересные ссылки на каналы/видео/картинки. </i>
start_scheduler: True
interval_s: 300
cookies.txt: |
# Netscape HTTP Cookie File
# This file is generated by yt-dlp. Do not edit.
24 changes: 24 additions & 0 deletions deploy/k8s/02_persistent_volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# create persistent volume for database
apiVersion: v1
kind: PersistentVolume
metadata:
name: yt-notifier-pv
namespace: yt-notifier-namespace
spec:
capacity:
storage: 128Mi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
storageClassName: local-path
local:
path: /path/to/database/on/host/machine
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- my-k8s-node # get value from kubectl get nodes
13 changes: 13 additions & 0 deletions deploy/k8s/03_persistent_volume_claim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# create volume claim for database
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: yt-notifier-pvc
namespace: yt-notifier-namespace
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 128Mi
storageClassName: local-path
53 changes: 53 additions & 0 deletions deploy/k8s/04_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# create deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: yt-notifier
namespace: yt-notifier-namespace
spec:
replicas: 1
selector:
matchLabels:
app: yt-notifier
template:
metadata:
labels:
app: yt-notifier
spec:
containers:
- name: yt-notifier
image: bral1488/telegram-youtube-notifier:main
imagePullPolicy: Always
command: ["sh", "-c", "python -m src"]
volumeMounts:
- name: config-volume
mountPath: /app/config.yaml
subPath: config.yaml
readOnly: true
- name: config-volume
mountPath: /app/cookies.txt
subPath: cookies.txt
readOnly: true
- name: db-volume
mountPath: /db/youtube-notifier-bot.db
subPath: youtube-notifier-bot.db
resources:
limits:
memory: "256Mi"
cpu: "500m"
securityContext:
runAsUser: 0
env:
- name: SQLITE_DATABASE_FILE_PATH
value: "/db/youtube-notifier-bot.db"
volumes:
- name: config-volume
configMap:
name: yt-notifier-config
- name: db-volume
persistentVolumeClaim:
claimName: yt-notifier-pvc
tolerations:
- key: "node.kubernetes.io/disk-pressure"
operator: "Exists"
effect: "NoSchedule"
150 changes: 0 additions & 150 deletions deploy/k8s/example.deployment.yml

This file was deleted.

6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
aiogram==3.7.0
aiogram-dialog==2.2.0a3
aiogram-dialog==2.2.0a4
pydantic==2.7.2
APScheduler==3.10.4
yt-dlp==2024.5.27
sulguk==0.8.0
jinja2==3.1.4
pyyaml==6.0.1
pydantic_settings==2.2.1
pydantic_settings==2.3.3
structlog==24.2.0
orjson==3.10.3
orjson==3.10.5
uvloop==0.19.0
SQLAlchemy==2.0.30
alembic==1.13.1
Expand Down
4 changes: 2 additions & 2 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pre-commit==3.6.2
pre-commit==3.7.1
black==24.4.2
autoflake==2.3.1
reorder-python-imports==3.13.0
pyupgrade==3.16.0
pytest==8.2.1
pytest==8.2.2
pytest-cov==5.0.0
git+https://github.com/aio-libs/sort-all.git
2 changes: 1 addition & 1 deletion src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
SQLITE_DATABASE_FILE_PATH: str = os.environ.get(
"SQLITE_DATABASE_FILE_PATH", os.path.join(ROOT_DIR, "youtube-notifier-bot.db")
)
VERSION: str = "2024-06-16.16"
VERSION: str = "2024-06-20.10"

__all__ = [
"CONFIG_FILE_PATH",
Expand Down

0 comments on commit 8c57848

Please sign in to comment.