update ci

This commit is contained in:
RainSun 2021-09-03 20:02:53 +08:00
parent e8379607da
commit 3b33e26617
3 changed files with 55 additions and 205 deletions

54
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,54 @@
variables:
APP_NAME: "cherry_be"
OUTSIDE_PORT: 5018
INSIDE_PORT: 80
IMAGE_NAME: "$APP_NAME:$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA"
DOCKER_FILE_PATH: "./Dockerfile"
stages:
- build
- clear
- deploy
- rmimg
build:
stage: build
image: docker:latest
services:
- name: docker:dind
tags:
- dockerbase
script:
- ls -a
- docker build -t ${IMAGE_NAME} -f ${DOCKER_FILE_PATH} .
clear:
stage: clear
tags:
- dockerbase
only:
- master
script:
- docker stop ${APP_NAME}
- docker rm ${APP_NAME}
allow_failure: true
deploy:
stage: deploy
tags:
- dockerbase
only:
- master
script:
- ls -a
- docker run -d --name ${APP_NAME} -p ${OUTSIDE_PORT}:${INSIDE_PORT} ${IMAGE_NAME}
rmimg:
stage: rmimg
tags:
- dockerbase
only:
- master
script:
- docker image rm `docker image ls -q ${APP_NAME} | tail -1`
allow_failure: true

View File

@ -5,5 +5,4 @@ WORKDIR /app
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
COPY . /app
# ENTRYPOINT ["sh"]
# CMD ["go.sh"]
CMD sh go.sh && python

View File

@ -1,203 +0,0 @@
[2020-04-10 10:47:35 +0000] [9] [INFO] Starting gunicorn 20.0.4
[2020-04-10 10:47:35 +0000] [9] [INFO] Listening at: http://0.0.0.0:80 (9)
[2020-04-10 10:47:35 +0000] [9] [INFO] Using worker: sync
[2020-04-10 10:47:35 +0000] [11] [INFO] Booting worker with pid: 11
[2020-04-10 10:47:35 +0000] [12] [INFO] Booting worker with pid: 12
[2020-04-10 10:47:35 +0000] [13] [INFO] Booting worker with pid: 13
[2020-04-10 10:47:35 +0000] [14] [INFO] Booting worker with pid: 14
[2020-04-10 11:58:56 +0000] [10] [INFO] Starting gunicorn 20.0.4
[2020-04-10 11:58:56 +0000] [10] [INFO] Listening at: http://0.0.0.0:80 (10)
[2020-04-10 11:58:56 +0000] [10] [INFO] Using worker: sync
[2020-04-10 11:58:56 +0000] [12] [INFO] Booting worker with pid: 12
[2020-04-10 11:58:56 +0000] [13] [INFO] Booting worker with pid: 13
[2020-04-10 11:58:56 +0000] [14] [INFO] Booting worker with pid: 14
[2020-04-10 11:58:56 +0000] [15] [INFO] Booting worker with pid: 15
[2020-04-10 11:58:56 +0000] [12] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/cherry.py", line 5, in <module>
from allFunction import manageLogin, managePhoto, manageAdd, manageDel, manageGet, manageDetail, manageComment, manageScheduleUpload, manageScheduleGet
ImportError: cannot import name 'managePhoto' from 'allFunction' (./lib/allFunction.py)
[2020-04-10 11:58:56 +0000] [12] [INFO] Worker exiting (pid: 12)
[2020-04-10 11:58:56 +0000] [13] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/cherry.py", line 5, in <module>
from allFunction import manageLogin, managePhoto, manageAdd, manageDel, manageGet, manageDetail, manageComment, manageScheduleUpload, manageScheduleGet
ImportError: cannot import name 'managePhoto' from 'allFunction' (./lib/allFunction.py)
[2020-04-10 11:58:56 +0000] [13] [INFO] Worker exiting (pid: 13)
[2020-04-10 11:58:56 +0000] [14] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/cherry.py", line 5, in <module>
from allFunction import manageLogin, managePhoto, manageAdd, manageDel, manageGet, manageDetail, manageComment, manageScheduleUpload, manageScheduleGet
ImportError: cannot import name 'managePhoto' from 'allFunction' (./lib/allFunction.py)
[2020-04-10 11:58:56 +0000] [14] [INFO] Worker exiting (pid: 14)
[2020-04-10 11:58:56 +0000] [15] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/cherry.py", line 5, in <module>
from allFunction import manageLogin, managePhoto, manageAdd, manageDel, manageGet, manageDetail, manageComment, manageScheduleUpload, manageScheduleGet
ImportError: cannot import name 'managePhoto' from 'allFunction' (./lib/allFunction.py)
[2020-04-10 11:58:56 +0000] [15] [INFO] Worker exiting (pid: 15)
[2020-04-10 12:01:52 +0000] [9] [INFO] Starting gunicorn 20.0.4
[2020-04-10 12:01:52 +0000] [9] [INFO] Listening at: http://0.0.0.0:80 (9)
[2020-04-10 12:01:52 +0000] [9] [INFO] Using worker: sync
[2020-04-10 12:01:52 +0000] [11] [INFO] Booting worker with pid: 11
[2020-04-10 12:01:52 +0000] [12] [INFO] Booting worker with pid: 12
[2020-04-10 12:01:52 +0000] [13] [INFO] Booting worker with pid: 13
[2020-04-10 12:01:53 +0000] [14] [INFO] Booting worker with pid: 14
[2020-04-15 08:34:13,823] ERROR in app: Exception on /api/login [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/app/cherry.py", line 24, in login
res = manageLogin(request)
File "./lib/allFunction.py", line 23, in manageLogin
schedule = getSchedule(res['ip'], res['s'])
File "./lib/crawler.py", line 265, in getSchedule
for o in range( int(n[0]) , int(n[1]) + 1):
ValueError: invalid literal for int() with base 10: '16周[3'
[2020-04-15 08:39:41 +0000] [9] [INFO] Starting gunicorn 20.0.4
[2020-04-15 08:39:41 +0000] [9] [INFO] Listening at: http://0.0.0.0:80 (9)
[2020-04-15 08:39:41 +0000] [9] [INFO] Using worker: sync
[2020-04-15 08:39:41 +0000] [11] [INFO] Booting worker with pid: 11
[2020-04-15 08:39:41 +0000] [12] [INFO] Booting worker with pid: 12
[2020-04-15 08:39:41 +0000] [13] [INFO] Booting worker with pid: 13
[2020-04-15 08:39:41 +0000] [14] [INFO] Booting worker with pid: 14
[2020-04-15 08:42:08,965] ERROR in app: Exception on /api/login [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/app/cherry.py", line 24, in login
res = manageLogin(request)
File "./lib/allFunction.py", line 23, in manageLogin
schedule = getSchedule(res['ip'], res['s'])
File "./lib/crawler.py", line 265, in getSchedule
for o in range( int(n[0]) , int(n[1]) + 1):
ValueError: invalid literal for int() with base 10: '4周[3'
[2020-04-15 08:42:29,909] ERROR in app: Exception on /api/login [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/app/cherry.py", line 24, in login
res = manageLogin(request)
File "./lib/allFunction.py", line 23, in manageLogin
schedule = getSchedule(res['ip'], res['s'])
File "./lib/crawler.py", line 265, in getSchedule
for o in range( int(n[0]) , int(n[1]) + 1):
ValueError: invalid literal for int() with base 10: '4周[3'