CEC-1316 azure migration (#140)

* test portal azure

* :doh:

* runner

* WIP

* values

* letsencrypt + docker cache

* stg/prd

* portal things

* cleanup

* split build/deploy + temp stage deploy

* :doh:

* try this

* and prod

* this works for now, can improve later

* no need to specify azure anymore

Co-authored-by: Drew Taylor <69828061+drew-fisker@users.noreply.github.com>
This commit is contained in:
Rafi Greenberg
2022-04-18 17:54:14 -04:00
committed by GitHub
parent 491de89269
commit b4d06cf52f
9 changed files with 67 additions and 48 deletions

View File

@@ -1,4 +1,4 @@
REACT_APP_AUTH_SERVICE_URL=https://gw-dev.fiskerdps.com/compute_auth REACT_APP_AUTH_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/compute_auth
REACT_APP_UPLOAD_SERVICE_URL=https://gw-dev.fiskerdps.com/ota_update REACT_APP_UPLOAD_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/ota_update
REACT_APP_AUTH_CALLBACK_URL=https://dev-ota-admin.fiskerdps.com REACT_APP_AUTH_CALLBACK_URL=https://dev-ota-admin.cloud.fiskerinc.com
REACT_APP_SUPERSET_URL=http://superset-dev.fisker.internal REACT_APP_SUPERSET_URL=http://superset-dev.fisker.internal

View File

@@ -1,4 +1,4 @@
REACT_APP_AUTH_SERVICE_URL=https://gw.fiskerdps.com/compute_auth REACT_APP_AUTH_SERVICE_URL=https://gw.cloud.fiskerinc.com/compute_auth
REACT_APP_UPLOAD_SERVICE_URL=https://gw.fiskerdps.com/ota_update REACT_APP_UPLOAD_SERVICE_URL=https://gw.cloud.fiskerinc.com/ota_update
REACT_APP_AUTH_CALLBACK_URL=https://ota-admin.fiskerdps.com REACT_APP_AUTH_CALLBACK_URL=https://ota-admin.cloud.fiskerinc.com
REACT_APP_SUPERSET_URL=http://superset.fisker.internal REACT_APP_SUPERSET_URL=http://superset.fisker.internal

View File

@@ -1,4 +1,4 @@
REACT_APP_AUTH_SERVICE_URL=https://gw-stg.fiskerdps.com/compute_auth REACT_APP_AUTH_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/compute_auth
REACT_APP_UPLOAD_SERVICE_URL=https://gw-stg.fiskerdps.com/ota_update REACT_APP_UPLOAD_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/ota_update
REACT_APP_AUTH_CALLBACK_URL=https://stg-ota-admin.fiskerdps.com REACT_APP_AUTH_CALLBACK_URL=https://stg-ota-admin.cloud.fiskerinc.com
REACT_APP_SUPERSET_URL=http://superset-stg.fisker.internal REACT_APP_SUPERSET_URL=http://superset-stg.fisker.internal

View File

@@ -5,34 +5,42 @@ on:
- main - main
- "release/**" - "release/**"
- "hotfix/**" - "hotfix/**"
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_CHANNEL: "#cloud-builds"
SLACK_FOOTER: ""
SLACK_USERNAME: GitHub Actions
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
TAG: ${{ github.sha }}
PROJECT: ota-admin-portal
REGISTRY: fiskercloud.azurecr.io
jobs: jobs:
deploy: build:
name: Deploy runs-on: ubuntu-latest
runs-on: self-hosted outputs:
env: build-env: ${{ steps.set-env.outputs.build-env }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_CHANNEL: "#cloud-builds"
SLACK_FOOTER: ""
SLACK_USERNAME: GitHub Actions
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
TAG: ${{ github.sha }}
PROJECT: ota-admin-portal
steps: steps:
- name: Slack Notification - name: Slack Notification
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1 - name: Azure Login
uses: azure/login@v1
with: with:
aws-region: us-west-2 creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Create ECR Repo
run: aws ecr create-repository --region us-west-2 --repository-name ${PROJECT} || true - name: Docker login
- name: Login to Amazon ECR uses: azure/docker-login@v1
id: login-ecr with:
uses: aws-actions/amazon-ecr-login@v1 login-server: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Set Env - name: Set Env
id: set-env
run: | run: |
case ${GITHUB_REF} in case ${GITHUB_REF} in
refs/heads/develop) refs/heads/develop)
@@ -47,26 +55,33 @@ jobs:
ENVIRONMENT=dev;; ENVIRONMENT=dev;;
esac esac
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_ENV echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_ENV
echo "::set-output name=build-env::${ENVIRONMENT}"
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Build and push - name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
build-args: ENVIRONMENT=${{ env.ENVIRONMENT }} build-args: ENVIRONMENT=${{ env.ENVIRONMENT }}
push: true push: true
tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT }}:${{ env.TAG}}-${{ env.ENVIRONMENT }} tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-${{ env.ENVIRONMENT }}
cache-from: type=registry,ref=${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT }}:${{ env.TAG}}-${{ env.ENVIRONMENT }} cache-from: type=gha
cache-to: type=inline cache-to: type=gha,mode=max
- name: Notify deploy
uses: rtCamp/action-slack-notify@v2 deploy:
needs: build
runs-on: [self-hosted, azure]
env:
ENVIRONMENT: ${{ needs.build.outputs.build-env }}
steps:
- uses: rtCamp/action-slack-notify@v2
env: env:
MSG_MINIMAL: true MSG_MINIMAL: true
SLACK_MESSAGE: "Deploying to ${{ env.ENVIRONMENT }}... :partydeploy:" SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to ${{ env.ENVIRONMENT }}... :partydeploy:"
- name: Deploy - name: Deploy
id: deploy
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |- run: |-
helm upgrade \ helm upgrade \
--kube-context $ENVIRONMENT \ --kube-context $ENVIRONMENT \
@@ -80,7 +95,7 @@ jobs:
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2
env: env:
MSG_MINIMAL: true MSG_MINIMAL: true
SLACK_MESSAGE: "Successfully deployed to ${{ env.ENVIRONMENT }}! :gopher_party:" SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to ${{ env.ENVIRONMENT }}! :gopher_party:"
- name: Notify if failure - name: Notify if failure
if: ${{ failure() }} if: ${{ failure() }}

