Skip to content

Commit

Permalink
chore: to gcp
Browse files Browse the repository at this point in the history
  • Loading branch information
incubator4 committed Apr 9, 2024
1 parent 5e71ffb commit 44c7b35
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 85 deletions.
103 changes: 22 additions & 81 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,90 +8,31 @@ on:
# - "v*.*.*"

env:
IMAGE_NAME: flosspicks/mira
REGION_ID: us-east-1
DEV_ACK_CLUSTER_ID: cd1d0ffc40b5242b39ddda1864e71e30d
PROD_ACK_CLUSTER_ID: cfc647c22fd6848b5a602ad4d7470632b
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: apps/mira/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# deploy-dev:
# runs-on: ubuntu-latest
# needs: [build]
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Set K8s context
# uses: aliyun/ack-set-context@v1
# with:
# access-key-id: "${{ secrets.ACCESS_KEY_ID }}"
# access-key-secret: "${{ secrets.ACCESS_KEY_SECRET }}"
# cluster-id: "${{ env.DEV_ACK_CLUSTER_ID }}"
# - name: Install Tools
# run: |
# wget https://github.com/mikefarah/yq/releases/download/v4.25.1/yq_linux_amd64.tar.gz -O - | tar xz && mv yq_linux_amd64 /usr/local/bin/yq
# curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.22.10/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/kubectl
# - uses: sljeff/secrets2env@main
# with:
# secrets-json: ${{ toJson(secrets) }}
# - env:
# IMAGE_TAG_RELEASE: ${{ env.IMAGE_NAME }}:${{ needs.build.outputs.version }}
# run: |
# sh apply.sh deploy/dev/*

uses: NaturalSelectionLabs/Daedalus/.github/workflows/docker-tpl.yaml@main
with:
images: flosspicks/mira
context: .
dockerfile: ./apps/mira/Dockerfile
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
deploy-prod:
# if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set K8s context
uses: aliyun/ack-set-context@v1
with:
access-key-id: "${{ secrets.ACCESS_KEY_ID }}"
access-key-secret: "${{ secrets.ACCESS_KEY_SECRET }}"
cluster-id: "${{ env.PROD_ACK_CLUSTER_ID }}"
- name: Install Tools
run: |
wget https://github.com/mikefarah/yq/releases/download/v4.25.1/yq_linux_amd64.tar.gz -O - | tar xz && mv yq_linux_amd64 /usr/local/bin/yq
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.22.10/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/kubectl
- uses: sljeff/secrets2env@main
with:
secrets-json: ${{ toJson(secrets) }}
- env:
IMAGE_TAG_RELEASE: ${{ env.IMAGE_NAME }}:${{ needs.build.outputs.version }}
run: |
sh apply.sh deploy/prod/*
if: github.ref == 'refs/heads/main'
uses: NaturalSelectionLabs/Daedalus/.github/workflows/deploy-v3-tpl.yaml@main
needs:
- build
with:
images: flosspicks/mira
tag: sha-${{ github.sha }}
cluster: prod
namespace: crossbell
releaseName: mira
revision: main
dir: deploy/prod
secrets:
ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }}
4 changes: 2 additions & 2 deletions deploy/prod/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ spec:
tier: api
spec:
containers:
- image: $IMAGE_TAG_RELEASE
- image: flosspicks/mira
imagePullPolicy: Always
name: mira
envFrom:
- secretRef:
name: mira-secret
name: mira
ports:
- containerPort: 3000
protocol: TCP
Expand Down
8 changes: 8 additions & 0 deletions deploy/prod/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deploy.yaml
- svc.yaml
- route.yaml
- secret.yaml
6 changes: 4 additions & 2 deletions deploy/prod/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
apiVersion: v1
stringData:
MIRA_INDEXER_DATABASE_URL: ${MIRA_INDEXER_DATABASE_URL}
MIRA_INDEXER_DATABASE_URL: "<MIRA_INDEXER_DATABASE_URL>"
kind: Secret
metadata:
name: mira-secret
name: mira
namespace: crossbell
annotations:
avp.kubernetes.io/path: "kv/data/crossbell/mira"
type: Opaque

0 comments on commit 44c7b35

Please sign in to comment.