Skip to content

Commit

Permalink
feat(deploy): gcp
Browse files Browse the repository at this point in the history
  • Loading branch information
incubator4 committed Dec 31, 2023
1 parent 15f95ed commit ec3c40d
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 72 deletions.
71 changes: 28 additions & 43 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

env:
IMAGE_NAME: flosspicks/crossbell-io
REGION_ID: us-east-1
DEV_ACK_CLUSTER_ID: cd1d0ffc40b5242b39ddda1864e71e30d
PROD_ACK_CLUSTER_ID: cfc647c22fd6848b5a602ad4d7470632b

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -30,9 +24,10 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
images: flosspicks/crossbell-io
tags: |
type=sha
type=sha,format=long
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
Expand Down Expand Up @@ -60,41 +55,31 @@ jobs:

deploy-dev:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v3
- 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 }}"
- 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
- env:
IMAGE_TAG_RELEASE: ${{ env.IMAGE_NAME }}:${{ needs.build.outputs.version }}
run: |
sh apply.sh deploy/dev/*
uses: NaturalSelectionLabs/Daedalus/.github/workflows/deploy-v3-tpl.yaml@main
needs:
- build
with:
images: flosspicks/crossbell-io
tag: sha-${{ github.sha }}
cluster: dev
namespace: crossbell
releaseName: xfeed
revision: main
dir: deploy/dev
secrets:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
deploy-prod:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3
- 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 }}"
- 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
- env:
IMAGE_TAG_RELEASE: ${{ env.IMAGE_NAME }}:${{ needs.build.outputs.version }}
run: |
sh apply.sh deploy/prod/*
uses: NaturalSelectionLabs/Daedalus/.github/workflows/deploy-v3-tpl.yaml@main
needs:
- build
with:
images: flosspicks/crossbell-io
tag: sha-${{ github.sha }}
cluster: prod
namespace: crossbell
releaseName: xfeed
revision: main
dir: deploy/prod
secrets:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
10 changes: 5 additions & 5 deletions deploy/dev/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
tier: api
spec:
containers:
- image: $IMAGE_TAG_RELEASE
- image: flosspicks/crossbell-io
imagePullPolicy: Always
name: crossbell-io
command:
Expand All @@ -35,11 +35,11 @@ spec:
protocol: TCP
resources:
requests:
memory: '100Mi'
cpu: '100m'
memory: "100Mi"
cpu: "100m"
limits:
memory: '800Mi'
cpu: '200m'
memory: "800Mi"
cpu: "200m"
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
livenessProbe:
Expand Down
7 changes: 7 additions & 0 deletions deploy/dev/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deploy.yaml
- route.yaml
- svc.yaml
13 changes: 7 additions & 6 deletions deploy/dev/route.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ metadata:
namespace: crossbell
spec:
entryPoints:
- web
- web
- websecure
routes:
- kind: Rule
match: Host(`crossbell.kindjeff.com`)
services:
- name: crossbell-io
port: 3000
- kind: Rule
match: Host(`crossbell.kindjeff.com`)
services:
- name: crossbell-io
port: 3000
17 changes: 5 additions & 12 deletions deploy/prod/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,8 @@ spec:
tier: api
spec:
enableServiceLinks: false
nodeSelector:
rss3.io/usage: csb-others
tolerations:
- key: "rss3.io/usage"
operator: "Equal"
value: "csb-others"
effect: "NoSchedule"
containers:
- image: $IMAGE_TAG_RELEASE
- image: flosspicks/crossbell-io
imagePullPolicy: Always
name: crossbell-io
command:
Expand All @@ -43,11 +36,11 @@ spec:
protocol: TCP
resources:
requests:
memory: '800Mi'
cpu: '50m'
memory: "800Mi"
cpu: "50m"
limits:
memory: '2500Mi'
cpu: '500m'
memory: "2500Mi"
cpu: "500m"
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
livenessProbe:
Expand Down
7 changes: 7 additions & 0 deletions deploy/prod/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deploy.yaml
- route.yaml
- svc.yaml
13 changes: 7 additions & 6 deletions deploy/prod/route.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ metadata:
namespace: crossbell
spec:
entryPoints:
- web
- web
- websecure
routes:
- kind: Rule
match: Host(`crossbell.io`) || Host(`www.crossbell.io`)
services:
- name: crossbell-io
port: 3000
- kind: Rule
match: Host(`crossbell.io`) || Host(`www.crossbell.io`)
services:
- name: crossbell-io
port: 3000

0 comments on commit ec3c40d

Please sign in to comment.