crazy stuff here
This commit is contained in:
@@ -6,7 +6,6 @@ variables:
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
- post-deploy
|
||||
|
||||
push:
|
||||
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
|
||||
- chmod +x ./kubectl
|
||||
- envsubst < k8s/deploy.yaml > out.yaml
|
||||
- cat out.yaml
|
||||
- mv out.yaml k8s/deploy.yaml
|
||||
- envsubst < k8s/job.yaml > out.yaml
|
||||
- mv out.yaml k8s/job.yaml
|
||||
- ./kubectl apply -f k8s/
|
||||
|
||||
migrate:
|
||||
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 = {
|
||||
'default': {
|
||||
'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
|
||||
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
volumeMounts:
|
||||
- mountPath: /app/db.sqlite3
|
||||
- mountPath: /app/db
|
||||
name: test
|
||||
resources:
|
||||
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