Skip to content

Commit

Permalink
chore: env example & compose services
Browse files Browse the repository at this point in the history
  • Loading branch information
vladyoslav committed Oct 28, 2024
1 parent e8d9134 commit 88bde31
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
POSTGRES_DIALECT_DRIVER=postgresql+psycopg
POSTGRES_USER=admin
POSTGRES_PASSWORD=admin
POSTGRES_HOST=postgres
POSTGRES_HOST=localhost
POSTGRES_DB=desbordante
POSTGRES_PORT=5432

RABBITMQ_DEFAULT_USER=guest
RABBITMQ_DEFAULT_PASSWORD=guest
RABBITMQ_HOST=rabbitmq
RABBITMQ_HOST=localhost
RABBITMQ_PORT=5672
RABBITMQ_HTTP_PORT=15672

BACKEND_PORT=8000
UPLOADED_FILES_DIR_PATH=/volumes/uploads
UPLOADED_FILES_DIR_PATH=./volumes/uploads

FLOWER_USER=admin
FLOWER_PASSWORD=admin
Expand Down
12 changes: 3 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: env volumes install-deps up open-db pg-revision pg-migrate pg-downgrade celery-worker app init lint test check-types
.PHONY: env install-deps up open-db pg-revision pg-migrate pg-downgrade celery-worker app init lint test check-types

ifeq ($(shell test -e '.env' && echo -n yes), yes)
include .env
Expand All @@ -12,13 +12,6 @@ env:
@echo >> .env
@echo "SECRET_KEY=$$(openssl rand -hex 32)" >> .env

## Create folders for volumes
volumes:
@for volume in postgres rabbitmq uploads; do \
mkdir -p ./volumes/$$volume; \
chmod 777 ./volumes/$$volume; \
done

## Install dependencies
install-deps:
poetry install
Expand Down Expand Up @@ -51,11 +44,12 @@ celery-worker:

## Run application server in watch mode
app:
-make pg-migrate head
poetry run uvicorn --port 8000 internal:app --reload

## Initiate repository
init:
make env volumes install-deps
make env install-deps

## Run all formatters and linters in project
lint:
Expand Down
36 changes: 21 additions & 15 deletions dev-docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Development only
version: '3.8'

services:
postgres:
container_name: desbordante-postgres
Expand Down Expand Up @@ -37,30 +35,38 @@ services:
# ports:
# - "${BACKEND_PORT}:8000"

celery:
build:
context: .
command: /celery
volumes:
- ./volumes/uploads:${UPLOADED_FILES_DIR_PATH}
env_file:
- .env
depends_on:
- rabbitmq
restart: always
# celery:
# build:
# context: .
# command: /celery
# volumes:
# - ./volumes/uploads:/volumes/uploads
# env_file:
# - .env
# environment:
# - RABBITMQ_HOST=rabbitmq
# - POSTGRES_HOST=postgres
# - UPLOADED_FILES_DIR_PATH=/volumes/uploads
# depends_on:
# - rabbitmq
# restart: always


flower:
build:
context: .
command: /flower
volumes:
- ./volumes/uploads:${UPLOADED_FILES_DIR_PATH}
- ./volumes/uploads:/volumes/uploads
env_file:
- .env
environment:
- RABBITMQ_HOST=rabbitmq
- POSTGRES_HOST=postgres
- UPLOADED_FILES_DIR_PATH=/volumes/uploads
depends_on:
- rabbitmq
- celery
# - celery
restart: always
ports:
- "${FLOWER_PORT}:5555"

0 comments on commit 88bde31

Please sign in to comment.