Merge pull request #634 from crawlab-team/develop

Develop
This commit is contained in:
Marvin Zhang
2020-03-12 09:10:19 +08:00
committed by GitHub
12 changed files with 214 additions and 7 deletions

View File

@@ -37,7 +37,7 @@
三种方式:
1. [Docker](http://docs.crawlab.cn/Installation/Docker.html)(推荐)
2. [直接部署](http://docs.crawlab.cn/Installation/Direct.html)(了解内核)
3. [Kubernetes](https://juejin.im/post/5e0a02d851882549884c27ad) (多节点部署)
3. [Kubernetes](http://docs.crawlab.cn/Installation/Kubernetes.html) (多节点部署)
### 要求Docker
- Docker 18.03+

View File

@@ -34,10 +34,10 @@ Golang-based distributed web crawler management platform, supporting various lan
## Installation
Two methods:
Three methods:
1. [Docker](http://docs.crawlab.cn/Installation/Docker.html) (Recommended)
2. [Direct Deploy](http://docs.crawlab.cn/Installation/Direct.html) (Check Internal Kernel)
3. [Kubernetes](https://juejin.im/post/5e0a02d851882549884c27ad) (Multi-Node Deployment)
3. [Kubernetes](http://docs.crawlab.cn/Installation/Kubernetes.html) (Multi-Node Deployment)
### Pre-requisite (Docker)
- Docker 18.03+

View File

@@ -0,0 +1,57 @@
apiVersion: v1
kind: Service
metadata:
name: crawlab
namespace: crawlab
spec:
ports:
- port: 8080
targetPort: 8080
nodePort: 30088
selector:
app: crawlab-master
type: NodePort
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: crawlab-master
namespace: crawlab
spec:
serviceName: crawlab-master
selector:
matchLabels:
app: crawlab-master
template:
metadata:
labels:
app: crawlab-master
spec:
containers:
- image: tikazyq/crawlab:latest
imagePullPolicy: Always
name: crawlab
env:
- name: CRAWLAB_SERVER_MASTER
value: "Y"
- name: CRAWLAB_MONGO_HOST
value: "mongo"
- name: CRAWLAB_REDIS_ADDRESS
value: "redis"
- name: CRAWLAB_SERVER_LANG_NODE
value: "N"
- name: CRAWLAB_SERVER_LANG_JAVA
value: "N"
- name: CRAWLAB_SERVER_LANG_DOTNET
value: "N"
- name: CRAWLAB_SERVER_REGISTER_TYPE
value: "hostname"
- name: CRAWLAB_SETTING_ALLOWREGISTER
value: "Y"
- name: CRAWLAB_SETTING_ENABLETUTORIAL
value: "Y"
- name: CRAWLAB_SETTING_DEMOSPIDERS
value: "Y"
ports:
- containerPort: 8080
name: crawlab

View File

@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: crawlab-worker
namespace: crawlab
spec:
serviceName: crawlab-worker
replicas: 2
selector:
matchLabels:
app: crawlab-worker
template:
metadata:
labels:
app: crawlab-worker
spec:
containers:
- image: tikazyq/crawlab:latest
imagePullPolicy: Always
name: crawlab
env:
- name: CRAWLAB_SERVER_MASTER
value: "N"
- name: CRAWLAB_MONGO_HOST
value: "mongo"
- name: CRAWLAB_REDIS_ADDRESS
value: "redis"
- name: CRAWLAB_SERVER_LANG_NODE
value: "Y"
- name: CRAWLAB_SERVER_LANG_JAVA
value: "Y"
- name: CRAWLAB_SERVER_LANG_DOTNET
value: "Y"
- name: CRAWLAB_SERVER_REGISTER_TYPE
value: "hostname"

View File

@@ -0,0 +1,28 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mongo-pv-volume
namespace: crawlab
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/data/k8s/mongodb/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongo-pv-claim
namespace: crawlab
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi

41
devops/master/mongo.yaml Normal file
View File

@@ -0,0 +1,41 @@
apiVersion: v1
kind: Service
metadata:
name: mongo
namespace: crawlab
spec:
ports:
- port: 27017
selector:
app: mongo
clusterIP: None
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: mongo
namespace: crawlab
spec:
selector:
matchLabels:
app: mongo
strategy:
type: Recreate
template:
metadata:
labels:
app: mongo
spec:
containers:
- image: mongo:4
name: mongo
ports:
- containerPort: 27017
name: mongo
volumeMounts:
- name: mongo-persistent-storage
mountPath: /data/db
volumes:
- name: mongo-persistent-storage
persistentVolumeClaim:
claimName: mongo-pv-claim

4
devops/master/ns.yaml Normal file
View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: crawlab

34
devops/master/redis.yaml Normal file
View File

@@ -0,0 +1,34 @@
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: crawlab
spec:
ports:
- port: 6379
selector:
app: redis
clusterIP: None
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: redis
namespace: crawlab
spec:
selector:
matchLabels:
app: redis
strategy:
type: Recreate
template:
metadata:
labels:
app: redis
spec:
containers:
- image: redis
name: redis
ports:
- containerPort: 6379
name: redis

View File

@@ -2,6 +2,7 @@
<el-tabs
v-model="activeTabName"
class="git-settings"
@change="onChangeTab"
>
<el-tab-pane :label="$t('Settings')" name="settings">
<el-form
@@ -357,7 +358,7 @@ export default {
this.isGitCheckoutLoading = false
await this.getCommits()
}
this.$st.sendEv('爬虫详情', 'Git', 'Checkout')
this.$st.sendEv('爬虫详情', 'Git Log', 'Checkout')
},
async updateGit () {
this.getCommits()
@@ -377,6 +378,9 @@ export default {
if (c.remote_branches && c.remote_branches.length) {
return 'info'
}
},
onChangeTab () {
this.$st.sendEv('爬虫详情', 'Git 切换标签', this.activeTabName)
}
},
async created () {

View File

@@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: crawlab
namespace: crawlab-master
namespace: crawlab
spec:
ports:
- port: 8080
@@ -16,7 +16,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: crawlab-master
namespace: crawlab-master
namespace: crawlab
spec:
serviceName: crawlab-master
selector:

View File

@@ -2,7 +2,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: crawlab-worker
namespace: crawlab-master
namespace: crawlab
spec:
serviceName: crawlab-worker
replicas: 2

4
k8s/ns.yaml Normal file
View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: crawlab