View File

@@ -1,21 +1,25 @@
apiVersion: networking.k8s.io/v1beta1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:
kubernetes.io/ingress.class: nginx cert-manager.io/cluster-issuer: letsencrypt-prod
labels: labels:
app: {{ .Chart.Name }} app: {{ .Chart.Name }}
name: {{ .Chart.Name }} name: {{ .Chart.Name }}
spec: spec:
ingressClassName: nginx
rules: rules:
- host: {{ .Values.ingress.hostname }} - host: {{ .Values.ingress.hostname }}
http: http:
paths: paths:
- backend: - backend:
serviceName: {{ .Chart.Name }} service:
servicePort: 80 name: {{ .Chart.Name }}
port:
number: 80
path: / path: /
pathType: ImplementationSpecific
tls: tls:
- hosts: - hosts:
- {{ .Values.ingress.hostname }} - {{ .Values.ingress.hostname }}
secretName: fiskerdps-cert secretName: {{ .Chart.Name }}-tls

View File

@@ -1,5 +1,5 @@
ingress: ingress:
hostname: dev-ota-admin.fiskerdps.com hostname: dev-ota-admin.cloud.fiskerinc.com
resources: resources:
requests: requests:

View File

@@ -1,5 +1,5 @@
ingress: ingress:
hostname: ota-admin.fiskerdps.com hostname: ota-admin.cloud.fiskerinc.com
resources: resources:
requests: requests:
@@ -9,4 +9,4 @@ resources:
cpu: 250m cpu: 250m
memory: 256Mi memory: 256Mi
replicas: 1 replicas: 3

View File

@@ -1,5 +1,5 @@
ingress: ingress:
hostname: stg-ota-admin.fiskerdps.com hostname: stg-ota-admin.cloud.fiskerinc.com
resources: resources:
requests: requests: