Skip to content

Commit

Permalink
staging config wip
Browse files Browse the repository at this point in the history
  • Loading branch information
LepkoQQ committed Dec 17, 2024
1 parent f1e9a95 commit d62a6e7
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 54 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and publish Docker image
on:
push:
branches:
- v3-k8s
- v3-k8s-staging
jobs:
push-to-registry:
name: Build and push Docker image to registry
Expand All @@ -27,17 +27,17 @@ jobs:
context: .
push: true
tags: |
rg.fr-par.scw.cloud/djnd/danesjenovdan:${{ github.sha }}
rg.fr-par.scw.cloud/djnd/danesjenovdan:latest
rg.fr-par.scw.cloud/djnd/danesjenovdan-staging:${{ github.sha }}
rg.fr-par.scw.cloud/djnd/danesjenovdan-staging:latest
- name: Build and push DJND website redirects
uses: docker/build-push-action@v3
with:
context: ./website-redirects
push: true
tags: |
rg.fr-par.scw.cloud/djnd/danesjenovdan-website-redirects:${{ github.sha }}
rg.fr-par.scw.cloud/djnd/danesjenovdan-website-redirects:latest
# - name: Build and push DJND website redirects
# uses: docker/build-push-action@v3
# with:
# context: ./website-redirects
# push: true
# tags: |
# rg.fr-par.scw.cloud/djnd/danesjenovdan-website-redirects:${{ github.sha }}
# rg.fr-par.scw.cloud/djnd/danesjenovdan-website-redirects:latest

