push to main with k8s
This commit is contained in:
parent
ee0cc2a768
commit
596969b910
3 changed files with 62 additions and 37 deletions
19
.github/workflows/deploy-postgres-prod.yml
vendored
19
.github/workflows/deploy-postgres-prod.yml
vendored
|
|
@ -48,6 +48,25 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install kubectl
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y curl ca-certificates
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||||
|
sudo install -m 0755 kubectl /usr/local/bin/kubectl
|
||||||
|
|
||||||
|
- name: Configure kubeconfig (in-cluster)
|
||||||
|
run: |
|
||||||
|
KUBE_HOST="https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT"
|
||||||
|
SA_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
|
||||||
|
CA_CERT=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||||
|
NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
|
||||||
|
|
||||||
|
kubectl config set-cluster microk8s --server="$KUBE_HOST" --certificate-authority="$CA_CERT"
|
||||||
|
kubectl config set-credentials runner --token="$SA_TOKEN"
|
||||||
|
kubectl config set-context runner-context --cluster=microk8s --user=runner --namespace="$NAMESPACE"
|
||||||
|
kubectl config use-context runner-context
|
||||||
|
|
||||||
- name: Install Atlas
|
- name: Install Atlas
|
||||||
run: curl -sSf https://atlasgo.sh | sh
|
run: curl -sSf https://atlasgo.sh | sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,26 @@
|
||||||
apiVersion: batch/v1
|
# apiVersion: batch/v1
|
||||||
kind: Job
|
# kind: Job
|
||||||
metadata:
|
# metadata:
|
||||||
name: atlas-migrate-dev
|
# name: atlas-migrate-dev
|
||||||
spec:
|
# spec:
|
||||||
template:
|
# template:
|
||||||
spec:
|
# spec:
|
||||||
restartPolicy: Never
|
# restartPolicy: Never
|
||||||
containers:
|
# containers:
|
||||||
- name: atlas
|
# - name: atlas
|
||||||
image: arigaio/atlas:latest
|
# image: arigaio/atlas:latest
|
||||||
command: ["/atlas"]
|
# command: ["/atlas"]
|
||||||
args: ["migrate", "apply", "--env", "stripe_invoice_dev"]
|
# args: ["migrate", "apply", "--env", "stripe_invoice_dev"]
|
||||||
envFrom:
|
# envFrom:
|
||||||
- secretRef:
|
# - secretRef:
|
||||||
name: postgres-secret
|
# name: postgres-secret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# You can run this:
|
# # You can run this:
|
||||||
# kubectl apply -f k8s/migrations/atlas-job.yaml
|
# # kubectl apply -f k8s/migrations/atlas-job.yaml
|
||||||
# Or later from CI.
|
# # Or later from CI.
|
||||||
|
|
||||||
|
|
||||||
|
#doesn't work - 28/12/2025
|
||||||
|
|
@ -1,22 +1,25 @@
|
||||||
apiVersion: batch/v1
|
# apiVersion: batch/v1
|
||||||
kind: Job
|
# kind: Job
|
||||||
metadata:
|
# metadata:
|
||||||
name: atlas-migrate-dev
|
# name: atlas-migrate-dev
|
||||||
spec:
|
# spec:
|
||||||
template:
|
# template:
|
||||||
spec:
|
# spec:
|
||||||
restartPolicy: Never
|
# restartPolicy: Never
|
||||||
containers:
|
# containers:
|
||||||
- name: atlas
|
# - name: atlas
|
||||||
image: arigaio/atlas:latest
|
# image: arigaio/atlas:latest
|
||||||
command: ["migrate", "apply", "--env", "stripe_invoice_prod"]
|
# command: ["migrate", "apply", "--env", "stripe_invoice_prod"]
|
||||||
envFrom:
|
# envFrom:
|
||||||
- secretRef:
|
# - secretRef:
|
||||||
name: postgres-secret
|
# name: postgres-secret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# You can run this:
|
# # You can run this:
|
||||||
# kubectl apply -f k8s/migrations/atlas-job.yaml
|
# # kubectl apply -f k8s/migrations/atlas-job.yaml
|
||||||
# Or later from CI.
|
# # Or later from CI.
|
||||||
|
|
||||||
|
|
||||||
|
#doesn't work - 28/12/2025
|
||||||
Loading…
Add table
Reference in a new issue