Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "CI for all branches"
name: "CI for all branches "

on:
pull_request:
Expand Down Expand Up @@ -37,21 +37,28 @@ jobs:
run: black --check .

- name: Mypy type check
run: mypy app/
run: mypy ./

tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build and start services
run: docker compose up -d --build --wait --wait-timeout 180

- name: Show running containers
run: docker compose ps


- name: Run testing
run: |
docker compose exec app python manage.py test > test-reason.txt

- name: Upload test reason
if: always()
uses: actions/upload-artifact
uses: actions/upload-artifact@v4
with:
name: test-reason
path: test-reason.txt
241 changes: 99 additions & 142 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,154 +32,111 @@ services:
networks:
- net

# kafka:
# image: confluentinc/cp-kafka:latest
# ports:
# - "9092:9092"
# networks:
# - net
# environment:
# # KRaft mode — NO ZOOKEEPER
# CLUSTER_ID: "nlt5fjLLRLSaO1Hm7Gpc5A"
# KAFKA_PROCESS_ROLES: "broker,controller"
# KAFKA_NODE_ID: 1
# KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka:29093"
# KAFKA_LISTENERS: "SASL_PLAINTEXT://0.0.0.0:9092,CONTROLLER://0.0.0.0:29093"
# KAFKA_ADVERTISED_LISTENERS: "SASL_PLAINTEXT://kafka:9092"
# KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "SASL_PLAINTEXT:SASL_PLAINTEXT,CONTROLLER:PLAINTEXT"
# KAFKA_INTER_BROKER_LISTENER_NAME: "SASL_PLAINTEXT"
# KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER"
# KAFKA_SASL_ENABLED_MECHANISMS: "PLAIN"
# KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: "PLAIN"
# KAFKA_SASL_JAAS_CONFIG: |
# org.apache.kafka.common.security.plain.PlainLoginModule required
# username="admin"
# password="admin-secret"
# user_admin="admin-secret"
# user_client="client-secret";
#
# KAFKA_OPTS: "-Djava.security.auth.login.config=/tmp/kafka_server_jaas.conf"
# KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
# KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
# KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
#
# command: |
# bash -c "
# echo 'KafkaServer {
# org.apache.kafka.common.security.plain.PlainLoginModule required
# username=\"admin\"
# password=\"admin-secret\"
# user_admin=\"admin-secret\"
# user_client=\"client-secret\";
# };' > /tmp/kafka_server_jaas.conf &&
# /etc/confluent/docker/run
# "

# redis:
# image: 'redis:alpine'
# restart: always
# command: redis-server
# container_name: 'Redis'
# volumes:
# - redis:/data
# networks:
# - net

redis:
image: 'redis:alpine'
restart: always
command: redis-server
container_name: 'Redis'
volumes:
- redis:/data
networks:
- net

# migrate:
# build: .
# command: poetry run python manage.py migrate
# env_file:
# - .env
# depends_on:
# - redis
# - db
# networks:
# - net
migrate:
build: .
command: poetry run python manage.py migrate
env_file:
- .env
depends_on:
- redis
- db
networks:
- net

# collectstatic:
# build: .
# command: poetry run python manage.py collectstatic --no-input
# volumes:
# - static:/app/static
# - media:/app/media
# networks:
# - net
# env_file:
# - .env
collectstatic:
build: .
command: poetry run python manage.py collectstatic --no-input
volumes:
- static:/app/static
- media:/app/media
networks:
- net
env_file:
- .env

# app:
# build: .
# restart: always
# command: poetry run uvicorn config.asgi:application --host 0.0.0.0 --port 8000 --workers 4
# volumes:
# - ./app:/app
# - static:/app/static
# - media:/app/media
# env_file:
# - .env
# depends_on:
# - redis
# - db
# ports:
# - 8000:8000
# networks:
# - net
app:
build: .
restart: always
command: poetry run uvicorn config.asgi:application --host 0.0.0.0 --port 8000 --workers 4
volumes:
- ./app:/app
- static:/app/static
- media:/app/media
env_file:
- .env
depends_on:
- redis
- db
ports:
- 8000:8000
networks:
- net

# celery-worker:
# build: .
# command: >
# sh -c "
# sleep 10 &&
# poetry run celery -A config worker -l WARNING
# "
# volumes:
# - ./app:/app
# depends_on:
# - app
# - redis
# - db
# environment:
# - CELERY_BROKER_URL=redis://redis:6379/0
# restart: on-failure
# networks:
# - net
# env_file:
# - .env
celery-worker:
build: .
command: >
sh -c "
sleep 10 &&
poetry run celery -A config worker -l WARNING
"
volumes:
- ./app:/app
depends_on:
- app
- redis
- db
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
restart: on-failure
networks:
- net
env_file:
- .env

# celery-beat:
# build: .
# command: >
# sh -c "
# sleep 15 &&
# poetry run celery -A config beat -l INFO
# "
# depends_on:
# - app
# - redis
# - db
# environment:
# - CELERY_BROKKER_URL=redis://redis:6379/0
# restart: on-failure
# volumes:
# - ./app:/app
# networks:
# - net
# env_file:
# - .env
celery-beat:
build: .
command: >
sh -c "
sleep 15 &&
poetry run celery -A config beat -l INFO
"
depends_on:
- app
- redis
- db
environment:
- CELERY_BROKKER_URL=redis://redis:6379/0
restart: on-failure
volumes:
- ./app:/app
networks:
- net
env_file:
- .env

# notify_service:
# build: .
# volumes:
# - ./notification_service:/app/notification_service
# command: sh -c "python -m notification_service.notification"
# env_file:
# - .env
# depends_on:
# - kafka
# - grafana
# restart: on-failure
# networks:
# - net
notify_service:
build: .
volumes:
- ./notification_service:/app/notification_service
command: sh -c "python -m notification_service.notification"
env_file:
- .env
depends_on:
- grafana
restart: on-failure
networks:
- net

alertmanager:
image: prom/alertmanager:latest
Expand Down
Loading
Loading