diff --git a/.dockerignore b/.dockerignore
index 30de240b..5900766d 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,3 +1,4 @@
.idea
logs
-*.log
\ No newline at end of file
+*.log
+node_modules/
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
index 2e3c7ee6..e4bb2e1c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -6,17 +6,12 @@ pipeline {
}
environment {
- HOME = '/home/yeqing'
- NODE_HOME = '/home/yeqing/.nvm/versions/node/v8.12.0'
- ROOT_DIR = "/home/yeqing/jenkins_home/workspace/crawlab_${GIT_BRANCH}"
- PYTHON_HOME = '/home/yeqing/.pyenv/shims'
}
stages {
stage('Setup') {
steps {
echo "Running Setup..."
- // sh '. /home/yeqing/.profile'
script {
if (env.GIT_BRANCH == 'develop') {
env.MODE = 'test'
@@ -28,18 +23,12 @@ pipeline {
}
}
}
- stage('Build Frontend') {
+ stage('Build') {
steps {
- echo "Building frontend..."
- // sh "${NODE_HOME}/bin/node ${NODE_HOME}/bin/npm install -g yarn pm2 --registry=http://registry.npm.taobao.org/"
- sh "cd ${ROOT_DIR}/frontend && ${NODE_HOME}/bin/node ${NODE_HOME}/bin/yarn install --registry=http://registry.npm.taobao.org/ --scripts-prepend-node-path=${NODE_HOME}/bin/node"
- sh "cd ${ROOT_DIR}/frontend && ${NODE_HOME}/bin/node ${ROOT_DIR}/frontend/node_modules/.bin/vue-cli-service build --mode=${MODE}"
- }
- }
- stage('Build Backend') {
- steps {
- echo "Building backend..."
- sh "${PYTHON_HOME}/pip install -r ${ROOT_DIR}/crawlab/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple"
+ echo "Building..."
+ sh """
+ docker build -t crawlab:latest .
+ """
}
}
stage('Test') {
@@ -50,7 +39,14 @@ pipeline {
stage('Deploy') {
steps {
echo 'Deploying....'
- sh "${NODE_HOME}/bin/node ${NODE_HOME}/bin/pm2 reload all"
+ sh """
+ docker stop crawlab | true
+ docker run -d --rm --restart always --name crawlab \
+ -p 8080:8080 \
+ -p 8000:8000 \
+ -v /home/yeqing/.env.production:/opt/crawlab/frontend/.env.production \
+ -v /home/yeqing/config.py:/opt/crawlab/crawlab/config/config.py
+ """
}
}
}
diff --git a/crawlab/app.py b/crawlab/app.py
index db6fa95e..493c9bed 100644
--- a/crawlab/app.py
+++ b/crawlab/app.py
@@ -6,7 +6,6 @@ from flask import Flask
from flask_cors import CORS
from flask_restful import Api
# from flask_restplus import Api
-from gevent import monkey, pywsgi
file_dir = os.path.dirname(os.path.realpath(__file__))
root_path = os.path.abspath(os.path.join(file_dir, '.'))
@@ -104,5 +103,4 @@ if not os.path.exists(PROJECT_LOGS_FOLDER):
if __name__ == '__main__':
# run app instance
- server = pywsgi.WSGIServer((FLASK_HOST, FLASK_PORT), app)
- server.serve_forever()
+ app.run(host=FLASK_HOST, port=FLASK_PORT, threaded=True)
diff --git a/docker-compose.yml b/docker-compose.yml
index 8e4c5eaa..682f404b 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,7 +3,7 @@ services:
master:
image: tikazyq/crawlab:latest
container_name: crawlab
- volumns:
+ volumes:
- /home/yeqing/config.py:/opt/crawlab/crawlab/config/config.py # 后端配置文件
- /home/yeqing/.env.production:/opt/crawlab/frontend/.env.production # 前端配置文件
ports:
diff --git a/frontend/src/views/schedule/ScheduleList.vue b/frontend/src/views/schedule/ScheduleList.vue
index 870a70b0..8887e947 100644
--- a/frontend/src/views/schedule/ScheduleList.vue
+++ b/frontend/src/views/schedule/ScheduleList.vue
@@ -16,7 +16,14 @@
-
+
+