Added deployment stuffs
This commit is contained in:
		
							parent
							
								
									fc8d73468d
								
							
						
					
					
						commit
						99e7c01145
					
				
							
								
								
									
										52
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,52 @@ | ||||
| kind: pipeline | ||||
| type: kubernetes | ||||
| name: default | ||||
| 
 | ||||
| trigger: | ||||
|   event: | ||||
|     - push | ||||
| 
 | ||||
| steps: | ||||
| - name: build | ||||
|   image: golang:1.18.0-alpine | ||||
|   volumes: | ||||
|     - name: builder | ||||
|       path: /drone/src/build | ||||
|   commands: | ||||
|     - go build -o ./build/app ./src | ||||
| - name: docker | ||||
|   image: plugins/docker | ||||
|   volumes: | ||||
|     - name: builder | ||||
|       path: /drone/src/build | ||||
|   settings: | ||||
|     cache_from: | ||||
|       - "dutchellie/proper-website-p2p-api:latest" | ||||
|     username:  | ||||
|       from_secret: docker_username | ||||
|     password: | ||||
|       from_secret: docker_password | ||||
|     repo: dutchellie/proper-website-p2p-api | ||||
|     tags:  | ||||
|       - latest | ||||
|       - ${DRONE_COMMIT_SHA:0:8} | ||||
| - name: deploy | ||||
|   image: pelotech/drone-helm3 | ||||
|   settings: | ||||
|     mode: upgrade | ||||
|     chart: .drone/helm/api | ||||
|     namespace: drone-production | ||||
|     release: quenten-p2p-api-prod | ||||
|     skip_tls_verify: true | ||||
|     values_files: | ||||
|       - .drone/helm/prod-val.yaml | ||||
|     values: | ||||
|       - "image.image=dutchellie/proper-website-p2p-api:${DRONE_COMMIT_SHA:0:8}" | ||||
|     kube_api_server: | ||||
|       from_secret: prod_api_server | ||||
|     kube_token: | ||||
|       from_secret: prod_kube_token | ||||
|     kube_certificate: | ||||
|       from_secret: prod_kube_certificate | ||||
|     kube_service_account: drone-deploy | ||||
|     dry_run: false | ||||
							
								
								
									
										23
									
								
								.drone/helm/api/.helmignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								.drone/helm/api/.helmignore
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| # Patterns to ignore when building packages. | ||||
| # This supports shell glob matching, relative path matching, and | ||||
| # negation (prefixed with !). Only one pattern per line. | ||||
| .DS_Store | ||||
| # Common VCS dirs | ||||
| .git/ | ||||
| .gitignore | ||||
| .bzr/ | ||||
| .bzrignore | ||||
| .hg/ | ||||
| .hgignore | ||||
| .svn/ | ||||
| # Common backup files | ||||
| *.swp | ||||
| *.bak | ||||
| *.tmp | ||||
| *.orig | ||||
| *~ | ||||
| # Various IDEs | ||||
| .project | ||||
| .idea/ | ||||
| *.tmproj | ||||
| .vscode/ | ||||
							
								
								
									
										5
									
								
								.drone/helm/api/Chart.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.drone/helm/api/Chart.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| apiVersion: v2 | ||||
| name: p2p-api | ||||
| description: Helm chart for p2p API | ||||
| type: application | ||||
| version: 0.0.1 | ||||
							
								
								
									
										44
									
								
								.drone/helm/api/templates/deployment.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								.drone/helm/api/templates/deployment.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,44 @@ | ||||
| apiVersion: apps/v1 | ||||
| kind: Deployment | ||||
| metadata: | ||||
|   name: {{ .Values.name }} | ||||
|   namespace: {{ .Release.Namespace }} | ||||
|   {{- if .Values.annotations }} | ||||
|     annotations: {{ toYaml .Values.annotations | nindent 4}} | ||||
|   {{- end}} | ||||
| spec: | ||||
|   replicas: {{ .Values.replicaCount }} | ||||
|   selector: | ||||
|     matchLabels: | ||||
|       app: {{ .Values.name }} | ||||
|       release: {{ .Values.release }} | ||||
|   template: | ||||
|     metadata: | ||||
|     {{- if .Values.podAnnotations }} | ||||
|       annotations: | ||||
|         {{- range $key, $value := .Values.podAnnotations }} | ||||
|           {{ $key }}: {{ $value | quote }} | ||||
|         {{- end }} | ||||
|     {{- end }} | ||||
|       labels:  | ||||
|         app: {{ .Values.name }} | ||||
|         release: {{ .Values.release }} | ||||
|     spec: | ||||
|       {{- with .Values.imagePullSecrets }} | ||||
|       imagePullSecrets: | ||||
|         {{- toYaml . | nindent 8 }} | ||||
|       {{- end }} | ||||
|       containers: | ||||
|         - name: {{ .Values.containerName }} | ||||
|           image: {{ .Values.image.image }} | ||||
|           imagePullPolicy: {{ .Values.image.pullPolicy }} | ||||
|           ports: | ||||
|             - name: p2papi | ||||
|               protocol: TCP | ||||
|               containerPort: 6666 | ||||
|             - name: p2papi | ||||
|               protocol: UDP | ||||
|               containerPort: 6666 | ||||
| #         env: | ||||
| #           - name: MONGO_CREDS | ||||
| #             value: {{ .Values.mongoCreds }} | ||||
							
								
								
									
										22
									
								
								.drone/helm/api/templates/service.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								.drone/helm/api/templates/service.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| apiVersion: v1 | ||||
| kind: Service | ||||
| metadata: | ||||
|   name: {{ .Values.service.name }} | ||||
|   namespace: {{ .Release.Namespace }} | ||||
|   {{- with .Values.service.annotations }} | ||||
|   annotations: | ||||
|     {{- toYaml . | nindent 4 }} | ||||
|   {{- end }} | ||||
| spec: | ||||
|   selector: | ||||
|     app: {{ .Values.name }} | ||||
|     release: {{ .Values.release }} | ||||
|   ports: | ||||
|     - protocol: TCP | ||||
|       name: p2papi | ||||
|       port: 6666 | ||||
|       targetPort: 6666 | ||||
|     - protocol: UDP | ||||
|       name: p2papi | ||||
|       port: 6666 | ||||
|       targetPort: 6666 | ||||
							
								
								
									
										15
									
								
								.drone/helm/api/values.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								.drone/helm/api/values.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| name: p2papi-deployment | ||||
| annotations: {} | ||||
| replicaCount: 1 | ||||
| release: latest | ||||
| podAnnotations: {} | ||||
| imagePullSecrets: {} | ||||
| 
 | ||||
| containerName: proper-website-p2p-api | ||||
| image: | ||||
|   image: dutchellie/proper-website-p2p-api | ||||
|   pullPolicy: Always | ||||
| 
 | ||||
| service: | ||||
|   name: p2papi-service | ||||
|   annotations: {} | ||||
							
								
								
									
										7
									
								
								.drone/helm/prod-val.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								.drone/helm/prod-val.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| name: p2papi-prod | ||||
| 
 | ||||
| image: | ||||
|   pullPolicy: Always | ||||
| 
 | ||||
| service: | ||||
|   name: p2papi-prod | ||||
							
								
								
									
										6
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| FROM alpine:latest | ||||
| RUN apk --no-cache add ca-certificates | ||||
| WORKDIR /root | ||||
| RUN ./build/app . | ||||
| EXPOSE 6666 | ||||
| CMD ["./app"] | ||||
							
								
								
									
										5
									
								
								src/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/main.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| package main | ||||
| 
 | ||||
| func main() { | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user