add CI/CD workflows, production docker-compose, and update dev compose with Gitea registry and monitoring improvements
This commit is contained in:
1 parent
df7a1b33cc
commit
6995763ccb
7 files changed
+580
-5
No files matched your search
@@ -0,0 +1,49 @@
|
||||
name: CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: [self-hosted, linux, docker]
|
||||
environment: production
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.allucanget.biz
|
||||
username: ${{ secrets.GITEA_USERNAME }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Pull latest images
|
||||
run: |
|
||||
docker pull git.allucanget.biz/zwitschi/linearvoid/playout:latest || true
|
||||
docker pull git.allucanget.biz/zwitschi/linearvoid/chat:latest || true
|
||||
docker pull git.allucanget.biz/zwitschi/linearvoid/frontend:latest || true
|
||||
docker pull git.allucanget.biz/zwitschi/linearvoid/nginx:latest || true
|
||||
|
||||
- name: Deploy with docker-compose
|
||||
run: |
|
||||
docker compose -f docker-compose.prod.yml pull
|
||||
docker compose -f docker-compose.prod.yml up -d --remove-orphans
|
||||
|
||||
- name: Health check
|
||||
run: |
|
||||
sleep 10
|
||||
curl -f http://localhost:8080/health || exit 1
|
||||
curl -f http://localhost:3000/health || exit 1
|
||||
curl -f http://localhost:8081/health || exit 1
|
||||
|
||||
- name: Cleanup old images
|
||||
run: |
|
||||
docker image prune -f --filter "until=24h"
|
||||
@@ -0,0 +1,172 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: [self-hosted, linux, docker]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: "npm"
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Install Frontend Dependencies
|
||||
run: cd frontend && npm ci
|
||||
|
||||
- name: Lint Frontend
|
||||
run: cd frontend && npm run lint || echo "Linting not configured yet"
|
||||
|
||||
- name: Build Frontend
|
||||
run: cd frontend && npm run build
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.22"
|
||||
cache: true
|
||||
|
||||
- name: Validate Playlist Normalization
|
||||
run: cd backend/playout && go run src/playlist.go playlist.txt || echo "Validation script not yet complete"
|
||||
|
||||
- name: Build Docker Images
|
||||
run: docker compose build --no-cache
|
||||
|
||||
- name: Run Tests
|
||||
run: echo "Tests will be added in future CI steps (per TODO.md)"
|
||||
|
||||
docker:
|
||||
needs: test
|
||||
runs-on: [self-hosted, linux, docker]
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.allucanget.biz
|
||||
username: ${{ secrets.GITEA_USERNAME }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Extract metadata for Playout
|
||||
id: meta-playout
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: git.allucanget.biz/zwitschi/linearvoid/playout
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Playout image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./backend/playout
|
||||
push: true
|
||||
tags: ${{ steps.meta-playout.outputs.tags }}
|
||||
labels: ${{ steps.meta-playout.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Extract metadata for Chat
|
||||
id: meta-chat
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: git.allucanget.biz/zwitschi/linearvoid/chat
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Chat image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./backend/chat
|
||||
push: true
|
||||
tags: ${{ steps.meta-chat.outputs.tags }}
|
||||
labels: ${{ steps.meta-chat.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Extract metadata for Frontend
|
||||
id: meta-frontend
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: git.allucanget.biz/zwitschi/linearvoid/frontend
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Frontend image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./frontend
|
||||
push: true
|
||||
tags: ${{ steps.meta-frontend.outputs.tags }}
|
||||
labels: ${{ steps.meta-frontend.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Extract metadata for Nginx
|
||||
id: meta-nginx
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: git.allucanget.biz/zwitschi/linearvoid/nginx
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Nginx image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./infrastructure/nginx
|
||||
push: true
|
||||
tags: ${{ steps.meta-nginx.outputs.tags }}
|
||||
labels: ${{ steps.meta-nginx.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
release:
|
||||
needs: docker
|
||||
runs-on: [self-hosted, linux, docker]
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
@@ -0,0 +1,58 @@
|
||||
name: Dependency Updates
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 2 * * 1' # Every Monday at 2 AM UTC
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update-dependencies:
|
||||
runs-on: [self-hosted, linux, docker]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Update Frontend Dependencies
|
||||
run: |
|
||||
cd frontend
|
||||
npm update
|
||||
npm audit fix || true
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22'
|
||||
cache: true
|
||||
|
||||
- name: Update Go Dependencies
|
||||
run: |
|
||||
cd backend/playout && go get -u ./... && go mod tidy
|
||||
cd ../chat && go get -u ./... && go mod tidy
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
commit-message: 'chore: update dependencies'
|
||||
title: 'chore: weekly dependency updates'
|
||||
body: |
|
||||
Automated weekly dependency updates.
|
||||
|
||||
This PR updates:
|
||||
- Frontend npm dependencies
|
||||
- Go module dependencies
|
||||
|
||||
Please review the changes and ensure tests pass before merging.
|
||||
branch: dependency-updates
|
||||
delete-branch: true
|
||||
labels: dependencies, automated
|
||||
@@ -0,0 +1,120 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Version to release (e.g., v1.0.0)"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: [self-hosted, linux, docker]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.allucanget.biz
|
||||
username: ${{ secrets.GITEA_USERNAME }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Extract version
|
||||
id: version
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Extract metadata for Playout
|
||||
id: meta-playout
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: git.allucanget.biz/zwitschi/linearvoid/playout
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Build and push Playout image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./backend/playout
|
||||
push: true
|
||||
tags: ${{ steps.meta-playout.outputs.tags }}
|
||||
labels: ${{ steps.meta-playout.outputs.labels }}
|
||||
|
||||
- name: Extract metadata for Chat
|
||||
id: meta-chat
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: git.allucanget.biz/zwitschi/linearvoid/chat
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Build and push Chat image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./backend/chat
|
||||
push: true
|
||||
tags: ${{ steps.meta-chat.outputs.tags }}
|
||||
labels: ${{ steps.meta-chat.outputs.labels }}
|
||||
|
||||
- name: Extract metadata for Frontend
|
||||
id: meta-frontend
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: git.allucanget.biz/zwitschi/linearvoid/frontend
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Build and push Frontend image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./frontend
|
||||
push: true
|
||||
tags: ${{ steps.meta-frontend.outputs.tags }}
|
||||
labels: ${{ steps.meta-frontend.outputs.labels }}
|
||||
|
||||
- name: Extract metadata for Nginx
|
||||
id: meta-nginx
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: git.allucanget.biz/zwitschi/linearvoid/nginx
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Build and push Nginx image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./infrastructure/nginx
|
||||
push: true
|
||||
tags: ${{ steps.meta-nginx.outputs.tags }}
|
||||
labels: ${{ steps.meta-nginx.outputs.labels }}
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
generate_release_notes: true
|
||||
tag_name: ${{ steps.version.outputs.version }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
Reference in new issue
Block a user