- name: Update image versions in kustomize/kustomization.yaml
run: |
Expand Down
30 changes: 15 additions & 15 deletions kustomize/djnd/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: danesjenovdan
name: danesjenovdan-staging
labels:
app: danesjenovdan
app: danesjenovdan-staging
spec:
replicas: 1
selector:
matchLabels:
app: danesjenovdan
app: danesjenovdan-staging
template:
metadata:
labels:
app: danesjenovdan
app: danesjenovdan-staging
spec:
securityContext:
fsGroup: 1000
volumes:
- name: danesjenovdan-storage
- name: danesjenovdan-staging-storage
emptyDir: {}
initContainers:
- name: collectstatic
image: danesjenovdan
image: danesjenovdan-staging
volumeMounts:
- name: danesjenovdan-storage
- name: danesjenovdan-staging-storage
mountPath: /storage
command:
- python
Expand All @@ -35,7 +35,7 @@ spec:
value: djnd.settings.production
envFrom:
- secretRef:
name: danesjenovdan-secrets
name: danesjenovdan-staging-secrets
resources:
requests:
memory: 500Mi
Expand All @@ -44,9 +44,9 @@ spec:
memory: 1Gi
cpu: 500m
- name: migrate
image: danesjenovdan
image: danesjenovdan-staging
volumeMounts:
- name: danesjenovdan-storage
- name: danesjenovdan-staging-storage
mountPath: /storage
command:
- python
Expand All @@ -58,7 +58,7 @@ spec:
value: djnd.settings.production
envFrom:
- secretRef:
name: danesjenovdan-secrets
name: danesjenovdan-staging-secrets
resources:
requests:
memory: 500Mi
Expand All @@ -68,9 +68,9 @@ spec:
cpu: 500m
containers:
- name: djnd
image: danesjenovdan
image: danesjenovdan-staging
volumeMounts:
- name: danesjenovdan-storage
- name: danesjenovdan-staging-storage
mountPath: /storage
command:
- gunicorn
Expand All @@ -92,7 +92,7 @@ spec:
value: djnd.settings.production
envFrom:
- secretRef:
name: danesjenovdan-secrets
name: danesjenovdan-staging-secrets
resources:
requests:
memory: 500Mi
Expand All @@ -103,7 +103,7 @@ spec:
- name: djnd-nginx
image: nginx:alpine
volumeMounts:
- name: danesjenovdan-storage
- name: danesjenovdan-staging-storage
mountPath: /usr/share/nginx/html
ports:
- containerPort: 80
Expand Down
24 changes: 12 additions & 12 deletions kustomize/djnd/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: danesjenovdan
name: danesjenovdan-staging
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-production"
nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
# nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
nginx.ingress.kubernetes.io/proxy-body-size: 10m
spec:
ingressClassName: nginx
tls:
- hosts:
- danesjenovdan.si
- www.danesjenovdan.si
secretName: danesjenovdan-tls
- staging.danesjenovdan.lb.djnd.si
# - www.danesjenovdan.si
secretName: danesjenovdan-staging-tls
rules:
- host: danesjenovdan.si
- host: staging.danesjenovdan.lb.djnd.si
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: danesjenovdan
name: danesjenovdan-staging
port:
number: 8000
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: danesjenovdan-nginx
name: danesjenovdan-staging-nginx
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-production"
nginx.ingress.kubernetes.io/enable-cors: "true"
spec:
ingressClassName: nginx
tls:
- hosts:
- files.danesjenovdan.lb.djnd.si
secretName: danesjenovdan-nginx-tls
- files.staging.danesjenovdan.lb.djnd.si
secretName: danesjenovdan-staging-nginx-tls
rules:
- host: files.danesjenovdan.lb.djnd.si
- host: files.staging.danesjenovdan.lb.djnd.si
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: danesjenovdan-nginx
name: danesjenovdan-staging-nginx
port:
number: 80
8 changes: 4 additions & 4 deletions kustomize/djnd/service.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: danesjenovdan
name: danesjenovdan-staging
spec:
selector:
app: danesjenovdan
app: danesjenovdan-staging
ports:
- protocol: TCP
port: 8000
Expand All @@ -13,10 +13,10 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: danesjenovdan-nginx
name: danesjenovdan-staging-nginx
spec:
selector:
app: danesjenovdan
app: danesjenovdan-staging
ports:
- protocol: TCP
port: 80
Expand Down
16 changes: 8 additions & 8 deletions kustomize/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ resources:
- djnd/deployment.yaml
- djnd/ingress.yaml
- djnd/service.yaml
- website-redirects/deployment.yaml
- website-redirects/ingress.yaml
- website-redirects/service.yaml
# - website-redirects/deployment.yaml
# - website-redirects/ingress.yaml
# - website-redirects/service.yaml
images:
- name: danesjenovdan
newName: rg.fr-par.scw.cloud/djnd/danesjenovdan
newTag: '39d665dd3baf5b3d6bb5a0176decf44d7d755b8b'
- name: danesjenovdan-website-redirects
newName: rg.fr-par.scw.cloud/djnd/danesjenovdan-website-redirects
- name: danesjenovdan-staging
newName: rg.fr-par.scw.cloud/djnd/danesjenovdan-staging
newTag: '39d665dd3baf5b3d6bb5a0176decf44d7d755b8b'
# - name: danesjenovdan-website-redirects
# newName: rg.fr-par.scw.cloud/djnd/danesjenovdan-website-redirects
# newTag: '39d665dd3baf5b3d6bb5a0176decf44d7d755b8b'
2 changes: 1 addition & 1 deletion kustomize/secrets.example.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: danesjenovdan-secrets
name: danesjenovdan-staging-secrets
type: Opaque
stringData:
# DJANGO_DEBUG: ""
Expand Down
6 changes: 3 additions & 3 deletions website-redirects/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

docker login rg.fr-par.scw.cloud/djnd -u nologin -p $SCW_SECRET_TOKEN

docker build -f Dockerfile -t danesjenovdan-website-redirects:latest .
docker tag danesjenovdan-website-redirects:latest rg.fr-par.scw.cloud/djnd/danesjenovdan-website-redirects:latest
docker push rg.fr-par.scw.cloud/djnd/danesjenovdan-website-redirects:latest
# docker build -f Dockerfile -t danesjenovdan-website-redirects:latest .
# docker tag danesjenovdan-website-redirects:latest rg.fr-par.scw.cloud/djnd/danesjenovdan-website-redirects:latest
# docker push rg.fr-par.scw.cloud/djnd/danesjenovdan-website-redirects:latest

0 comments on commit d62a6e7

Please sign in to comment.