- use python-on-whale to use docker cli api directly, creating docker stack for each crawl or profile browser - configure storages via storages.yaml secret - add crawl_job, profile_job, splitting into base and k8s/swarm implementations - split manager into base crawlmanager and k8s/swarm implementations - swarm: load initial scale from db to avoid modifying fixed configs, in k8s, load from configmap - swarm: support scheduled jobs via swarm-cronjob service - remove docker dependencies (aiodocker, apscheduler, scheduling) - swarm: when using local minio, expose via /data/ route in nginx via extra include (in k8s, include dir is empty and routing handled via ingress) - k8s: cleanup minio chart: move init containers to minio.yaml - swarm: stateful set implementation to be consistent with k8s scaling: - don't use service replicas, - create a unique service with '-N' appended and allocate unique volume for each replica - allows crawl containers to be restarted w/o losing data - add volume pruning background service, as volumes can be deleted only after service shuts down fully - watch: fully simplify routing, route via replica index instead of ip for both k8s and swarm - rename network btrix-cloud-net -> btrix-net to avoid conflict with compose network
		
			
				
	
	
		
			116 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			116 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| ---
 | |
| apiVersion: apps/v1
 | |
| kind: Deployment
 | |
| metadata:
 | |
|   name: {{ .Values.name }}-backend
 | |
|   namespace: {{ .Release.Namespace }}
 | |
| 
 | |
| spec:
 | |
|   selector:
 | |
|     matchLabels:
 | |
|       app: {{ .Values.name }}
 | |
|       role: backend
 | |
|   replicas: {{ .Values.api_num_replicas }}
 | |
|   template:
 | |
|     metadata:
 | |
|       labels:
 | |
|         app: {{ .Values.name }}
 | |
|         role: backend
 | |
| 
 | |
|       annotations:
 | |
|         # force helm to update the deployment each time
 | |
|         {{- if not .Values.frontend_only }}
 | |
|         "helm.update": {{ randAlphaNum 5 | quote }}
 | |
|         {{- end }}
 | |
| 
 | |
|     spec:
 | |
|       {{- if .Values.main_node_type }}
 | |
|       nodeSelector:
 | |
|         nodeType: {{ .Values.main_node_type }}
 | |
|       {{- end }}
 | |
| 
 | |
|       containers:
 | |
|         - name: api
 | |
|           image: {{ .Values.api_image }}
 | |
|           imagePullPolicy: {{ .Values.api_pull_policy }}
 | |
|           envFrom:
 | |
|             - configMapRef:
 | |
|                 name: {{ .Values.name }}-env-config
 | |
|             - secretRef:
 | |
|                 name: auth-secrets
 | |
|             - secretRef:
 | |
|                 name: mongo-auth
 | |
| 
 | |
|           resources:
 | |
|             limits:
 | |
|               cpu: {{ .Values.api_limits_cpu }}
 | |
|               memory: {{ .Values.api_limits_memory }}
 | |
| 
 | |
|             requests:
 | |
|               cpu: {{ .Values.api_requests_cpu }}
 | |
|               memory: {{ .Values.api_requests_memory }}
 | |
| 
 | |
|           startupProbe:
 | |
|             httpGet:
 | |
|               path: /healthz
 | |
|               port: 8000
 | |
|             initialDelaySeconds: 5
 | |
|             periodSeconds: 5
 | |
|             failureThreshold: 30
 | |
|             successThreshold: 1
 | |
| 
 | |
|           readinessProbe:
 | |
|             httpGet:
 | |
|               path: /healthz
 | |
|               port: 8000
 | |
|             initialDelaySeconds: 5
 | |
|             periodSeconds: 30
 | |
|             failureThreshold: 5
 | |
|             successThreshold: 1
 | |
| 
 | |
|           livenessProbe:
 | |
|             httpGet:
 | |
|               path: /healthz
 | |
|               port: 8000
 | |
|             initialDelaySeconds: 5
 | |
|             periodSeconds: 30
 | |
|             failureThreshold: 5
 | |
|             successThreshold: 1
 | |
| 
 | |
| ---
 | |
| 
 | |
| apiVersion: v1
 | |
| kind: Service
 | |
| 
 | |
| metadata:
 | |
|   namespace: {{ .Release.Namespace }}
 | |
|   name: {{ .Values.name }}-backend
 | |
|   labels:
 | |
|     app: {{ .Values.name }}
 | |
|     role: backend
 | |
| 
 | |
| {{- if .Values.service }}
 | |
|   {{- if .Values.service.annotations }}
 | |
|   annotations:
 | |
|   {{- range $key, $val := .Values.service.annotations }}
 | |
|     {{ $key }}: {{ $val | quote }}
 | |
|   {{- end }}
 | |
|   {{- end }}
 | |
| {{- end }}
 | |
| 
 | |
| spec:
 | |
|   selector:
 | |
|     app: {{ .Values.name }}
 | |
|     role: backend
 | |
| 
 | |
| {{- if .Values.service }}
 | |
|   {{- if .Values.service.type }}
 | |
|   type: {{ .Values.service.type | quote }}
 | |
|   {{- end }}
 | |
| {{- end }}
 | |
| 
 | |
|   ports:
 | |
|     - protocol: TCP
 | |
|       port: 8000
 | |
|       name: api
 |