Skip to content

Commit 6648114

Browse files
cmyuiclaude
andcommitted
Switch CI/CD from K8s helm deploy to Hetzner SSH deploy
Replace self-hosted K8s runner + helm upgrade with GitHub-hosted runner + SSH-based docker compose pull/restart on Hetzner. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent aa027f5 commit 6648114

File tree

1 file changed

+12
-51
lines changed

1 file changed

+12
-51
lines changed

.github/workflows/production-deploy.yml

Lines changed: 12 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ concurrency:
1111

1212
jobs:
1313
production-deploy:
14-
runs-on: [self-hosted, vpc]
14+
runs-on: ubuntu-latest
1515

1616
steps:
1717
- name: Check out latest commit
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919

2020
- name: Log in to Docker Hub
2121
uses: docker/login-action@v3
@@ -27,7 +27,7 @@ jobs:
2727
id: meta
2828
uses: docker/metadata-action@v5
2929
with:
30-
images: osuAkatsuki/users-service
30+
images: osuakatsuki/users-service
3131

3232
- name: Build and push Docker image
3333
uses: docker/build-push-action@v5
@@ -40,52 +40,13 @@ jobs:
4040
${{ secrets.DOCKERHUB_USERNAME }}/users-service:${{ github.sha }}
4141
labels: ${{ steps.meta.outputs.labels }}
4242

43-
- name: Get kubeconfig from github secrets
44-
run: |
45-
mkdir -p $HOME/.kube
46-
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config
47-
sudo chown $(id -u):$(id -g) $HOME/.kube/config
48-
chmod 600 $HOME/.kube/config
49-
50-
- name: Install helm
51-
uses: azure/setup-helm@v3
52-
with:
53-
version: "v3.19.2"
54-
token: ${{ secrets.GITHUB_TOKEN }}
55-
id: install
56-
57-
- name: Install helm-diff
58-
run: helm plugin install https://github.com/databus23/helm-diff
59-
60-
- name: Checkout common-helm-charts repo
61-
uses: actions/checkout@v3
43+
- name: Deploy to production
44+
uses: appleboy/ssh-action@v1
6245
with:
63-
repository: osuAkatsuki/common-helm-charts
64-
token: ${{ secrets.COMMON_HELM_CHARTS_PAT_2024 }}
65-
path: common-helm-charts
66-
67-
- name: Clear pending deployments
68-
run: |
69-
kubectl delete secret -n default -l 'status in (pending-install, pending-upgrade, pending-rollback),name=users-service-production'
70-
71-
- name: Show manifest diff since previous release
72-
run: |
73-
helm diff upgrade \
74-
--namespace default \
75-
--allow-unreleased \
76-
--color=true \
77-
--values chart/values.yaml \
78-
users-service-production \
79-
common-helm-charts/microservice-base/
80-
81-
- name: Deploy service to production cluster
82-
run: |
83-
helm upgrade \
84-
--namespace default \
85-
--install \
86-
--atomic \
87-
--wait --timeout 10m \
88-
--cleanup-on-fail \
89-
--values chart/values.yaml \
90-
users-service-production \
91-
common-helm-charts/microservice-base/
46+
host: ${{ secrets.SERVER_HOST }}
47+
username: root
48+
key: ${{ secrets.SERVER_SSH_KEY }}
49+
script: |
50+
cd /opt/akatsuki
51+
docker compose pull users-service
52+
docker compose up -d users-service

0 commit comments

Comments
 (0)