Skip to content

docker-compose project with mysql as db, redis as cache, django as web, celery as task queue, haproxy as load balance

License

Notifications You must be signed in to change notification settings

aishenghuomeidaoli/docker-django-mysql-celery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-django-mysql-celery

docker-compose project with mysql as db, redis as cache, django as web, celery as task queue, haproxy as load balance tool

English Doc

依赖

Docker, Docker Compose

如何开始

克隆项目

git clone https://github.com/aishenghuomeidaoli/docker-django-mysql-celery.git

cd docker-django-mysql-celery

初始化MySQL

这里会创建一个MySQL数据库,方便Django服务端连接。

如果你有一个远程的MySQL服务器,请跳过此处,在Django配置文件中修改数据库地址。

查看容器化MySQL的原因

docker-compose -f docker-compose-mysql.yaml up -d

mysql -u root -h 0.0.0.0 -p

执行SQL,创建数据库,修改时区。

CREATE DATABASE mydb CHARACTER SET utf8 COLLATE utf8_general_ci;
SET time_zone = 'Asia/Shanghai';

启动项目

这里会为 mysql、web、redis、haproxy创建容器。

docker-compose up -d

因为Haproxy的存在,可以开启多个web容器,支持负载均衡。

docker-compose up -d --scale web=2

访问页面

打开浏览器,访问 http://0.0.0.0/ ,创建一个运算任务、任务执行结束后,页面会刷新任务列表。

删除所有容器

docker-compose down

About

docker-compose project with mysql as db, redis as cache, django as web, celery as task queue, haproxy as load balance

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published