mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-09 22:44:54 +03:00
v2 include the deployment and fix folders paths
This commit is contained in:
parent
50e0b53f63
commit
e80c84488a
130
{{cookiecutter.project_slug}}/deployment/deploy.yml
Normal file
130
{{cookiecutter.project_slug}}/deployment/deploy.yml
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{cookiecutter.project_slug}}
|
||||||
|
labels:
|
||||||
|
app: {{cookiecutter.project_slug}}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8000
|
||||||
|
selector:
|
||||||
|
app: {{cookiecutter.project_slug}}
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{cookiecutter.project_slug}}
|
||||||
|
spec:
|
||||||
|
replicas: 2
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{cookiecutter.project_slug}}
|
||||||
|
fleet: production
|
||||||
|
|
||||||
|
spec:
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: app
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- {{cookiecutter.project_slug}}
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: myregistrykey
|
||||||
|
containers:
|
||||||
|
- name: {{cookiecutter.project_slug}}
|
||||||
|
image: menacommere-docker-registry.bintray.io/{{cookiecutter.project_slug}}
|
||||||
|
imagePullPolicy: Always
|
||||||
|
env:
|
||||||
|
- name: "DEPLOY_ENV"
|
||||||
|
value: "{{cookiecutter.project_slug}}"
|
||||||
|
- name: "CONSUL_TOKEN"
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: accesstoken
|
||||||
|
name: consul-token
|
||||||
|
- name: DB_HOST
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: hostname
|
||||||
|
name: mysql-prod
|
||||||
|
- name: DB_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: password
|
||||||
|
name: mysql-prod
|
||||||
|
- name: DB_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: username
|
||||||
|
name: mysql-prod
|
||||||
|
volumeMounts:
|
||||||
|
- name: tz-config
|
||||||
|
mountPath: /etc/localtime
|
||||||
|
volumes:
|
||||||
|
- name: tz-config
|
||||||
|
hostPath:
|
||||||
|
path: /usr/share/zoneinfo/Africa/Cairo
|
||||||
|
nodeSelector:
|
||||||
|
environment: production
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{cookiecutter.project_slug}}-worker
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{cookiecutter.project_slug}}-worker
|
||||||
|
fleet: production
|
||||||
|
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: myregistrykey
|
||||||
|
containers:
|
||||||
|
- name: {{cookiecutter.project_slug}}
|
||||||
|
image: menacommere-docker-registry.bintray.io/{{cookiecutter.project_slug}}
|
||||||
|
args: ["./run.sh", "worker"]
|
||||||
|
imagePullPolicy: Always
|
||||||
|
env:
|
||||||
|
- name: "DEPLOY_ENV"
|
||||||
|
value: "{{cookiecutter.project_slug}}"
|
||||||
|
- name: "CONSUL_TOKEN"
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: accesstoken
|
||||||
|
name: consul-token
|
||||||
|
- name: DB_HOST
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: hostname
|
||||||
|
name: mysql-prod
|
||||||
|
- name: DB_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: password
|
||||||
|
name: mysql-prod
|
||||||
|
- name: DB_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: username
|
||||||
|
name: mysql-prod
|
||||||
|
volumeMounts:
|
||||||
|
- name: tz-config
|
||||||
|
mountPath: /etc/localtime
|
||||||
|
volumes:
|
||||||
|
- name: tz-config
|
||||||
|
hostPath:
|
||||||
|
path: /usr/share/zoneinfo/Africa/Cairo
|
||||||
|
nodeSelector:
|
||||||
|
environment: production
|
14
{{cookiecutter.project_slug}}/deployment/ingress.yml
Normal file
14
{{cookiecutter.project_slug}}/deployment/ingress.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{cookiecutter.project_slug}}
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
- host: {{cookiecutter.domain_name}}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
backend:
|
||||||
|
serviceName: {{cookiecutter.project_slug}}
|
||||||
|
servicePort: 80
|
Loading…
Reference in New Issue
Block a user