Once you decided to code something in the project you'll need to setup your environment. Here's how you can make it.
- Get pipenv:
pip3 install --user pipenv
- Install packages and activate virtual environment:
pipenv install --dev
- Check that it was installed correctly:
pipenv shell
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
```
$ cd frontend
$ npm run watch # will implicitly run `npm ci`
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
$ pipenv run python manage.py qcluster
# run db migration
$ pipenv run python manage.py migrate
# run dev server
$ pipenv run python manage.py runserver 0.0.0.0:8000
To run telegram bot you have to:
- Copy env.exmaple file:
cp ./club/.env.example ./club/.env
- Fill all the requirement fields in
./club/env
, such asTELEGRAM_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
- Rebuild application:
docker-compose up --build
Check out our docker-compose.yml to understand the infrastructure.