Skip to content

panla/fastapi_tm_celery

Repository files navigation

README

A demo that use the celery

  • GitHub version
  • MIT licensed
  • Github Repo Gitee Repo

keywords

environment

command

# run beat task
celery -A server:beat_app beat -l INFO
# open another shell
celery -A server:beat_app worker -l INFO -C 2/4/8

# run commonly task
celery -A server:app worker -l INFO -c 2/4/8

dir and file

project file

deploy and dir

build and run

# download docker and docker-compose

# create docker network: example
docker network create --driver bridge --subnet xxxxxx --gateway xxxxxxxx xxxxxxxx

# mkdir project dir
mkdir /srv/project && cd /srv/project && mkdir conf/fastapi_tm_celery -p

# clone source code
git clone this project fastapi_tm_celery

## edit config settings
# reference resources ./docs/deploy/docker-compose.yaml
touch docker-compose.yaml

# reference resources ./conf/product.toml ./conf/test.toml
touch conf/fastapi_tm_celery/product.local.toml
touch conf/fastapi_tm_celery/test.local.toml

# reference resources ./docs/deploy/docker-entrypoint.sh
touch conf/fastapi_tm_celery/docker-entrypoint.sh

# build and start
docker-compose up -d --build

the project dir example

.
├── fastapi_tm_celery
├── conf
│   ├── fastapi_tm_celery
│   │   ├── product.local.toml
│   │   └── test.local.toml
│   └── fastapi_tm_redis
│       └── redis.conf
├── data
│   ├── fastapi_tm_rabbitmq
│   │   └── mnesia
│   └── fastapi_tm_redis
│       └── data
│           └── dump.rdb
├── docker-compose.yaml
└── logs
    └── fastapi_tm_celery
        └── x.log