добавлен src/altlinux

This commit is contained in:
Maxim Slipenko 2024-08-11 09:13:30 +03:00
parent e2f5e8daba
commit 067fa52719
11 changed files with 2304 additions and 0 deletions

View File

@ -15,6 +15,10 @@
{
"name": "Gnomik",
"path": "src/gnomik"
},
{
"name": "ALT Linux",
"path": "src/altlinux"
}
],
"extensions": {

23
src/altlinux/Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM python:3.12-slim as builder
RUN pip install poetry
RUN mkdir -p /app
COPY . /app
# Фикс
RUN sed -i '/ocab-core = {/{s/, develop = true//}' /app/src/altlinux/pyproject.toml && \
sed -i '/ocab-modules = {/{s/, develop = true//}' /app/src/altlinux/pyproject.toml && \
sed -i '/ocab-core = {/{s/, develop = true//}' /app/src/ocab_modules/pyproject.toml
WORKDIR /app/src/altlinux
RUN poetry lock && poetry install
FROM python:3.12-slim as base
COPY --from=builder /app/src/altlinux /app
WORKDIR /app
ENV PATH="/app/.venv/bin:$PATH"
CMD ["python", "-m", "altlinux"]

View File

@ -0,0 +1,14 @@
**/Dockerfile
**/*.dockerignore
**/docker-compose.yml
**/.git
**/.gitignore
**/.venv
**/.mypy_cache
**/__pycache__/
src/gnomik/config.yaml
src/gnomik/database/*

47
src/altlinux/README.md Normal file
View File

@ -0,0 +1,47 @@
# ALT Linux
## Описание
<!--
TODO: добавить описание
-->
## Функционал
<!--
TODO: описать функционал
-->
## Запуск
### Docker
1. Соберите Docker-образ:
```bash
docker build -t gnomik .
```
2. Запустите контейнер:
```bash
docker run -p 9000:9000 -v ./config.yaml:/app/config.yaml -v ./database:/app/database gnomik
```
Замените `./config.yaml` и `./database` на пути к вашим локальным файлам конфигурации и паки для базы данных.
### Вручную
1. Активируйте виртуальное окружение Gnomика:
```bash
poetry shell
```
2. Запустите бота:
```bash
python -m gnomik
```
## Конфигурация
Конфигурация бота находится в файле `config.yaml`.
## Модули
Список загружаемых модулей указан в файле `__main__.py`.

View File

View File

@ -0,0 +1,19 @@
import asyncio
from ocab_core import OCAB
from ocab_modules import module_loader
async def main():
ocab = OCAB()
await ocab.init_app(
[
module_loader("standard", "config", safe=False),
module_loader("standard", "command_helper"),
# module_loader("standard", "report"),
]
)
await ocab.start()
asyncio.run(main())

View File

@ -0,0 +1,7 @@
core:
mode: LONG_POLLING
token: xxx
report:
allowed_groups:
- -1111111

View File

@ -0,0 +1,9 @@
version: '3'
services:
app:
build:
context: ../..
dockerfile: src/altlinux/Dockerfile
volumes:
- ./config.yaml:/app/config.yaml

2162
src/altlinux/poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

2
src/altlinux/poetry.toml Normal file
View File

@ -0,0 +1,2 @@
[virtualenvs]
in-project = true

View File

@ -0,0 +1,17 @@
[tool.poetry]
name = "altlinux"
version = "0.1.0"
description = ""
authors = [
"Максим Слипенко <maxim@slipenko.com>"
]
readme = "README.md"
[tool.poetry.dependencies]
python = "~3.12"
ocab-core = { extras=["webhook"], path = "../ocab_core", develop = true }
ocab-modules = { path = "../ocab_modules", develop = true }
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"