Skip to content

Commit

Permalink
PR-37: Release/v2.1.0: add database, additional user attributes, …
Browse files Browse the repository at this point in the history
…`rate limits`, `queue` and code refactoring (#37)

## v2.1.0 - 2024-05-28
### What's Changed
**Full Changelog**: v2.0.0...v2.1.0 by @obervinov in #37
#### 🐛 Bug Fixes
* #23
#### 📚 Documentation
* #26
* Update repository issues template
#### 💥 Breaking Changes
* Add `PostgreSQL` support to the bot stack instead of `Vault`. All bot data except `configurations` and `user data` is now stored in the database.
* Remove outdated method for processing full account data per link of `user profile`.
* Move all configuration of components form `environment variables` to the `Vault`.
#### 🚀 Features
* #54
* #32
* #30
* #28
* #14
* #20
* #27
* #24
  • Loading branch information
obervinov authored May 28, 2024
1 parent 2e8f284 commit 999b9e6
Show file tree
Hide file tree
Showing 51 changed files with 3,783 additions and 1,260 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
max-line-length=100
max-line-length=150
exclude = .git,__pycache__
extend-ignore =
41 changes: 14 additions & 27 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
about: Create a bug report to help us improve
title: 'Bug: <describe>'
labels: 'bug'
assignees: 'obervinov'

---

**Describe the bug**
A clear and concise description of what the bug is.
Not working <describe> functionality
Error message: <error message>

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Additional context**
Information about where the bug is happening:
1. Functionality 1 in module 1 not working as expected
2. Functionality 2 in module 2 not working as expected

**Expected behavior**
A clear and concise description of what you expected to happen.
**Possible correction**
If you have a possible solution to the bug, please describe it.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
**Check list after fixing the bug**
- [ ] Fix 1 in module 1 tested and working
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
title: 'Custom issue: <description>'
labels: 'help wanted'
assignees: 'obervinov'

---

Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
title: 'Feature request: <description>'
labels: 'enhancement'
assignees: 'obervinov'

---

Expand Down
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ updates:
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/.github/workflows"
schedule:
interval: "weekly"
19 changes: 11 additions & 8 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# PR-1: NAME
**Full Changelog**: https://github.com/obervinov/pyinstabot-downloader/compare/1...2 by @obervinov in https://github.com/obervinov/pyinstabot-downloader/pull/1
## VERSION - YYYY-MM-DD
---
name: 'Pull request'
about: Create a release to help us improve
title: 'Release <version>: <description>'
labels: ''
assignees: 'obervinov'

---
## <version> - <YYYY-MM-DD>
### What's Changed
**Full Changelog**: https://github.com/obervinov/pyinstabot-downloader/compare/1...2 by @obervinov in https://github.com/obervinov/pyinstabot-downloader/pull/1
#### 🐛 Bug Fixes
*
*
#### 📚 Documentation
*
*
#### 💥 Breaking Changes
*
*
#### 🚀 Features
*
*
*
30 changes: 30 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: PR

on:
push:
branches:
- '*'
- '*/*'
- '**'
- '!main'

jobs:
changelog:
uses: obervinov/_templates/.github/workflows/changelog.yaml@v1.2.2

pylint:
uses: obervinov/_templates/.github/workflows/pylint.yaml@v1.2.2

pytest:
uses: obervinov/_templates/.github/workflows/pytest-with-vault.yaml@v1.2.2

pyproject:
uses: obervinov/_templates/.github/workflows/pyproject.yaml@v1.2.2

pr:
uses: obervinov/_templates/.github/workflows/pr.yaml@v1.2.2

build-pr-image:
uses: obervinov/_templates/.github/workflows/docker.yaml@v1.2.2
needs: [changelog, pylint, pytest, pyproject]
34 changes: 34 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Release

on:
pull_request:
branches:
- main
types:
- closed

jobs:
changelog:
uses: obervinov/_templates/.github/workflows/changelog.yaml@v1.2.2

pylint:
uses: obervinov/_templates/.github/workflows/pylint.yaml@v1.2.2

pytest:
uses: obervinov/_templates/.github/workflows/pytest-with-vault.yaml@v1.2.2

pyproject:
uses: obervinov/_templates/.github/workflows/pyproject.yaml@v1.2.2

build-release-image:
uses: obervinov/_templates/.github/workflows/docker.yaml@v1.2.2
needs: [changelog, pylint, pytest, pyproject]

create-release:
uses: obervinov/_templates/.github/workflows/release.yaml@v1.2.2
needs: [changelog, pylint, pytest, pyproject, build-release-image]

# milestone:
# uses: obervinov/_templates/.github/workflows/milestone.yaml@v1.2.2
# needs: [create-release, build-release-image]
11 changes: 0 additions & 11 deletions .github/workflows/release.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/workflow.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.vscode/*
.vscode
.DS_Store
*.tmp
vault/data/
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ indent-after-paren=4
indent-string=' '

# Maximum number of characters on a single line.
max-line-length=100
max-line-length=150

# Maximum number of lines in a module.
max-module-lines=1000
Expand Down
46 changes: 34 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).


## v2.1.0 - 2024-05-28
### What's Changed
**Full Changelog**: https://github.com/obervinov/pyinstabot-downloader/compare/v2.0.0...v2.1.0 by @obervinov in https://github.com/obervinov/pyinstabot-downloader/pull/37
#### 🐛 Bug Fixes
* [GitHub Actions: delete redundant jobs in the main branch b to make workflow more logical](https://github.com/obervinov/pyinstabot-downloader/issues/23)
#### 📚 Documentation
* [Update documentation release/v2.1.0](https://github.com/obervinov/pyinstabot-downloader/issues/26)
* Update repository issues template
#### 💥 Breaking Changes
* Add `PostgreSQL` support to the bot stack (instead of `Vault`). All bot data except `configurations` and `user data` is now stored in the database.
* Remove outdated method for processing full account data per link of `user profile`.
* Move all configuration of components form `environment variables` to the `Vault`.
#### 🚀 Features
* [Change the structure of the secret configurations in Vault](https://github.com/obervinov/pyinstabot-downloader/issues/54)
* [A new concept for processing input messages](https://github.com/obervinov/pyinstabot-downloader/issues/32)
* [Add PostgreSQL support to the bot stack](https://github.com/obervinov/pyinstabot-downloader/issues/30)
* [Add support env files in docker compose](https://github.com/obervinov/pyinstabot-downloader/issues/28)
* [Extend users attributes and add automatic rate limit control](https://github.com/obervinov/pyinstabot-downloader/issues/14)
* [Add the method for processing multiline messages](https://github.com/obervinov/pyinstabot-downloader/issues/20)
* [Rollback to old environment variable names PB_VAULT_APPROLE_ID PB_VAULT_APPROLE_SECRETID](https://github.com/obervinov/pyinstabot-downloader/issues/27)
* [Move parameter `session` to the vault configuration](https://github.com/obervinov/pyinstabot-downloader/issues/24)


## v2.0.0 - 2023-09-16
### What's Changed
Expand All @@ -12,21 +34,21 @@ In this release, the approach with issue and github project was implemented alre
- issue contains a list of mixed issues
- these issue are duplicated in the readme sections
#### 🐛 Bug Fixes
* (Update dependencies: 2023.06.13)[https://github.com/obervinov/pyinstabot-downloader/issues/6]
* (Update the project code and fix bugs)[https://github.com/obervinov/pyinstabot-downloader/issues/13]
* (Redundant login and password reading from vault)[https://github.com/obervinov/pyinstabot-downloader/issues/16]
* (The status is "None" when an exception occurred when uploading to mega, and the retry method)[https://github.com/obervinov/pyinstabot-downloader/issues/15]
* [Update dependencies: 2023.06.13](https://github.com/obervinov/pyinstabot-downloader/issues/6)
* [Update the project code and fix bugs](https://github.com/obervinov/pyinstabot-downloader/issues/13)
* [Redundant login and password reading from vault](https://github.com/obervinov/pyinstabot-downloader/issues/16)
* [The status is "None" when an exception occurred when uploading to mega, and the retry method](https://github.com/obervinov/pyinstabot-downloader/issues/15)
#### 📚 Documentation
* (Update project repository: 2023.06.13)[https://github.com/obervinov/pyinstabot-downloader/issues/8]
* [Update project repository: 2023.06.13](https://github.com/obervinov/pyinstabot-downloader/issues/8)
#### 💥 Breaking Changes
* (Update dependencies: 2023.06.13)[https://github.com/obervinov/pyinstabot-downloader/issues/6]
* (Update the project code and fix bugs)[https://github.com/obervinov/pyinstabot-downloader/issues/13]
* [Update dependencies: 2023.06.13](https://github.com/obervinov/pyinstabot-downloader/issues/6)
* [Update the project code and fix bugs](https://github.com/obervinov/pyinstabot-downloader/issues/13)
#### 🚀 Features
* (Update dependencies: 2023.06.13)[https://github.com/obervinov/pyinstabot-downloader/issues/6]
* (Added the support GitHub Actions)[https://github.com/obervinov/pyinstabot-downloader/issues/10]
* (Update project repository: 2023.06.13)[https://github.com/obervinov/pyinstabot-downloader/issues/8]
* (Update the project code and fix bugs)[https://github.com/obervinov/pyinstabot-downloader/issues/13]
* (Check the download history for the specified post)[https://github.com/obervinov/pyinstabot-downloader/issues/17]
* [Update dependencies: 2023.06.13](https://github.com/obervinov/pyinstabot-downloader/issues/6)
* [Added the support GitHub Actions](https://github.com/obervinov/pyinstabot-downloader/issues/10)
* [Update project repository: 2023.06.13](https://github.com/obervinov/pyinstabot-downloader/issues/8)
* [Update the project code and fix bugs](https://github.com/obervinov/pyinstabot-downloader/issues/13)
* [Check the download history for the specified post](https://github.com/obervinov/pyinstabot-downloader/issues/17)


## v1.0.1 - 2022-11-06
Expand Down
54 changes: 34 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,56 @@
FROM python:3.10.7-alpine3.16
FROM python:3.9.15-alpine3.16

### External argumetns ###
ARG PROJECT_NAME
ARG PROJECT_DESCRIPTION
ARG PROJECT_NAME
ARG PROJECT_VERSION

### Labels ###
LABEL org.opencontainers.image.source https://github.com/obervinov/${PROJECT_NAME}
LABEL org.opencontainers.image.description $PROJECT_DESCRIPTION
LABEL org.opencontainers.image.title "Telegram bot: pyinstabot-downloader"
LABEL org.opencontainers.image.version $PROJECT_VERSION
LABEL org.opencontainers.image.description ${PROJECT_DESCRIPTION}
LABEL org.opencontainers.image.version ${PROJECT_VERSION}
LABEL org.opencontainers.image.authors github.obervinov@proton.me
LABEL org.opencontainers.image.licenses https://github.com/obervinov/pyinstabot-downloader/blob/$PROJECT_VERSION/LICENSE
LABEL org.opencontainers.image.documentation https://github.com/obervinov/pyinstabot-downloader/blob/$PROJECT_VERSION/README.md
LABEL org.opencontainers.image.source https://github.com/obervinov/pyinstabot-downloader/blob/$PROJECT_VERSION
LABEL org.opencontainers.image.licenses https://github.com/obervinov/${PROJECT_NAME}/blob/${PROJECT_VERSION}/LICENSE
LABEL org.opencontainers.image.documentation https://github.com/obervinov/${PROJECT_NAME}/blob/${PROJECT_VERSION}/README.md
LABEL org.opencontainers.image.source https://github.com/obervinov/${PROJECT_NAME}/blob/${PROJECT_VERSION}

### Environment variables ###
ENV PATH=/home/${PROJECT_NAME}/.local/bin:$PATH
ENV PIP_NO_CACHE_DIR=off
ENV PIP_DISABLE_PIP_VERSION_CHECK=on
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV POETRY_NO_INTERACTION=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV VENV_PATH=/home/${PROJECT_NAME}/app/.venv
ENV PATH=/home/${PROJECT_NAME}/.local/bin:$VENV_PATH/bin:$PATH


### Preparing user and dirs ###
### Preparing user and directories ###
RUN adduser -D -h /home/${PROJECT_NAME} -s /bin/sh ${PROJECT_NAME} && \
mkdir -p /home/${PROJECT_NAME} && \
mkdir -p /home/${PROJECT_NAME}/app && \
mkdir -p /home/${PROJECT_NAME}/tmp && \
mkdir -p /home/${PROJECT_NAME}/tmp && \
chown ${PROJECT_NAME}. /home/${PROJECT_NAME} -R

### Prepare git
RUN apk add git
### Prepare tools and fix vulnerabilities ###
RUN apk upgrade --no-cache && apk add --no-cache git curl

### Switching context ###
USER ${PROJECT_NAME}
WORKDIR /home/${PROJECT_NAME}/app

### Copy source code ###
COPY requirements.txt ./
COPY src/ ./

### Installing a python dependeces - requirements.txt ###
RUN pip3 install -r requirements.txt

CMD [ "python3", "bot.py" ]
COPY src/ src/
COPY tests/ tests/
COPY pyproject.toml .
COPY poetry.lock .
COPY *.md ./
COPY LICENSE ./

### Installing poetry and python dependeces ###
RUN curl -sSL https://install.python-poetry.org | python -
RUN poetry install
ENV PYTHONPATH=/home/${PROJECT_NAME}/app/src:/home/${PROJECT_NAME}/app/.venv/lib/python3.10/site-packages

### Entrypoint ###
CMD [ "python3", "src/bot.py" ]
2 changes: 0 additions & 2 deletions Pipfile

This file was deleted.

Loading

0 comments on commit 999b9e6

Please sign in to comment.