Skip to content

Latest commit

 

History

History
103 lines (79 loc) · 3.63 KB

setup.md

File metadata and controls

103 lines (79 loc) · 3.63 KB

Advanced Setup

Telegram bot

To run telegram bot you have to:

  1. Copy env.exmaple file: cp ./club/.env.example ./club/.env
  2. Fill all the requirement fields in ./club/env, such as TELEGRAM_TOKEN etc.
    • TELEGRAM_TOKEN you can get from @BotFather
    • To get TELEGRAM_CLUB_CHANNEL_URL, TELEGRAM_ADMIN_CHAT_ID etc Just Simply Forward a message from your group/channel to @JsonDumpBot or @getidsbot
  3. Rebuild application: docker-compose up --build

Docker-compose

Check out our docker-compose.yml to understand the infrastructure.

Local development

Once you decided to code something in the project you'll need to setup your environment. Here's how you can make it.

Setup venv

Through pipenv // todo: (у меня с ним было 2 проблемы)

  • сходу не получилось выпилить установку gdal либы (удаление из pipfile и pipfile.locka не помогло), чтобы оно не фейлило установку остальных пакетов
  • не получилось указать папку созданного из консоли pipenv'а в pycharm'е

Through old fashion virtualenv:

(venv) $ pip install --upgrade -r requirements.txt  
(venv) $ pip install --upgrade -r requirements.dev.txt  

If you don't need to work with Geo Data and installation of gdal package is failed so skip it with next workaround:

# run each line of reqs independently
(venv) $ cat requirements.txt | xargs -n 1 pip install

Setup postgres

locally

Easies way is to run postgres is to run in docker, just run it with follow command:

$ docker-compose -f docker-compose.yml up -d postgres

When you need to connect to postgres use next params:

POSTGRES_DB=vas3k_club
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_HOST=localhost
In case you really want setup local postgres then go under cut...
Brief instruction:

1. Install postgresql (for macos https://postgresapp.com/ is easies start)
2. After you install and run postgress create a project database:
      ```sh
      # create db
      $ psql postgres
      postgres=# createdb vas3k_club

      # create user (user: vas3k, password: vas3k)
      postgres=# createuser --interactive --pwpromp

      # grant priviliges
      postgres=# GRANT ALL PRIVILEGES ON DATABASE vas3k_club TO vas3k;
      postgres=# \connect vas3k_club
      postgres=# GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO vas3k;
      postgres=# GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public to vas3k;
      postgres=# GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public to vas3k;
      postgres=# \q

      # check connection
      $ psql -d vas3k_club -U vas3k
      ```

Setup frontend

$ cd frontend
$ npm run watch # will implicitly run `npm ci`

Run dev server

After you have setup postgres, venv and build frontend (look this steps above) complete preparations with follow commands:

# run redis
$ docker-compose -f docker-compose.yml up redis

# run queue
(venv) $ ./manage.py qcluster

# run db migration
(venv) $ ./manage.py migrate

# run dev server
(venv) $ ./manage.py runserver 0.0.0.0:8000