Skip to content

Commit

Permalink
🔥 Remove Celery and Flower, they are currently not used nor recommend…
Browse files Browse the repository at this point in the history
…ed (fastapi#694)
  • Loading branch information
tiangolo authored Mar 12, 2024
1 parent 63eb8b5 commit 1e256bc
Show file tree
Hide file tree
Showing 20 changed files with 3 additions and 466 deletions.
4 changes: 0 additions & 4 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ POSTGRES_PASSWORD=changethis

SENTRY_DSN=

# Flower
FLOWER_BASIC_AUTH=admin:changethis

# Configure these with your own Docker registry images
DOCKER_IMAGE_BACKEND=backend
DOCKER_IMAGE_CELERYWORKER=celery
DOCKER_IMAGE_FRONTEND=frontend
1 change: 0 additions & 1 deletion .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
EMAILS_FROM_EMAIL: ${{ secrets.EMAILS_FROM_EMAIL }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
FLOWER_BASIC_AUTH: ${{ secrets.FLOWER_BASIC_AUTH }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
EMAILS_FROM_EMAIL: ${{ secrets.EMAILS_FROM_EMAIL }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
FLOWER_BASIC_AUTH: ${{ secrets.FLOWER_BASIC_AUTH }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ The input variables, with their default values (some auto generated) are:
- `emails_from_email`: (default: `"info@example.com"`) The email account to send emails from, you can set it later in .env.
- `postgres_password`: (default: `"changethis"`) The password for the PostgreSQL database, stored in .env, you can generate one with the method above.
- `sentry_dsn`: (default: "") The DSN for Sentry, if you are using it, you can set it later in .env.
- `flower_basic_auth`: (default: `"admin:changethis"`) The basic auth for Flower, you can set it later in .env.

## Release Notes

Expand Down
File renamed without changes.
18 changes: 1 addition & 17 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ Automatic interactive documentation with Swagger UI (from the OpenAPI backend):

Adminer, database web administration: http://localhost:8080

Flower, administration of Celery tasks: http://localhost:5555

Traefik UI, to see how the routes are being handled by the proxy: http://localhost:8090

**Note**: The first time you start your stack, it might take a minute for it to be ready. While the backend waits for the database to be ready and configures everything. You can check the logs to monitor it.
Expand Down Expand Up @@ -65,8 +63,6 @@ Make sure your editor is using the correct Python virtual environment.

Modify or add SQLModel models for data and SQL tables in `./backend/app/models.py`, API endpoints in `./backend/app/api/`, CRUD (Create, Read, Update, Delete) utils in `./backend/app/crud.py`.

Add and modify tasks to the Celery worker in `./backend/app/worker.py`.

### VS Code

There are already configurations in place to run the backend through the VS Code debugger, so that you can use breakpoints, pause and explore variables, etc.
Expand Down Expand Up @@ -157,19 +153,7 @@ docker compose exec backend bash /app/tests-start.sh -x

#### Test Coverage

Because the test scripts forward arguments to `pytest`, you can enable test coverage HTML report generation by passing `--cov-report=html`.

To run the local tests with coverage HTML reports:

```Bash
DOMAIN=backend sh ./scripts/test-local.sh --cov-report=html
```

To run the tests in a running stack with coverage HTML reports:

```bash
docker compose exec backend bash /app/tests-start.sh --cov-report=html
```
When the tests are run, a file `htmlcov/index.html` is generated, you can open it in your browser to see the coverage of the tests.

### Migrations

Expand Down
14 changes: 0 additions & 14 deletions backend/app/api/routes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,12 @@
from pydantic.networks import EmailStr

from app.api.deps import get_current_active_superuser
from app.core.celery_app import celery_app
from app.models import Message
from app.utils import generate_test_email, send_email

router = APIRouter()


@router.post(
"/test-celery/",
dependencies=[Depends(get_current_active_superuser)],
status_code=201,
)
def test_celery(body: Message) -> Message:
"""
Test Celery worker.
"""
celery_app.send_task("app.worker.test_celery", args=[body.message])
return Message(message="Word received")


@router.post(
"/test-email/",
dependencies=[Depends(get_current_active_superuser)],
Expand Down
5 changes: 0 additions & 5 deletions backend/app/core/celery_app.py

This file was deleted.

16 changes: 0 additions & 16 deletions backend/app/tests/api/routes/test_celery.py

This file was deleted.

33 changes: 0 additions & 33 deletions backend/app/tests/scripts/test_celery_pre_start.py

This file was deleted.

12 changes: 0 additions & 12 deletions backend/app/worker.py

This file was deleted.

32 changes: 0 additions & 32 deletions backend/celeryworker.dockerfile

This file was deleted.

Loading

0 comments on commit 1e256bc

Please sign in to comment.