Merge pull request #116 from tikazyq/develop

Develop
This commit is contained in:
Marvin Zhang
2019-08-07 12:29:59 +08:00
committed by GitHub
9 changed files with 82 additions and 16 deletions

17
Jenkinsfile vendored
View File

@@ -12,11 +12,13 @@ pipeline {
script {
if (env.GIT_BRANCH == 'develop') {
env.MODE = 'develop'
env.TAG = 'develop'
env.BASE_URL = '/dev'
} else if (env.GIT_BRANCH == 'master') {
env.MODE = 'production'
} else {
env.MODE = 'test'
}
env.TAG = 'master'
env.BASE_URL = '/demo'
}
}
}
}
@@ -24,7 +26,7 @@ pipeline {
steps {
echo "Building..."
sh """
docker build -t tikazyq/crawlab:latest -f Dockerfile.local .
docker build -t tikazyq/crawlab:${ENV:TAG} -f Dockerfile.local .
"""
}
}
@@ -37,9 +39,12 @@ pipeline {
steps {
echo 'Deploying....'
sh """
cd ./jenkins
echo ${ENV:GIT_BRANCH}
"""
sh """
cd ./jenkins/${ENV:GIT_BRANCH}
docker-compose stop | true
docker-compose up -d
docker-compose up -d --scale worker=3
"""
}
}

View File

@@ -29,7 +29,7 @@
<el-input v-model="spiderForm.col" :placeholder="$t('Results Collection')"
:disabled="isView"></el-input>
</el-form-item>
<el-form-item :label="$t('Site')">
<el-form-item v-if="false" :label="$t('Site')">
<el-autocomplete v-model="spiderForm.site"
:placeholder="$t('Site')"
:fetch-suggestions="fetchSiteSuggestions"

View File

@@ -78,7 +78,7 @@ export default {
this.$refs['spider-stats'].update()
}, 0)
}
this.$st.sendEv('爬虫详情', '切换标签', 'tabName', tab.name)
this.$st.sendEv('爬虫详情', '切换标签', tab.name)
},
onSpiderChange (id) {
this.$router.push(`/spiders/${id}`)

View File

@@ -145,7 +145,9 @@
<el-table :data="filteredTableData"
class="table"
:header-cell-style="{background:'rgb(48, 65, 86)',color:'white'}"
border>
border
@row-click="onRowClick"
>
<template v-for="col in columns">
<el-table-column v-if="col.name === 'type'"
:key="col.name"
@@ -494,6 +496,11 @@ export default {
getTime (str) {
if (!str || str.match('^0001')) return 'NA'
return dayjs(str).format('YYYY-MM-DD HH:mm:ss')
},
onRowClick (row, event, column) {
if (column.label !== this.$t('Action')) {
this.onView(row)
}
}
},
created () {
@@ -584,3 +591,9 @@ export default {
}
</style>
<style scoped>
.el-table >>> tr {
cursor: pointer;
}
</style>

View File

@@ -83,7 +83,7 @@ export default {
},
methods: {
onTabClick (tab) {
this.$st.sendEv('任务详情', '切换标签', 'tabName', tab.name)
this.$st.sendEv('任务详情', '切换标签', tab.name)
},
onSpiderChange (id) {
this.$router.push(`/spiders/${id}`)

View File

@@ -36,7 +36,9 @@
<el-table :data="filteredTableData"
class="table"
:header-cell-style="{background:'rgb(48, 65, 86)',color:'white'}"
border>
border
@row-click="onRowClick"
>
<template v-for="col in columns">
<el-table-column v-if="col.name === 'spider_name'"
:key="col.name"
@@ -295,6 +297,11 @@ export default {
getTotalDuration (row) {
if (row.finish_ts.match('^0001')) return 'NA'
return dayjs(row.finish_ts).diff(row.create_ts, 'second')
},
onRowClick (row, event, column) {
if (column.label !== this.$t('Action')) {
this.onView(row)
}
}
},
created () {
@@ -362,3 +369,9 @@ export default {
text-align: right;
}
</style>
<style scoped>
.el-table >>> tr {
cursor: pointer;
}
</style>

3
frontend/vue.config.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = {
publicPath: process.env.BASE_URL || '/'
}

View File

@@ -0,0 +1,35 @@
version: '3.3'
services:
master:
image: "tikazyq/crawlab:develop"
environment:
CRAWLAB_API_ADDRESS: "crawlab.cn/dev/api"
CRAWLAB_SERVER_MASTER: "Y"
CRAWLAB_MONGO_HOST: "mongo"
CRAWLAB_REDIS_ADDRESS: "redis"
CRAWLAB_LOG_PATH: "/var/logs/crawlab"
ports:
- "8090:8080" # frontend
- "8010:8000" # backend
depends_on:
- mongo
- redis
worker:
image: "tikazyq/crawlab:develop"
environment:
CRAWLAB_SERVER_MASTER: "N"
CRAWLAB_MONGO_HOST: "mongo"
CRAWLAB_REDIS_ADDRESS: "redis"
depends_on:
- mongo
- redis
mongo:
image: mongo:latest
restart: always
ports:
- "27027:27017"
redis:
image: redis:latest
restart: always
ports:
- "6389:6379"

View File

@@ -1,8 +1,7 @@
version: '3.3'
services:
master:
image: tikazyq/crawlab:latest
container_name: master
image: "tikazyq/crawlab:master"
environment:
CRAWLAB_API_ADDRESS: "crawlab.cn/api"
CRAWLAB_SERVER_MASTER: "Y"
@@ -16,8 +15,7 @@ services:
- mongo
- redis
worker:
image: tikazyq/crawlab:latest
container_name: worker
image: "tikazyq/crawlab:master"
environment:
CRAWLAB_SERVER_MASTER: "N"
CRAWLAB_MONGO_HOST: "mongo"
@@ -25,7 +23,6 @@ services:
depends_on:
- mongo
- redis
replicas: 3
mongo:
image: mongo:latest
restart: always