Skip to content
hhyo edited this page Mar 21, 2020 · 12 revisions

docker部署

安装docker

curl -fsSL https://get.docker.com -o get-docker.sh | sudo sh
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

准备构建配置

可参考:https://github.com/hhyo/Archery/tree/master/src/docker-compose
docker-compose.yml文件内的services可按照本身的运行环境来调整,比如说外部已经装好了mysql、redis、inception,就可以将对应的services删除,但是需要注意修改settings.py文件的相关配置,具体可以参考修改配置

启动

# 启动
docker-compose -f docker-compose.yml up -d

# 表结构初始化
docker exec -ti archery /bin/bash
cd /opt/archery
source /opt/venv4archery/bin/activate
python3 manage.py makemigrations sql  
python3 manage.py migrate 

# 数据初始化
python3 manage.py dbshell<sql/fixtures/auth_group.sql

# 创建管理用户
python3 manage.py createsuperuser
python3 manage.py dbshell<src/init_sql/mysql_slow_query_review.sql

# 重启
docker restart archery

# 日志查看和问题排查
docker logs archery -f --tail=50

访问

http://127.0.0.1:9123/