Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit ee7f5da

Browse files
committed
feat: deploy to gcp
1 parent 876c131 commit ee7f5da

10 files changed

Lines changed: 87 additions & 96 deletions

File tree

Lines changed: 40 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,48 @@
1-
name: Docker Build
2-
1+
name: Build and Deploy
32
on:
43
push:
54
branches:
6-
- "dev"
7-
- "main"
8-
9-
env:
10-
IMAGE_NAME: rss3/xchar
11-
REGION_ID: us-east-1
12-
DEV_ACK_CLUSTER_ID: cd1d0ffc40b5242b39ddda1864e71e30d
13-
PROD_ACK_CLUSTER_ID: cfc647c22fd6848b5a602ad4d7470632b
14-
5+
- dev
6+
- main
7+
tags:
8+
- v*
159
jobs:
1610
build:
17-
runs-on: ubuntu-latest
18-
outputs:
19-
version: ${{ steps.meta.outputs.version }}
20-
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v3
23-
- name: docker meta
24-
id: meta
25-
uses: docker/metadata-action@v4
26-
with:
27-
images: ${{ env.IMAGE_NAME }}
28-
tags: |
29-
type=sha
30-
- name: Set up Docker Buildx
31-
uses: docker/setup-buildx-action@v2
32-
- name: Login to DockerHub
33-
if: github.event_name != 'pull_request'
34-
uses: docker/login-action@v2
35-
with:
36-
username: ${{ secrets.DOCKERHUB_USERNAME }}
37-
password: ${{ secrets.DOCKERHUB_TOKEN }}
38-
- name: Build and push
39-
uses: docker/build-push-action@v3
40-
with:
41-
context: .
42-
file: Dockerfile
43-
push: ${{ github.event_name != 'pull_request' }}
44-
tags: ${{ steps.meta.outputs.tags }}
45-
labels: ${{ steps.meta.outputs.labels }}
46-
11+
uses: NaturalSelectionLabs/Daedalus/.github/workflows/docker-tpl.yaml@main
12+
with:
13+
images: flosspicks/xchar
14+
context: .
15+
dockerfile: ./Dockerfile
16+
secrets:
17+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
18+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
4719
deploy-dev:
48-
runs-on: ubuntu-latest
49-
needs: [build]
50-
steps:
51-
- name: Checkout
52-
uses: actions/checkout@v3
53-
- name: Set K8s context
54-
uses: aliyun/ack-set-context@v1
55-
with:
56-
access-key-id: "${{ secrets.ACCESS_KEY_ID }}"
57-
access-key-secret: "${{ secrets.ACCESS_KEY_SECRET }}"
58-
cluster-id: "${{ env.DEV_ACK_CLUSTER_ID }}"
59-
- name: Install Tools
60-
run: |
61-
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
62-
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
63-
- uses: sljeff/secrets2env@main
64-
with:
65-
secrets-json: ${{ toJson(secrets) }}
66-
- env:
67-
IMAGE_TAG_RELEASE: ${{ env.IMAGE_NAME }}:${{ needs.build.outputs.version }}
68-
run: |
69-
sh apply.sh deploy/dev/*
70-
20+
if: github.ref == 'refs/heads/dev'
21+
uses: NaturalSelectionLabs/Daedalus/.github/workflows/deploy-v3-tpl.yaml@main
22+
needs:
23+
- build
24+
with:
25+
images: flosspicks/xchar
26+
tag: sha-${{ github.sha }}
27+
cluster: dev
28+
namespace: crossbell
29+
releaseName: xchar
30+
revision: develop
31+
dir: deploy/dev
32+
secrets:
33+
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
7134
deploy-prod:
7235
if: github.ref == 'refs/heads/main'
73-
runs-on: ubuntu-latest
74-
needs: [build, deploy-dev]
75-
steps:
76-
- name: Checkout
77-
uses: actions/checkout@v3
78-
- name: Set K8s context
79-
uses: aliyun/ack-set-context@v1
80-
with:
81-
access-key-id: "${{ secrets.ACCESS_KEY_ID }}"
82-
access-key-secret: "${{ secrets.ACCESS_KEY_SECRET }}"
83-
cluster-id: "${{ env.PROD_ACK_CLUSTER_ID }}"
84-
- name: Install Tools
85-
run: |
86-
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
87-
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
88-
- uses: sljeff/secrets2env@main
89-
with:
90-
secrets-json: ${{ toJson(secrets) }}
91-
- env:
92-
IMAGE_TAG_RELEASE: ${{ env.IMAGE_NAME }}:${{ needs.build.outputs.version }}
93-
run: |
94-
sh apply.sh deploy/prod/*
36+
uses: NaturalSelectionLabs/Daedalus/.github/workflows/deploy-v3-tpl.yaml@main
37+
needs:
38+
- build
39+
with:
40+
images: flosspicks/xchar
41+
tag: sha-${{ github.sha }}
42+
cluster: prod
43+
namespace: crossbell
44+
releaseName: xchar
45+
revision: main
46+
dir: deploy/prod
47+
secrets:
48+
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}

deploy/dev/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323
tier: api
2424
spec:
2525
containers:
26-
- image: $IMAGE_TAG_RELEASE
26+
- image: flosspicks/xchar
2727
imagePullPolicy: Always
2828
name: xchar
2929
envFrom:

deploy/dev/kustomization.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- deploy.yaml
6+
- svc.yaml
7+
- route.yaml
8+
- secret.yaml

deploy/dev/route.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ kind: IngressRoute
33
metadata:
44
name: xchar
55
namespace: crossbell
6+
annotations:
7+
avp.kubernetes.io/path: "kv/data/crossbell/xchar"
68
spec:
79
entryPoints:
8-
- web
10+
- websecure
911
routes:
1012
- kind: Rule
11-
match: "Host(`$XCHAR_DOMAIN_DEV`)"
13+
match: Host(`<DOMAIN>`)
1214
services:
1315
- name: xchar
1416
port: 3000
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
apiVersion: v1
2-
stringData:
3-
REDIS_URL: $REDIS_URL_DEV
42
kind: Secret
53
metadata:
64
name: xchar
75
namespace: crossbell
6+
annotations:
7+
avp.kubernetes.io/path: "kv/data/crossbell/xchar"
88
type: Opaque
9+
stringData:
10+
REDIS_URL: "<REDIS_URL>"

deploy/prod/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323
tier: api
2424
spec:
2525
containers:
26-
- image: $IMAGE_TAG_RELEASE
26+
- image: flosspicks/xchar
2727
imagePullPolicy: Always
2828
name: xchar
2929
envFrom:

deploy/prod/kustomization.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- deploy.yaml
6+
- svc.yaml
7+
- route.yaml
8+
- secret.yaml
9+
- pvc.yaml

deploy/prod/pvc.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: xchar-image
5+
namespace: crossbell
6+
spec:
7+
accessModes:
8+
- ReadWriteMany
9+
resources:
10+
requests:
11+
storage: 80Gi
12+
storageClassName: standard-rwm

deploy/prod/route.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ kind: IngressRoute
33
metadata:
44
name: xchar
55
namespace: crossbell
6+
annotations:
7+
avp.kubernetes.io/path: "kv/data/crossbell/xchar"
68
spec:
79
entryPoints:
8-
- web
10+
- websecure
911
routes:
1012
- kind: Rule
11-
match: "Host(`$XCHAR_DOMAIN`)"
13+
match: Host(`<DOMAIN>`)
1214
services:
1315
- name: xchar
1416
port: 3000
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
apiVersion: v1
2-
stringData:
3-
REDIS_URL: $REDIS_URL
42
kind: Secret
53
metadata:
64
name: xchar
75
namespace: crossbell
6+
annotations:
7+
avp.kubernetes.io/path: "kv/data/crossbell/xchar"
88
type: Opaque
9+
stringData:
10+
REDIS_URL: "<REDIS_URL>"

0 commit comments

Comments
 (0)