crazy stuff here
This commit is contained in:
@@ -6,7 +6,6 @@ variables:
|
|||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
- post-deploy
|
|
||||||
|
|
||||||
push:
|
push:
|
||||||
stage: build
|
stage: build
|
||||||
@@ -27,14 +26,7 @@ launch:
|
|||||||
- curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
|
- curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
|
||||||
- chmod +x ./kubectl
|
- chmod +x ./kubectl
|
||||||
- envsubst < k8s/deploy.yaml > out.yaml
|
- envsubst < k8s/deploy.yaml > out.yaml
|
||||||
- cat out.yaml
|
|
||||||
- mv out.yaml k8s/deploy.yaml
|
- mv out.yaml k8s/deploy.yaml
|
||||||
- ./kubectl apply -f k8s/
|
- envsubst < k8s/job.yaml > out.yaml
|
||||||
|
- mv out.yaml k8s/job.yaml
|
||||||
migrate:
|
- ./kubectl apply -f k8s/
|
||||||
stage: post-deploy
|
|
||||||
image:
|
|
||||||
name: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
|
||||||
entrypoint: [""]
|
|
||||||
script:
|
|
||||||
- python manage.py migrate
|
|
||||||
@@ -76,7 +76,7 @@ WSGI_APPLICATION = 'config.wsgi.application'
|
|||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
'NAME': os.path.join(BASE_DIR, 'db/db.sqlite3'),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ spec:
|
|||||||
- name: test
|
- name: test
|
||||||
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /app/db.sqlite3
|
- mountPath: /app/db
|
||||||
name: test
|
name: test
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
|
|||||||
29
k8s/job.yaml
Normal file
29
k8s/job.yaml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: pi
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: test
|
||||||
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||||
|
command: ["python", "manage.py", "migrate"]
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /app/db
|
||||||
|
name: test
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "256Mi"
|
||||||
|
cpu: "250m"
|
||||||
|
requests:
|
||||||
|
memory: "1Mi"
|
||||||
|
cpu: "1m"
|
||||||
|
ports:
|
||||||
|
- containerPort: 8000
|
||||||
|
volumes:
|
||||||
|
- name: test
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: test
|
||||||
|
restartPolicy: Never
|
||||||
|
backoffLimit: 4
|
||||||
Reference in New Issue
Block a user