Skip to content

Commit

Permalink
Changing deploy-home dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Nov 16, 2024
1 parent 86f33a0 commit 2302d61
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 29 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/deploy-home.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ jobs:
- name: Deploy to Kubernetes
run: |
# Copy deployment.yml to the remote system
scp -o ProxyCommand='cloudflared access ssh --hostname %h' -o StrictHostKeyChecking=no ./k8s/deployment.yml ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/tmp/deployment.yml
# Copy crank.yml to the remote system
scp -o ProxyCommand='cloudflared access ssh --hostname %h' -o StrictHostKeyChecking=no ./k8s/crank.yml ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/tmp/crank.yml
scp -o ProxyCommand='cloudflared access ssh --hostname %h' -o StrictHostKeyChecking=no ./k8s/crank-configmap.yml ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/tmp/crank-configmap.yml
# Apply the copied deployment.yml
# Apply the copied crank.yml
ssh -o ProxyCommand='cloudflared access ssh --hostname %h' -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} <<EOF
export GITHUB_SHA=${{ env.GITHUB_SHA }}
envsubst < /tmp/deployment.yml | k3s kubectl apply -f -
envsubst < /tmp/crank.yml | k3s kubectl apply -f -
envsubst < /tmp/crank-configmap.yml | k3s kubectl apply -f -
EOF
2 changes: 1 addition & 1 deletion .github/workflows/deploy-redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
# Copy redis.yml to the remote system
scp -o ProxyCommand='cloudflared access ssh --hostname %h' -o StrictHostKeyChecking=no ./k8s/redis.yml ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/tmp/redis.yml
# Apply the copied deployment.yml
# Apply the copied redis.yml
ssh -o ProxyCommand='cloudflared access ssh --hostname %h' -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} <<EOF
envsubst < /tmp/redis.yml | k3s kubectl apply -f -
EOF
12 changes: 7 additions & 5 deletions .github/workflows/update-home-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths-ignore:
- '**'
- '!.github/workflows/update-home-deployment.yml'
- '!k8s/deployment.yml'
- '!k8s/crank.yml'

concurrency:
group: deployment
Expand Down Expand Up @@ -50,11 +50,13 @@ jobs:
- name: Deploy to Kubernetes
run: |
# Copy deployment.yml to the remote system
scp -o ProxyCommand='cloudflared access ssh --hostname %h' -o StrictHostKeyChecking=no ./k8s/deployment.yml ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/tmp/deployment.yml
# Copy crank.yml to the remote system
scp -o ProxyCommand='cloudflared access ssh --hostname %h' -o StrictHostKeyChecking=no ./k8s/crank.yml ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/tmp/crank.yml
scp -o ProxyCommand='cloudflared access ssh --hostname %h' -o StrictHostKeyChecking=no ./k8s/crank-configmap.yml ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/tmp/crank-configmap.yml
# Apply the copied deployment.yml
# Apply the copied crank.yml
ssh -o ProxyCommand='cloudflared access ssh --hostname %h' -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} <<EOF
export GITHUB_SHA=${{ env.GITHUB_SHA }}
envsubst < /tmp/deployment.yml | k3s kubectl apply -f -
envsubst < /tmp/crank.yml | k3s kubectl apply -f -
envsubst < /tmp/crank-configmap.yml | k3s kubectl apply -f -
EOF
18 changes: 18 additions & 0 deletions k8s/crank-configmap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
---
apiVersion: v1
kind: ConfigMap
metadata:
name: crank-config
namespace: crank
data:
DB_HOST: "fats"
DB_NAME: "crank"
DB_USER: "crank"
DB_PORT: "3306"
ENV: "prod"
REDIS_MASTER_URL: "redis://redis-master:6379/0"
REDIS_SLAVE_URLS: ""
CACHE_TTL: "60"
PYTHONUNBUFFERED: "1"
21 changes: 2 additions & 19 deletions k8s/deployment.yml → k8s/crank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,9 @@ spec:
- name: http
containerPort: 8080
protocol: TCP
env:
- name: DB_HOST
value: "fats"
- name: DB_NAME
value: "crank"
- name: DB_USER
value: "crank"
- name: DB_PORT
value: "3306"
- name: ENV
value: "prod"
- name: REDIS_MASTER_URL
value: "redis://redis-master:6379/0"
- name: REDIS_SLAVE_URLS
value: ""
- name: CACHE_TTL
value: "60"
- name: PYTHONUNBUFFERED
value: "1"
envFrom:
- configMapRef:
name: crank-config
- secretRef:
name: db-connect-credentials
imagePullSecrets:
Expand Down

0 comments on commit 2302d61

Please sign in to comment.