Skip to content
Working-crabPublic

About

admp.pro

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

260 Commits

Folders and files

Repository files navigation

Requirements: Python 3.11.4 Docker version 20.10.22, build 3a2c30b Node 16.19.0 npm 9.2.0 pm2 5.2.2

admp.pro

Setting Up on local machine

  1. clone git repository
  2. setting up docker-compose
    • if this not needed - skip to 5 point.
    • else copy file docker-compose.yml and rename for example to docker-compose-local.yml
  3. You can change:
    • Port, rename container_name and etc.
  4. start docker-compose-local.yml:
docker-compose -f (relative path to docker-compose-local.yml) up -d
  1. start docker-compose.yml:
docker-compose up -d
  1. migrate db:
???

  6.1 if use ubuntu. Install "libffi-dev"

sudo apt-get install libffi-dev

  6.2 you need install python 3.8.10.

curl https://pyenv.run | bash

  6.3 insert this in end ~/.bashrc and reload bash

export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

  6.4 use

pyenv install 3.11.4

  6.5 cd in project dir and use

pyenv local 3.11.4

  6.6 in project dir use

python3 -m pip install virtualenv

  6.7 in project dir use

python3 -m virtualenv -p python3.11.4 venv

  6.8 activate venv

source venv/bin/activate

  6.9 update pip

python3 -m pip install --upgrade pip
  1. install python req:
pip install -r python_requirements.txt
  1. install Node, for example with help brew: macOS
brew install [email protected]
  1. install pm2:
npm install [email protected] -g
  1. install ngrok for example with help brew:
macOS
brew install ngrok
  1. start ngrok server:
ngrok http 8000
  1. create from "pm2.config.js" your pm2_local.config.js:

  2. Create config file in src/ui_backend, from template(config_template) and rename to config_local.py

    • WEB_HOOK_URL get from ngrok
    • TOKEN get from BotFather in telegram
  3. After all of this, start pm2:

pm2 start pm2_local.config.js
  1. you can work :)

  You can use debug with VS code(example config in ${workspaceFolder}/ launch_example.json)

Migrating database

source venv/bin/activate cd src/db

  1. Перейти в src/db
  2. Выполнять команды приведенные ниже

alembic revision --autogenerate -m "" - создает файл для миграции в папке migrations

alembic upgrade head - для применения миграции

alembic upgrade -1 - откатывает миграцию назад на 1(вместо "-1" можно использовать хэшь миграции)

------------------------------------------------------->

uvicorn main:app --reload - Команда для запуска фастапи

systemctl reload nginx - Перезагрузка енджинкса

About

admp.pro

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages