2021-07-16 15:15:34 +00:00
|
|
|
# Template docker-push
|
|
|
|
|
|
|
|
|
|
# This template allows you to build and push your docker image to a Docker Hub account.
|
|
|
|
|
# The workflow allows running tests, code linting and security scans on feature branches (as well as master).
|
|
|
|
|
# The docker image will be validated and pushed to the docker registry after the code is merged to master.
|
|
|
|
|
|
|
|
|
|
# Prerequisites: $DOCKERHUB_USERNAME, $DOCKERHUB_PASSWORD setup as deployment variables
|
|
|
|
|
|
|
|
|
|
image: atlassian/default-image:2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
definitions:
|
|
|
|
|
services:
|
|
|
|
|
docker:
|
|
|
|
|
memory: 3072
|
|
|
|
|
pipelines:
|
|
|
|
|
default:
|
|
|
|
|
- parallel:
|
|
|
|
|
- step:
|
|
|
|
|
name: Build and Test
|
|
|
|
|
script:
|
2021-11-15 15:42:36 +00:00
|
|
|
- docker build . --file docker/coturn/Dockerfile --tag coturn
|
|
|
|
|
- docker build . --file docker/coturn-dns/Dockerfile --tag coturn-dns
|
2021-07-16 15:15:34 +00:00
|
|
|
services:
|
|
|
|
|
- docker
|
|
|
|
|
caches:
|
|
|
|
|
- docker
|
|
|
|
|
- step:
|
|
|
|
|
name: Lint the Dockerfile
|
|
|
|
|
image: hadolint/hadolint:latest-debian
|
|
|
|
|
script:
|
2021-11-15 15:37:15 +00:00
|
|
|
- hadolint docker/coturn/Dockerfile
|
|
|
|
|
- hadolint docker/coturn-dns/Dockerfile
|
2021-07-16 15:15:34 +00:00
|
|
|
branches:
|
2021-07-16 15:24:04 +00:00
|
|
|
main:
|
2021-07-16 15:15:34 +00:00
|
|
|
- step:
|
|
|
|
|
name: Build and Test
|
|
|
|
|
script:
|
2021-11-15 16:38:20 +00:00
|
|
|
- docker build . --file docker/coturn/Dockerfile --tag coturn
|
2021-11-15 15:42:36 +00:00
|
|
|
- docker build . --file docker/coturn-dns/Dockerfile --tag coturn-dns
|
|
|
|
|
- docker save coturn --output "coturn.tar"
|
|
|
|
|
- docker save coturn-dns --output "coturn-dns.tar"
|
2021-07-16 15:15:34 +00:00
|
|
|
services:
|
|
|
|
|
- docker
|
|
|
|
|
caches:
|
|
|
|
|
- docker
|
|
|
|
|
artifacts:
|
|
|
|
|
- "*.tar"
|
|
|
|
|
- step:
|
2021-07-19 17:05:41 +00:00
|
|
|
name: Push docker images to GCR
|
2021-07-16 15:15:34 +00:00
|
|
|
image: google/cloud-sdk:alpine
|
|
|
|
|
script:
|
|
|
|
|
# Authenticating with the service account key file
|
|
|
|
|
- echo $GCLOUD_API_KEYFILE | base64 -d > ./gcloud-api-key.json
|
|
|
|
|
- gcloud auth activate-service-account --key-file gcloud-api-key.json
|
|
|
|
|
- gcloud config set project $GCLOUD_PROJECT
|
2021-11-15 16:55:04 +00:00
|
|
|
- docker load --input "coturn.tar"
|
|
|
|
|
- docker load --input "coturn-dns.tar"
|
2021-11-15 15:37:15 +00:00
|
|
|
- VERSION="latest" #VERSION="prod-0.1.${BITBUCKET_BUILD_NUMBER}"
|
2021-11-15 15:42:36 +00:00
|
|
|
- docker tag "coturn" "gcr.io/${GCLOUD_PROJECT}/coturn:${VERSION}"
|
|
|
|
|
- docker tag "coturn-dns" "gcr.io/${GCLOUD_PROJECT}/coturn-dns:${VERSION}"
|
2021-07-16 15:15:34 +00:00
|
|
|
# Login to google docker hub
|
|
|
|
|
- cat ./gcloud-api-key.json | docker login -u _json_key --password-stdin https://gcr.io
|
2021-11-15 15:37:15 +00:00
|
|
|
- docker push "gcr.io/${GCLOUD_PROJECT}/coturn:${VERSION}"
|
2021-08-10 17:36:34 +00:00
|
|
|
- docker push "gcr.io/${GCLOUD_PROJECT}/coturn-dns:${VERSION}"
|
2021-07-16 15:15:34 +00:00
|
|
|
services:
|
|
|
|
|
- docker
|
2021-08-30 18:21:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# - step: Deploy haproxy ingress controller
|
|
|
|
|
# % helm install haproxy-ingress haproxy-ingress/haproxy-ingress\
|
|
|
|
|
# --create-namespace --namespace ingress-controller\
|
|
|
|
|
# --version 0.13.1\
|
|
|
|
|
# -f k8s/haproxy/haproxy-ingress-values.yaml
|
2021-10-28 18:15:01 +00:00
|
|
|
# helm upgrade -n ingress-controller -f k8s/haproxy/haproxy-ingress-values.yaml haproxy-ingress haproxy-ingress/haproxy-ingress --version 0.13.1
|
|
|
|
|
# kubectl --namespace ingress-controller patch deployment haproxy-ingress -p '{"spec":{"template":{"spec":{"containers":[{"name":"haproxy-ingress","ports":[{"name":"exporter","containerPort":9105},{"name":"ingress-stats","containerPort":10254}]}]}}}}'
|
2021-08-30 18:21:19 +00:00
|
|
|
|
|
|
|
|
# - step: Deploy cert-manager
|
|
|
|
|
# helm install \
|
|
|
|
|
# cert-manager jetstack/cert-manager \
|
|
|
|
|
# --namespace cert-manager \
|
|
|
|
|
# --create-namespace \
|
|
|
|
|
# --version v1.5.0 \
|
|
|
|
|
# --set installCRDs=true
|
|
|
|
|
# $ kubectl apply -f k8s/cert-manager/cluster-issuer-production.yaml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# - step: Deploy GCR credentials
|
2021-11-09 13:33:17 +00:00
|
|
|
# kubectl create secret docker-registry gcr-json-key \
|
|
|
|
|
# --docker-server=gcr.io \
|
|
|
|
|
# --docker-username=_json_key \
|
|
|
|
|
# --docker-password="$(cat k8s/gcp.json)" \
|
|
|
|
|
# --docker-email=any@valid.email
|
2021-08-30 18:21:19 +00:00
|
|
|
# kubectl patch serviceaccount default \
|
|
|
|
|
# -p '{"imagePullSecrets": [{"name": "gcr-json-key"}]}'
|
|
|
|
|
|
|
|
|
|
# Deploy nginx ingress controller
|
|
|
|
|
# helm install nginx-ingress stable/nginx-ingress
|
|
|
|
|
|
|
|
|
|
# Deploy monitoring clusterissuer
|
|
|
|
|
# kubectl apply -f k8s/monitoring/clusterissuer.yaml
|
|
|
|
|
|
|
|
|
|
# Deploy monitoring certificate
|
|
|
|
|
# kubectl apply -f k8s/monitoring/certificate.yaml
|
|
|
|
|
|
|
|
|
|
# Deploy monitoring helm
|
|
|
|
|
# helm install \
|
|
|
|
|
# monitoring stable/prometheus-operator \
|
|
|
|
|
# -f k8s/monitoring/helm-values.yaml \
|
|
|
|
|
# --namespace monitoring \
|
|
|
|
|
# --set grafana.adminPassword=jamkazamMonitoring
|
|
|
|
|
|
|
|
|
|
|
2021-11-15 15:37:15 +00:00
|
|
|
# - step:
|
|
|
|
|
# name: Deploy to K8s
|
|
|
|
|
# deployment: production
|
|
|
|
|
# script:
|
|
|
|
|
# - AUTOSCALER_IMAGE="gcr.io/$GCLOUD_PROJECT/autoscaler:prod-0.1.$BITBUCKET_BUILD_NUMBER"
|
|
|
|
|
# - COTURN_DNS_IMAGE="gcr.io/$GCLOUD_PROJECT/coturn-dns:prod-0.1.$BITBUCKET_BUILD_NUMBER"
|
|
|
|
|
# - sed -i "s|{{linode_autoscaler_image}}|$AUTOSCALER_IMAGE|g" k8s/linode-autoscaler/production-webrtc-be-autoscaler.yaml
|
|
|
|
|
# - sed -i "s|{{linode_autoscaler_image}}|$AUTOSCALER_IMAGE|g" k8s/linode-autoscaler/production-coturn-autoscaler.yaml
|
|
|
|
|
# - sed -i "s|{{coturn_dns_image}}|$COTURN_DNS_IMAGE|g" k8s/coturn-dns/production-coturn-dns.yaml
|
|
|
|
|
# # - pipe: atlassian/kubectl-run:1.1.2
|
|
|
|
|
# # variables:
|
|
|
|
|
# # KUBE_CONFIG: $KUBE_CONFIG_PRD
|
|
|
|
|
# # KUBECTL_COMMAND: 'apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml'
|
|
|
|
|
# - pipe: atlassian/kubectl-run:1.1.2
|
|
|
|
|
# variables:
|
|
|
|
|
# KUBE_CONFIG: $KUBE_CONFIG_PRD
|
|
|
|
|
# KUBECTL_COMMAND: 'apply'
|
|
|
|
|
# RESOURCE_PATH: 'k8s/linode-autoscaler/linode-autoscaler-namespace-secrets.yaml'
|
|
|
|
|
# - pipe: atlassian/kubectl-run:1.1.2
|
|
|
|
|
# variables:
|
|
|
|
|
# KUBE_CONFIG: $KUBE_CONFIG_PRD
|
|
|
|
|
# KUBECTL_COMMAND: 'apply'
|
|
|
|
|
# RESOURCE_PATH: 'k8s/linode-autoscaler/production-coturn-autoscaler.yaml'
|
|
|
|
|
# - pipe: atlassian/kubectl-run:1.1.2
|
|
|
|
|
# variables:
|
|
|
|
|
# KUBE_CONFIG: $KUBE_CONFIG_PRD
|
|
|
|
|
# KUBECTL_COMMAND: 'apply'
|
|
|
|
|
# RESOURCE_PATH: 'k8s/coturn-dns/production-coturn-dns.yaml'
|