pre-alpha test
Some checks failed
Build and Deploy to k3s / build-and-deploy (push) Failing after 39s
Some checks failed
Build and Deploy to k3s / build-and-deploy (push) Failing after 39s
This commit is contained in:
parent
e616a400ed
commit
a55a295164
@ -63,8 +63,8 @@ jobs:
|
||||
|
||||
- name: Deploy to k3s
|
||||
run: |
|
||||
kubectl apply -k deploy/k3s/ --kubeconfig ~/.kube/config
|
||||
kubectl apply -k deploy/k3s/alpha --kubeconfig ~/.kube/config
|
||||
kubectl set image deployment/hosting-frontend \
|
||||
hosting-frontend=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend:${{ github.sha }} \
|
||||
-n hosting --kubeconfig ~/.kube/config
|
||||
kubectl rollout status deployment/hosting-frontend -n hosting --kubeconfig ~/.kube/config
|
||||
-n hosting-alpha --kubeconfig ~/.kube/config
|
||||
kubectl rollout status deployment/hosting-frontend -n hosting-alpha --kubeconfig ~/.kube/config
|
||||
|
||||
67
.gitea/workflows/deploy-prod.yml
Normal file
67
.gitea/workflows/deploy-prod.yml
Normal file
@ -0,0 +1,67 @@
|
||||
name: Build and Deploy to k3s
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'PROD*'
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
env:
|
||||
KUBECONFIG: ~/.kube/config
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build Angular app
|
||||
run: npm run build --prod
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build -t ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend:${{ github.sha }} .
|
||||
docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend:${{ github.sha }} ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend:latest
|
||||
|
||||
- name: Login to Container Registry
|
||||
run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ secrets.REGISTRY_URL }} -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||
|
||||
- name: Push Docker image
|
||||
run: |
|
||||
docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend:${{ github.sha }}
|
||||
docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend:latest
|
||||
|
||||
- name: Setup kubectl
|
||||
uses: azure/setup-kubectl@v3
|
||||
with:
|
||||
version: 'latest'
|
||||
|
||||
- name: Configure kubectl
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
|
||||
|
||||
- name: Validate kubeconfig
|
||||
run: |
|
||||
if ! kubectl version --client && kubectl cluster-info --kubeconfig ~/.kube/config; then
|
||||
echo "❌ Failed to connect to cluster"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
- name: Deploy to k3s
|
||||
run: |
|
||||
kubectl apply -k deploy/k3s/prod --kubeconfig ~/.kube/config
|
||||
kubectl set image deployment/hosting-frontend \
|
||||
hosting-frontend=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/hosting-frontend:${{ github.sha }} \
|
||||
-n hosting --kubeconfig ~/.kube/config
|
||||
kubectl rollout status deployment/hosting-frontend -n hosting --kubeconfig ~/.kube/config
|
||||
20
deploy/k3s/alpha/frontend/deployment.yml
Normal file
20
deploy/k3s/alpha/frontend/deployment.yml
Normal file
@ -0,0 +1,20 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hosting-frontend
|
||||
namespace: hosting-alpha
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: hosting-frontend
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: hosting-frontend
|
||||
spec:
|
||||
containers:
|
||||
- name: hosting-frontend
|
||||
image: gitea.vidoks.fr/sortifal/hosting-frontend:latest
|
||||
ports:
|
||||
- containerPort: 80
|
||||
21
deploy/k3s/alpha/frontend/ingress.yml
Normal file
21
deploy/k3s/alpha/frontend/ingress.yml
Normal file
@ -0,0 +1,21 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: hosting-ingress
|
||||
namespace: hosting-alpha
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: web
|
||||
traefik.ingress.kubernetes.io/router.middlewares: alpha-allow-local@kubernetescrd
|
||||
spec:
|
||||
rules:
|
||||
- host: alpha.portfolio-host.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: hosting-frontend-service
|
||||
port:
|
||||
number: 80
|
||||
6
deploy/k3s/alpha/frontend/kustomization.yml
Normal file
6
deploy/k3s/alpha/frontend/kustomization.yml
Normal file
@ -0,0 +1,6 @@
|
||||
namespace: hosting-alpha
|
||||
resources:
|
||||
- deployment.yml
|
||||
- service.yml
|
||||
- ingress.yml
|
||||
- middleware.yml
|
||||
10
deploy/k3s/alpha/frontend/middleware.yml
Normal file
10
deploy/k3s/alpha/frontend/middleware.yml
Normal file
@ -0,0 +1,10 @@
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: allow-local
|
||||
namespace: hosting-alpha
|
||||
spec:
|
||||
ipWhiteList:
|
||||
sourceRange:
|
||||
- 127.0.0.1/32
|
||||
- 192.168.1.0/24
|
||||
12
deploy/k3s/alpha/frontend/service.yml
Normal file
12
deploy/k3s/alpha/frontend/service.yml
Normal file
@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hosting-frontend-service
|
||||
namespace: hosting-alpha
|
||||
spec:
|
||||
selector:
|
||||
app: hosting-frontend
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
type: ClusterIP
|
||||
8
deploy/k3s/alpha/kustomization.yml
Normal file
8
deploy/k3s/alpha/kustomization.yml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
|
||||
kind: Kustomization
|
||||
namespace: hosting-alpha
|
||||
|
||||
resources:
|
||||
- namespace.yml
|
||||
- frontend
|
||||
4
deploy/k3s/alpha/namespace.yml
Normal file
4
deploy/k3s/alpha/namespace.yml
Normal file
@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hosting-alpha
|
||||
Loading…
x
Reference in New Issue
Block a user