Skip to content

Commit

Permalink
feat: Добавил обнову.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonVagabond committed Apr 2, 2024
1 parent 155277c commit dade98e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 20 deletions.
4 changes: 1 addition & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
src/Dockerfile
docs
.idea
src/.env.example
.gitignore
.github
*.md
.tox
LICENSE
Makefile
table.png
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,15 @@
как правильно реализовывать сам интернет магазин. По этой причине могут быть какие-то недочеты.
- Почему в этом проекте нет микросервисов? Про микросервисы на тот момент я слышал, но как реализовать их не понимал.
По этой причине этот проект имеет только один сервис.
- Так же, если вы будете запускать через docker, вам нужно будет, доделать настройку \
_celery_(откатить на более низкую версию) либо в _rabbitmq_ дописать конфиг. По какой-то \
одной из этих причин в docker не хочет работать _celery_ и выскакивают предупреждения в _rabbitmq_.


- Для более удобного использования проекта: \
Если хотите, чтобы ваш проект запускался с кнопки **Run** (_Shift+F10_) и применялся **Debug** (_Shift+F9_) зайдите по этой [ссылке](docs/configurations/Config.md)


<a name="installation_and_launch"></a>
## 🔌 Установка и запуск ##
> [!WARNING]
Expand Down
53 changes: 37 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ services:

web:
build:
context: .
dockerfile: src/Dockerfile
context: ./src
dockerfile: Dockerfile
command: python manage.py runserver 0.0.0.0:8000
container_name: web-online-store
volumes:
- ./:/usr/src/app/
- /var/www/back/static/:/usr/src/app/static/
- /var/www/back/media/:/usr/src/app/media/
- /src/static/:/usr/src/app/src/static/
- /src/media/:/usr/src/app/src/media/
ports:
- "8000:8000"
env_file:
Expand All @@ -20,46 +20,61 @@ services:
- db
- redis
- rabbitmq
- celery
- celery-beat

db:
image: postgres:14-alpine
container_name: db-store
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=${PG_USER}
- POSTGRES_PASSWORD=${PG_PASSWORD}
- POSTGRES_DB=${PG_DATABASE}
volumes:
- postgres_data:/var/lib/postgresql/data/

redis:
image: redis:latest
container_name: redis-store
volumes:
- redis_data:/data/
env_file:
- src/.env

rabbitmq:
image: rabbitmq:latest
image: rabbitmq:3.13-management
container_name: rabbitmq-store
hostname: rabbitmq
ports:
- "15672:15672"
- "5672:5672"
volumes:
- rabbitmq_data:/var/lib/rabbitmq/
- ./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
networks:
- rabbitmq

celery:
restart: always
build:
context: ./
command: celery --app=config worker --loglevel=info --pool=solo
context: ./src
command: ['celery', '--app=config', 'worker', '--loglevel=info', '--pool=solo']
volumes:
- ./:/usr/src/app/
container_name: celery-store
env_file:
- src/.env
environment:
- BROKER_URL=${RABBIT_URL}
- RESULT_BACKEND=${REDIS_URL}
- BROKER_CONNECTION_RETRY=300
depends_on:
- db
- redis
- rabbitmq
- web

celery-beat:
restart: always
build:
context: ./
command: celery -A config beat -l info
context: ./src
command: ['celery', '-A', 'config', 'beat', '-l', 'info']
volumes:
- ./:/usr/src/app/
container_name: celery-beat-store
Expand All @@ -71,4 +86,10 @@ services:
- celery

volumes:
postgres_data:
postgres_data:
redis_data:
rabbitmq_data:

networks:
rabbitmq:
driver: bridge
3 changes: 3 additions & 0 deletions docs/README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ An approximate list of [endpoints](endpoints/Endpoints.en.md) and their capabili
how to properly implement the online store itself. For this reason, there may be some shortcomings.
- Why are there no microservices in this project? I had heard about microservices at that time, \
but I did not understand how to implement them. For this reason, this project has only one service.
- Also, if you run through docker, you will need to complete the configuration \
_celery_(roll back to a lower version) or add the config to _rabbitmq_. For some \
one of these reasons, docker does not want _celery_ to work and warnings pop up in _rabbitmq_.


- For more convenient use of the project: \
Expand Down
7 changes: 7 additions & 0 deletions rabbitmq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
deprecated_features.permit.management_metrics_collection = true
default_user = rabbuser
default_pass = rabbpassword

listeners.tcp.default = 5672

management.tcp.port = 15672
3 changes: 2 additions & 1 deletion src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ RUN \
python3 -m pip install -r requirements.txt --no-cache-dir && \
apk --purge del .build-deps

COPY .. .
COPY . .

WORKDIR src


0 comments on commit dade98e

Please sign in to comment.