Skip to content

Спринт 9. Финальный спринт командного проекта по UGC

Notifications You must be signed in to change notification settings

murzindima/YP_ugc_sprint_2

Repository files navigation

Sprint 9

CI

Repository Link

https://github.com/murzindima/ugc_sprint_2

Description

The project is a monorepo with multiple services. The services are:

  • auth api service
  • movie api service
  • admin panel service
  • redis
  • postgres (one for auth and one for movie)
  • elasticsearch
  • jaeger
  • ETL service
  • UGC service (for analytics)
  • UGC operations service
  • NGINX

The infrastructure is set up using Docker Compose:

docker-compose up --build

All ports but NGINX are not exposed to the host. The services are only accessible through the NGINX proxy. Configuration made by .env files. Each service has its own .env file in the root of the service directory.

About the repo structure

admin_panel_service is a Django admin panel service. auth_api_service is a FastAPI service for authentication and authorization. content_api_service is a FastAPI service for movies. postgres_to_elasticsearch is a Python service that listens to the Postgres database and indexes the data in Elasticsearch. nginx is the NGINX proxy.

so, you can find the .env.example file in auth_api_service, content_api_service, and admin_panel_service.

About the NGINX hosts. The NGINX is set up to listen to the following hosts:

  • admin-panel
  • auth-api
  • content-delivery-api
  • jaeger-ui
  • ugc
  • ugc-operations

You must add the following line to your /etc/hosts file:

127.0.0.1 admin-panel auth-api content-delivery-api jaeger-ui ugc ugc-operations

The services are accessible through the following URLs:

How to prepare the databases

The databases are created automatically. But you must create tables and so on manually.

To create the tables for the auth service, you must run the following command:

docker exec -it auth_service_spr9 alembic upgrade head
docker exec -it auth_service_spr9 python src/tools/init_db.py create-permissions
docker exec -it auth_service_spr9 python src/tools/init_db.py create-roles
docker exec -it auth_service_spr9 python src/tools/init_db.py assign-permissions-to-roles
docker exec -it auth_service_spr9 python src/tools/init_db.py create-admin [email protected] 123qwe Joe Doe

To create the tables for the content service, you must run the following command:

docker exec -it ugc_sprint_2-admin-panel-service-1 python manage.py migrate movies 0001 --fake
docker exec -it ugc_sprint_2-admin-panel-service-1 python manage.py migrate movies 0002
docker exec -it ugc_sprint_2-admin-panel-service-1 python manage.py migrate

After that ETL service will start indexing the data in Elasticsearch.

About the authorization and authentication

Django and movies API are authenticated by the auth service. So, you must create a user in the auth service to access the admin panel and the movies API.

You can create a local user or use the OAuth2 flow to get the access and refresh tokens.

About

Спринт 9. Финальный спринт командного проекта по UGC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published