Skip to content

Commit

Permalink
利用dockerize控制启动顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyo committed Jun 16, 2019
1 parent ed0caf2 commit 09390ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ services:
- "./archery/settings.py:/opt/archery/archery/settings.py"
- "./archery/soar.yaml:/etc/soar.yaml"
- "./archery/downloads:/opt/archery/downloads"
command: ["bash","/opt/archery/src/docker/startup.sh"]
entrypoint: "dockerize -wait tcp://mysql:3306 -wait tcp://redis:6379 -timeout 60s /opt/archery/src/docker/startup.sh"
environment:
NGINX_PORT: 9123
11 changes: 6 additions & 5 deletions src/docker/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@

cd /opt/archery

#切换python运行环境
echo 切换python运行环境
source /opt/venv4archery/bin/activate

#修改重定向端口
echo 修改重定向端口
if [[ -z $NGINX_PORT ]]; then
sed -i "s/:nginx_port//g" /etc/nginx/nginx.conf
else
sed -i "s/nginx_port/$NGINX_PORT/g" /etc/nginx/nginx.conf
fi

#启动nginx
echo 启动nginx
/usr/sbin/nginx

#收集所有的静态文件到STATIC_ROOT
echo 收集所有的静态文件到STATIC_ROOT
python3 manage.py collectstatic -v0 --noinput

#启动Django Q cluster
echo 启动Django Q cluster
supervisord -c qcluster_supervisord.conf

echo 启动服务
settings=${1:-"archery.settings"}
ip=${2:-"127.0.0.1"}
port=${3:-8888}
Expand Down

0 comments on commit 09390ee

Please sign in to comment.