From df2236909bf4e35075121ff94d203cf8defbb26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=9D=E5=B7=9D?= Date: Mon, 12 Apr 2021 12:41:14 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E9=A1=B9=E7=9B=AE=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 ++++ .gitlab-ci.yml | 6 +++--- config/project_config.py | 7 ++++--- config_writer.py | 8 ++++---- gunicorn.conf.py | 8 +++++--- 5 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d1f8167 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.idea +/venv/ +*/__pycache__/ + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9405e63..57b7265 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,10 +4,10 @@ stages: job: stage: deploy script: - - docker stop mail_auth - - docker rm mail_auth +# - docker stop mail_auth +# - docker rm mail_auth - docker build -t mail_auth - - docker run -d -p 11002:11002 --name mail_auth mail_auth + - docker run -d --network apps_network --ip 172.20.50.1 -p 11002:11002 --name mail_auth mail_auth only: - master tags: diff --git a/config/project_config.py b/config/project_config.py index 3fa3ad2..ecf8751 100644 --- a/config/project_config.py +++ b/config/project_config.py @@ -1,4 +1,5 @@ -PROJECT_SUBNET = '' -PROJECT_SUBNET_IP = '' -PROJECT_PORT = 11002 PROJECT_NAME = 'mail_auth' +PROJECT_ID = '50.1' +PROJECT_NETWORK = 'apps_network' +PROJECT_INNER_IP = '172.20.{}'.format(PROJECT_ID) +PROJECT_PORT = '30001' diff --git a/config_writer.py b/config_writer.py index ba8a1b7..a31aaeb 100644 --- a/config_writer.py +++ b/config_writer.py @@ -1,4 +1,4 @@ -from config.project_config import PROJECT_NAME, PROJECT_SUBNET, PROJECT_PORT +from config.project_config import PROJECT_NAME, PROJECT_NETWORK, PROJECT_PORT, PROJECT_INNER_IP # 重写gitlab配置文件 @@ -6,9 +6,9 @@ def write_gitlab_config(): with open('.gitlab-ci.yml') as f: content = f.read() content = content.replace('PROJECT_NAME', PROJECT_NAME) - content = content.replace('PROJECT_PORT', str(PROJECT_PORT)) - if PROJECT_SUBNET != '': - content = content.replace('PROJECT_SUBNET', PROJECT_SUBNET) + content = content.replace('PROJECT_PORT', PROJECT_PORT) + content = content.replace('PROJECT_NETWORK', PROJECT_NETWORK) + content = content.replace('PROJECT_INNER_IP', PROJECT_INNER_IP) f.close() with open('.gitlab-ci.yml', 'w') as f: f.write(content) diff --git a/gunicorn.conf.py b/gunicorn.conf.py index 33afc44..3d95883 100644 --- a/gunicorn.conf.py +++ b/gunicorn.conf.py @@ -1,6 +1,8 @@ +from config.project_config import PROJECT_PORT + # 并行工作进程数 -workers = 4 -# 监听内网端口10001 -bind = '0.0.0.0:10001' +workers = 10 +# 监听内网端口 +bind = '0.0.0.0:{}'.format(PROJECT_PORT) # 工作模式协程 worker_class = 'gevent'