Skip to content

8thgencore/yuno-backend

Repository files navigation

Yuno API

Install

Production

  1. Copy file .env.prod.example to .env and fill in

Create network

docker network create external_network

Using docker compose command

docker compose -f docker-compose.prod.yml up -d --build

Using Makefile command

make run-prod-build

Development

  1. Copy file .env.example to .env and fill in

Using docker compose command

docker compose up -d --build

Using Makefile command

make run-dev-build

Setup database with initial data

This creates sample users on database.

Using docker compose command

docker compose -f docker-compose.yml exec web python -m app.initial_data

Using Makefile command

make init-db

You can connect to the Database using pgAdmin4 and use the credentials from .env file. Database port on local machine has been configured to 5454 on docker-compose-dev.yml file

(Optional) If you prefer you can run pgAdmin4 on a docker container using the following commands, they should executed on different terminals:

Starts pgadmin

make pgadmin-run

Load server configuration (It is required just the first time)

make pgadmin-load-server

Remove pgadmin volume

make pgadmin-clean

This starts pgamin in http://localhost:15432.

Run Alembic migrations (Only if you change the DB model)

Using docker compose command

docker compose -f docker-compose.yml exec web alembic revision --autogenerate
docker compose -f docker-compose.yml exec web alembic upgrade head

Using Makefile command

make add-dev-migration

Mail Client for send otp code

Link to the microservice Mailfort

Generating files from .proto for mail:

Execute the following command in the src directory of your project:

python -m grpc_tools.protoc -I=./proto --python_out=./app/generated/ --grpc_python_out=./app/generated/ ./proto/mail/mail.proto

This command will generate Python files for protobuf and gRPC in the ./src/proto/generated/ directory.