Compare commits

...

2 Commits

Author SHA1 Message Date
DutchEllie 8730911a5d
Update .drone
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2022-06-29 15:11:10 +02:00
DutchEllie 4b32e554dc
Change chart 2022-06-29 15:06:12 +02:00
6 changed files with 115 additions and 22 deletions

View File

@ -5,6 +5,8 @@ name: staging
trigger:
event:
- push
branch:
- main
# STAGING!!!!
steps:
@ -61,6 +63,8 @@ steps:
- .drone/helm/staging-val.yaml
values:
- "image=dutchellie/proper-website-2:dev-${DRONE_COMMIT_SHA:0:8}"
- "baseURL=staging.quenten.nl"
- "name=newsite-staging"
kube_api_server:
from_secret: staging_api_server
kube_token:
@ -87,6 +91,8 @@ trigger:
- promote
target:
- production
branch:
- main
# PRODUCTION!!!!
steps:
@ -143,6 +149,8 @@ steps:
- .drone/helm/prod-val.yaml
values:
- "image=dutchellie/proper-website-2:latest-${DRONE_COMMIT_SHA:0:8}"
- "baseURL=quenten.nl"
- "name=newsite-prod"
kube_api_server:
from_secret: prod_api_server
kube_token:
@ -156,4 +164,87 @@ steps:
volumes:
- name: build
temp: {}
---
kind: pipeline
type: kubernetes
name: feature-branch
trigger:
event:
- push
branch:
exclude:
- main
# FEATURE DEPLOY
steps:
- name: build-wasm
image: golang:1.17.8-alpine
volumes:
- name: build-feature
path: /drone/src/build
environment:
APIURL: https://api.quenten.nl/api/testing
CGO_ENABLED: 0
commands:
- mkdir ./build/web
- GOARCH=wasm GOOS=js go build -o ./build/web/app.wasm -ldflags="-X 'main.ApiURL=$APIURL'" ./src
- name: build-server
image: golang:1.17.8-alpine
volumes:
- name: build-feature
path: /drone/src/build
environment:
APIURL: https://api.quenten.nl/api/testing
CGO_ENABLED: 0
commands:
- go build -o ./build/app -ldflags="-X 'main.ApiURL=$APIURL'" ./src
- name: build-publish-image
image: plugins/docker
privileged: true
volumes:
- name: build-feature
path: /drone/src/build
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile
repo: dutchellie/proper-website-2
tags:
- feature-${DRONE_BRANCH}-${DRONE_COMMIT_SHA:0:8}
depends_on:
- build-wasm
- build-server
- name: deploy-staging
image: pelotech/drone-helm3
settings:
mode: upgrade
chart: .drone/helm/chart
namespace: drone-staging
release: feature-${DRONE_BRANCH}
skip_tls_verify: true
values_files:
- .drone/helm/staging-val.yaml
values:
- "image=dutchellie/proper-website-2:feature-${DRONE_BRANCH}-${DRONE_COMMIT_SHA:0:8}"
- "baseURL=${DRONE_BRANCH}.quenten.nl"
- "name=${DRONE_BRANCH}-deployment"
kube_api_server:
from_secret: staging_api_server
kube_token:
from_secret: staging_kube_token
kube_certificate:
from_secret: staging_kube_certificate
kube_service_account: drone-deploy
dry_run: false
depends_on:
- build-publish-image
volumes:
- name: build-feature
temp: {}

View File

@ -1,3 +1,3 @@
apiVersion: v2
name: newsite
version: v0.0.1
version: v0.0.2

View File

@ -1,11 +1,11 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.ingress.name }}
name: {{ tpl .Values.ingress.name . }}
namespace: {{ .Release.Namespace }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- tpl (. | toYaml) $ | nindent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.className }}
@ -14,14 +14,14 @@ spec:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
- {{ tpl . $ | quote }}
{{- end }}
secretName: {{ .secretName }}
secretName: {{ tpl (.secretName | toYaml) $ }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
- host: {{ tpl .host $ | quote }}
http:
paths:
{{- range .paths }}
@ -29,7 +29,7 @@ spec:
pathType: {{ .pathType }}
backend:
service:
name: {{ $.Values.service.name }}
name: {{ tpl $.Values.service.name $ }}
port:
number: 8000
{{- end }}

View File

@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service.name }}
name: {{ tpl .Values.service.name . }}
namespace: {{ .Release.Namespace }}
{{- with .Values.service.annotations }}
annotations:

View File

@ -1,23 +1,24 @@
baseURL: quenten.nl
name: newsite-prod
containerEnv:
- name: APIURL
value: https://api.quenten.nl/api
service:
name: newsite-prod
name: "{{ .Values.name }}"
ingress:
name: newsite-prod
name: "{{ .Values.name }}"
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
external-dns.alpha.kubernetes.io/hostname: "quenten.nl"
cert-manager.io/cluster-issuer: "letsencrypt-{{ .Values.name }}"
external-dns.alpha.kubernetes.io/hostname: "{{ .Values.baseURL }}"
nginx.ingress.kubernetes.io/configuration-snippet: |
add_header Content-Security-Policy "frame-ancestors 'self' https://forestofunix.xyz";
proxy_hide_header X-Frame-Options ;
tls:
- hosts:
- quenten.nl
secretName: newsite-tls
- "{{ .Values.baseURL }}"
secretName: "{{ .Values.name }}-tls"
hosts:
- host: quenten.nl
- host: "{{ .Values.baseURL }}"
paths:
- path: /
pathType: Prefix

View File

@ -1,23 +1,24 @@
baseURL: staging.quenten.nl
name: newsite-staging
containerEnv:
- name: APIURL
value: https://api.quenten.nl/api/testing
service:
name: newsite-staging
name: "{{ .Values.name }}"
ingress:
name: newsite-staging
name: "{{ .Values.name }}"
annotations:
cert-manager.io/cluster-issuer: letsencrypt-staging
external-dns.alpha.kubernetes.io/hostname: "staging.quenten.nl"
cert-manager.io/cluster-issuer: "letsencrypt-{{ .Values.name }}"
external-dns.alpha.kubernetes.io/hostname: "{{ .Values.baseURL }}"
nginx.ingress.kubernetes.io/configuration-snippet: |
add_header Content-Security-Policy "frame-ancestors 'self' https://forestofunix.xyz";
proxy_hide_header X-Frame-Options ;
tls:
- hosts:
- staging.quenten.nl
secretName: newsite-staging-tls
- "{{ .Values.baseURL }}"
secretName: "{{ .Values.name }}-tls"
hosts:
- host: staging.quenten.nl
- host: "{{ .Values.baseURL }}"
paths:
- path: /
pathType: Prefix