crazy stuff here

This commit is contained in:
ducoterra
2020-04-22 15:47:12 -04:00
parent 9cc9e65fac
commit 030f1fb73d
5 changed files with 34 additions and 13 deletions

View File

@@ -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

View File

@@ -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'),
}
}

View File

View File

@@ -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
View 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