Skip to content

Commit fec3bf3

Browse files
authored
Merge pull request #60 from FlowCI/develop
Develop
2 parents e5bfbd4 + a03ab53 commit fec3bf3

14 files changed

+596
-33
lines changed

Caddyfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:8080
2+
3+
reverse_proxy 172.1.2.1:8080 172.1.2.2:8080 {
4+
lb_policy first
5+
}

agent.sh

-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ checkTokenArg()
4444

4545
startAgent()
4646
{
47-
# setup pyenv for docker runtime in step
48-
docker volume create pyenv
49-
docker run --rm -v pyenv:/target flowci/pyenv:1.3 bash -c "/ws/init-pyenv-volume.sh"
50-
5147
echo $URL
5248
echo $TOKEN
5349
echo $MODEL

host-init.sh

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
#!/usr/bin/env bash
22

33
## the script to initialize ssh-host pool environment
4-
5-
docker pull flowci/pyenv:1.3
6-
docker volume create pyenv
7-
docker run --rm -v pyenv:/target flowci/pyenv:1.3 bash -c "/ws/init-pyenv-volume.sh"
84
docker pull flowci/agent:latest

k8s/README.md

Whitespace-only changes.

k8s/core.yaml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# core
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: flowci-core-service
6+
spec:
7+
type: NodePort
8+
selector:
9+
app: flowci-core
10+
ports:
11+
- protocol: TCP
12+
port: 8080
13+
nodePort: 30180
14+
15+
---
16+
apiVersion: apps/v1
17+
kind: Deployment
18+
metadata:
19+
name: flowci-core-deployment
20+
labels:
21+
app: flowci-core
22+
spec:
23+
replicas: 1
24+
selector:
25+
matchLabels:
26+
app: flowci-core
27+
template:
28+
metadata:
29+
labels:
30+
app: flowci-core
31+
spec:
32+
containers:
33+
- name: core
34+
image: flowci/core:dev
35+
imagePullPolicy: Always
36+
env:
37+
- name: FLOWCI_LOG_LEVEL
38+
value: DEBUG
39+
- name: FLOWCI_SERVER_URL
40+
value: http://flowci-core-service:8080
41+
- name: FLOWCI_MONGODB_URI
42+
value: mongodb://flowci-db-service:27017/flow_ci_db
43+
- name: FLOWCI_RABBITMQ_URI
44+
value: amqp://guest:guest@flowci-mq-service:5672
45+
- name: FLOWCI_MINIO_ENDPOINT
46+
value: http://flowci-minio-service:9000
47+
- name: FLOWCI_MINIO_KEY
48+
value: minio
49+
- name: FLOWCI_MINIO_SECRET
50+
value: minio123
51+
- name: FLOWCI_ZK_HOST
52+
value: flowci-zk-service
53+
- name: FLOWCI_AGENT_IMAGE
54+
value: flowci/agent:dev
55+
- name: FLOWCI_AGENT_VOLUMES
56+
value: "name=pyenv,dest=/ci/python,script=init.sh,image=flowci/pyenv:1.3,init=init-pyenv-volume.sh"
57+
- name: K8S_NAMESPACE
58+
valueFrom:
59+
fieldRef:
60+
fieldPath: metadata.namespace
61+
- name: K8S_POD_NAME
62+
valueFrom:
63+
fieldRef:
64+
fieldPath: metadata.name
65+
- name: K8S_POD_IP
66+
valueFrom:
67+
fieldRef:
68+
fieldPath: status.podIP
69+
command:
70+
[
71+
"./wait_for_it.sh",
72+
"flowci-mq-service:5672",
73+
"-t",
74+
"0",
75+
"--strict",
76+
"--",
77+
"java",
78+
"-XX:+UnlockExperimentalVMOptions",
79+
"-XX:+UseCGroupMemoryLimitForHeap",
80+
"-XX:-UseAdaptiveSizePolicy",
81+
"-Xms1500m",
82+
"-Xmx1500m",
83+
"-Xmn900m",
84+
"-XX:SurvivorRatio=5",
85+
"-jar",
86+
"flow-ci-core.jar",
87+
]
88+
ports:
89+
- containerPort: 8080
90+
resources:
91+
requests:
92+
memory: "2Gi"
93+
cpu: "2000m"
94+
limits:
95+
memory: "2Gi"
96+
cpu: "2000m"

k8s/db.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# mongodb
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: flowci-db-service
6+
spec:
7+
selector:
8+
app: flowci-db
9+
ports:
10+
- protocol: TCP
11+
port: 27017
12+
13+
---
14+
15+
apiVersion: apps/v1
16+
kind: Deployment
17+
metadata:
18+
name: flowci-db-deployment
19+
labels:
20+
app: flowci-db
21+
spec:
22+
replicas: 1
23+
selector:
24+
matchLabels:
25+
app: flowci-db
26+
template:
27+
metadata:
28+
labels:
29+
app: flowci-db
30+
spec:
31+
volumes:
32+
- name: data
33+
hostPath:
34+
path: /flowci/db
35+
type: DirectoryOrCreate
36+
containers:
37+
- name: db
38+
image: mongo:4.2
39+
ports:
40+
- containerPort: 27017
41+
volumeMounts:
42+
- mountPath: /data/db
43+
name: data
44+
resources:
45+
requests:
46+
memory: "256Mi"
47+
cpu: "500m"
48+
limits:
49+
memory: "256Mi"
50+
cpu: "500m"

k8s/minio.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# minio
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: flowci-minio-service
6+
spec:
7+
selector:
8+
app: flowci-minio
9+
ports:
10+
- protocol: TCP
11+
port: 9000
12+
13+
---
14+
15+
apiVersion: apps/v1
16+
kind: Deployment
17+
metadata:
18+
name: flowci-minio-deployment
19+
labels:
20+
app: flowci-minio
21+
spec:
22+
replicas: 1
23+
selector:
24+
matchLabels:
25+
app: flowci-minio
26+
template:
27+
metadata:
28+
labels:
29+
app: flowci-minio
30+
spec:
31+
volumes:
32+
- name: data
33+
hostPath:
34+
path: /flowci/minio
35+
type: DirectoryOrCreate
36+
containers:
37+
- name: minio
38+
image: minio/minio:RELEASE.2020-05-01T22-19-14Z
39+
env:
40+
- name: MINIO_ACCESS_KEY
41+
value: "minio"
42+
- name: MINIO_SECRET_KEY
43+
value: "minio123"
44+
args:
45+
- "server"
46+
- "/data"
47+
ports:
48+
- containerPort: 9000
49+
volumeMounts:
50+
- name: data
51+
mountPath: "/data"
52+
resources:
53+
requests:
54+
memory: "256Mi"
55+
cpu: "200m"
56+
limits:
57+
memory: "256Mi"
58+
cpu: "200m"

k8s/rabbitmq.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# rabbit
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: flowci-mq-service
6+
spec:
7+
selector:
8+
app: flowci-mq
9+
ports:
10+
- protocol: TCP
11+
port: 5672
12+
13+
---
14+
15+
apiVersion: apps/v1
16+
kind: Deployment
17+
metadata:
18+
name: flowci-mq-deployment
19+
labels:
20+
app: flowci-mq
21+
spec:
22+
replicas: 1
23+
selector:
24+
matchLabels:
25+
app: flowci-mq
26+
template:
27+
metadata:
28+
labels:
29+
app: flowci-mq
30+
spec:
31+
containers:
32+
- name: mq
33+
image: rabbitmq:3-management
34+
ports:
35+
- containerPort: 5672
36+
resources:
37+
requests:
38+
memory: "512Mi"
39+
cpu: "200m"
40+
limits:
41+
memory: "512Mi"
42+
cpu: "200m"

k8s/standalong-agent.yaml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
generateName: flowci-agent-
5+
labels:
6+
app: flowci-agent
7+
spec:
8+
containers:
9+
- name: agent
10+
image: flowci/agent:dev
11+
imagePullPolicy: Always
12+
env:
13+
- name: FLOWCI_AGENT_LOG_LEVEL
14+
value: DEBUG
15+
- name: FLOWCI_SERVER_URL
16+
value: http://your_server_address:port
17+
- name: FLOWCI_AGENT_TOKEN
18+
value: your_agent_token
19+
- name: FLOWCI_AGENT_VOLUMES
20+
value: "name=pyenv,dest=/ci/python,script=init.sh,image=flowci/pyenv:1.3,init=init-pyenv-volume.sh"
21+
- name: FLOWCI_AGENT_K8S_ENABLED
22+
value: "true"
23+
- name: FLOWCI_AGENT_K8S_IN_CLUSTER
24+
value: "true"
25+
- name: DOCKER_HOST
26+
value: tcp://localhost:2375
27+
- name: K8S_NODE_NAME
28+
valueFrom:
29+
fieldRef:
30+
fieldPath: spec.nodeName
31+
- name: K8S_NAMESPACE
32+
valueFrom:
33+
fieldRef:
34+
fieldPath: metadata.namespace
35+
- name: K8S_POD_NAME
36+
valueFrom:
37+
fieldRef:
38+
fieldPath: metadata.name
39+
- name: K8S_POD_IP
40+
valueFrom:
41+
fieldRef:
42+
fieldPath: status.podIP
43+
resources:
44+
requests:
45+
memory: "128Mi"
46+
cpu: "200m"
47+
limits:
48+
memory: "128Mi"
49+
cpu: "200m"
50+
- name: docker-runtime
51+
image: docker:dind
52+
imagePullPolicy: Always
53+
env:
54+
- name: DOCKER_TLS_CERTDIR
55+
value: ""
56+
securityContext:
57+
privileged: true
58+
resources:
59+
requests:
60+
memory: "256Mi"
61+
cpu: "200m"
62+
limits:
63+
memory: "256Mi"
64+
cpu: "200m"

k8s/web.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# web
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: flowci-web-service
6+
spec:
7+
type: NodePort
8+
selector:
9+
app: flowci-web
10+
ports:
11+
- protocol: TCP
12+
port: 80
13+
nodePort: 30080
14+
15+
---
16+
17+
apiVersion: apps/v1
18+
kind: Deployment
19+
metadata:
20+
name: flowci-web-deployment
21+
labels:
22+
app: flowci-web
23+
spec:
24+
replicas: 1
25+
selector:
26+
matchLabels:
27+
app: flowci-web
28+
template:
29+
metadata:
30+
labels:
31+
app: flowci-web
32+
spec:
33+
containers:
34+
- name: web
35+
image: flowci/web:dev
36+
imagePullPolicy: Always
37+
env:
38+
- name: FLOWCI_SERVER_URL
39+
value: http://192.168.0.110:30180
40+
ports:
41+
- containerPort: 80
42+
resources:
43+
requests:
44+
memory: "256Mi"
45+
cpu: "500m"
46+
limits:
47+
memory: "256Mi"
48+
cpu: "500m"

0 commit comments

Comments
 (0)