Skip to content

Commit

Permalink
Small mod to force image rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
norcalipa authored and = committed Nov 16, 2024
2 parents c650fb9 + 2302d61 commit eb9a4bc
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .env-prod
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ DB_USER=crank
DB_PORT=3306
PYTHON_UNBUFFERED=1
REDIS_MASTER_URL=redis://redis-master:6379/0
REDIS_SLAVE_URL=redis://redis-slave:6379/0
REDIS_SLAVE_URL=
CACHE_TTL=60
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 eb9a4bc

Please sign in to comment.