Adding world workflow
Some checks failed
Deploy Promiscuity Auth API / deploy (push) Successful in 48s
Deploy Promiscuity Character API / deploy (push) Successful in 47s
Deploy Promiscuity Crafting API / deploy (push) Successful in 47s
Deploy Promiscuity Inventory API / deploy (push) Successful in 46s
Deploy Promiscuity Locations API / deploy (push) Successful in 47s
Deploy Promiscuity Mail API / deploy (push) Successful in 46s
Deploy Promiscuity World API / deploy (push) Failing after 47s
k8s smoke test / test (push) Successful in 9s
Some checks failed
Deploy Promiscuity Auth API / deploy (push) Successful in 48s
Deploy Promiscuity Character API / deploy (push) Successful in 47s
Deploy Promiscuity Crafting API / deploy (push) Successful in 47s
Deploy Promiscuity Inventory API / deploy (push) Successful in 46s
Deploy Promiscuity Locations API / deploy (push) Successful in 47s
Deploy Promiscuity Mail API / deploy (push) Successful in 46s
Deploy Promiscuity World API / deploy (push) Failing after 47s
k8s smoke test / test (push) Successful in 9s
This commit is contained in:
parent
2bed6aae4f
commit
bed8e91bc0
81
.gitea/workflows/deploy-world.yml
Normal file
81
.gitea/workflows/deploy-world.yml
Normal file
@ -0,0 +1,81 @@
|
||||
name: Deploy Promiscuity World API
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
|
||||
env:
|
||||
IMAGE_NAME: promiscuity-world:latest
|
||||
IMAGE_TAR: /tmp/promiscuity-world.tar
|
||||
NODES: "192.168.86.72 192.168.86.73 192.168.86.74"
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
cd microservices/WorldApi
|
||||
docker build -t "${IMAGE_NAME}" .
|
||||
|
||||
- name: Save Docker image to TAR
|
||||
run: |
|
||||
docker save "${IMAGE_NAME}" -o "${IMAGE_TAR}"
|
||||
|
||||
- name: Copy TAR to nodes
|
||||
run: |
|
||||
for node in ${NODES}; do
|
||||
echo "Copying image tar to $node ..."
|
||||
scp -o StrictHostKeyChecking=no "${IMAGE_TAR}" hz@"$node":/tmp/promiscuity-world.tar
|
||||
done
|
||||
|
||||
- name: Import image on nodes
|
||||
run: |
|
||||
for node in ${NODES}; do
|
||||
echo "Importing image on $node ..."
|
||||
ssh -o StrictHostKeyChecking=no hz@"$node" "sudo ctr -n k8s.io images import /tmp/promiscuity-world.tar"
|
||||
done
|
||||
|
||||
- name: Clean TAR from nodes
|
||||
run: |
|
||||
for node in ${NODES}; do
|
||||
echo "Removing image tar on $node ..."
|
||||
ssh -o StrictHostKeyChecking=no hz@"$node" "rm -f /tmp/promiscuity-world.tar"
|
||||
done
|
||||
|
||||
- name: Clean TAR on runner
|
||||
run: |
|
||||
rm -f "${IMAGE_TAR}"
|
||||
|
||||
- name: Write kubeconfig from secret
|
||||
env:
|
||||
KUBECONFIG_CONTENT: ${{ secrets.KUBECONFIG }}
|
||||
run: |
|
||||
mkdir -p /tmp/kube
|
||||
printf '%s\n' "$KUBECONFIG_CONTENT" > /tmp/kube/config
|
||||
|
||||
- name: Create namespace if missing
|
||||
env:
|
||||
KUBECONFIG: /tmp/kube/config
|
||||
run: |
|
||||
kubectl create namespace promiscuity-world --dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
- name: Apply World deployment & service
|
||||
env:
|
||||
KUBECONFIG: /tmp/kube/config
|
||||
run: |
|
||||
kubectl apply -f microservices/WorldApi/k8s/deployment.yaml -n promiscuity-world
|
||||
kubectl apply -f microservices/WorldApi/k8s/service.yaml -n promiscuity-world
|
||||
|
||||
- name: Restart World deployment
|
||||
env:
|
||||
KUBECONFIG: /tmp/kube/config
|
||||
run: |
|
||||
kubectl rollout restart deployment/promiscuity-world -n promiscuity-world
|
||||
kubectl rollout status deployment/promiscuity-world -n promiscuity-world
|
||||
19
microservices/WorldApi/Dockerfile
Normal file
19
microservices/WorldApi/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
COPY ["WorldApi.csproj", "./"]
|
||||
RUN dotnet restore "WorldApi.csproj"
|
||||
|
||||
COPY . .
|
||||
RUN dotnet publish "WorldApi.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/publish .
|
||||
|
||||
ENV ASPNETCORE_URLS=http://+:8080 \
|
||||
ASPNETCORE_ENVIRONMENT=Production
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["dotnet", "WorldApi.dll"]
|
||||
28
microservices/WorldApi/k8s/deployment.yaml
Normal file
28
microservices/WorldApi/k8s/deployment.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: promiscuity-world
|
||||
labels:
|
||||
app: promiscuity-world
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: promiscuity-world
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: promiscuity-world
|
||||
spec:
|
||||
containers:
|
||||
- name: promiscuity-world
|
||||
image: promiscuity-world:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 5004
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 5004
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
15
microservices/WorldApi/k8s/service.yaml
Normal file
15
microservices/WorldApi/k8s/service.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: promiscuity-world
|
||||
labels:
|
||||
app: promiscuity-world
|
||||
spec:
|
||||
selector:
|
||||
app: promiscuity-world
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 5004
|
||||
nodePort: 30084
|
||||
Loading…
x
Reference in New Issue
Block a user