Compare commits
18
Commits
47ffae5dea
...
1.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f1e227d50 | ||
|
|
0891606321 | ||
|
|
c6f28ff7af | ||
|
|
072a91961f | ||
|
|
7184240dd4 | ||
|
|
9cd0419c0c | ||
|
|
d3266f8feb | ||
|
|
b532507374 | ||
|
|
5c1a8cbe4f | ||
|
|
502fefff33 | ||
|
|
bc3a950d99 | ||
|
|
1af9e59a56 | ||
|
|
13d25a7ae0 | ||
|
|
fc799da000 | ||
|
|
2b091adce8 | ||
|
|
c54210434e | ||
|
|
fcb68cfd8d | ||
|
|
cdecdd2d4a |
No files matched your search
@@ -1,13 +1,17 @@
|
||||
name: CD
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_run:
|
||||
workflows: ["CI"]
|
||||
types:
|
||||
- completed
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: [ubuntu-latest]
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
|
||||
environment: production
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
||||
@@ -82,6 +82,7 @@ jobs:
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./backend/playout
|
||||
file: ./backend/playout/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta-playout.outputs.tags }}
|
||||
labels: ${{ steps.meta-playout.outputs.labels }}
|
||||
|
||||
@@ -89,15 +89,14 @@ jobs:
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
dockerfile: infrastructure/nginx/Dockerfile
|
||||
file: infrastructure/nginx/Dockerfile
|
||||
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.CI_REGISTRY_TOKEN }}
|
||||
- name: Create Release on Gitea
|
||||
run: |
|
||||
curl -X POST "$CI_SERVER_URL/api/v1/repos/$CI_REPO_OWNER/$CI_REPO_NAME/releases" \
|
||||
-H "Authorization: token ${{ secrets.CI_REGISTRY_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${{ steps.version.outputs.version }}\",\"name\":\"${{ steps.version.outputs.version }}\",\"body\":\"Release ${{ steps.version.outputs.version }}\n\nSee [CHANGELOG.md](https://git.allucanget.biz/zwitschi/linearvoid/src/branch/main/CHANGELOG.md) for details.\",\"draft\":false,\"prerelease\":false}"
|
||||
@@ -50,6 +50,9 @@ data/
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
|
||||
# Demo data (tracked in backend/playout/demodata/ for out-of-the-box playout)
|
||||
!backend/playout/demodata/
|
||||
|
||||
# Docker
|
||||
.dockerignore
|
||||
**/.dockerignore
|
||||
|
||||
@@ -9,7 +9,7 @@ RUN go mod tidy
|
||||
RUN CGO_ENABLED=1 GOOS=linux go build -o /chat-server ./src/main.go
|
||||
|
||||
FROM alpine:3.20
|
||||
RUN apk --no-cache add ca-certificates
|
||||
RUN apk --no-cache add ca-certificates curl curl
|
||||
WORKDIR /app
|
||||
COPY --from=builder /chat-server /usr/local/bin/chat-server
|
||||
|
||||
|
||||
@@ -16,20 +16,18 @@ RUN apk add --no-cache \
|
||||
ffmpeg \
|
||||
curl \
|
||||
bash
|
||||
|
||||
# Set working directory for playout
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /playlist-manager /app/playlist-manager
|
||||
# Copy the playout start script and the built playlist manager binary
|
||||
COPY start-playout.sh /app/
|
||||
COPY *.sh /app/
|
||||
|
||||
RUN chmod +x /app/*.sh /app/playlist-manager
|
||||
|
||||
# Copy demo data for out-of-the-box playout
|
||||
COPY demodata/ /app/
|
||||
# Copy the built playlist manager binary from the builder stage
|
||||
COPY --from=builder /playlist-manager /app/playlist-manager
|
||||
# Create directories for playlist, media, and HLS output
|
||||
RUN mkdir -p /app/playlist /app/media /app/hls
|
||||
|
||||
RUN mkdir -p /app/hls
|
||||
RUN chmod +x /app/start-playout.sh /app/playlist-manager
|
||||
# Expose HLS directory (will be served by nginx)
|
||||
VOLUME ["/app/hls"]
|
||||
|
||||
# Default command runs the playout loop (which calls the Go validator)
|
||||
CMD ["./start-playout.sh"]
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
# Linear Void Demo Playlist
|
||||
file '/app/media/demo1.mp4'
|
||||
file '/app/media/demo2.mp4'
|
||||
@@ -217,6 +217,65 @@ Notable aspects: Manifest freshness ensures all viewers stay on same timeline; c
|
||||
|
||||
## Deployment View
|
||||
|
||||
### CI/CD Pipeline Architecture
|
||||
|
||||
The deployment follows a two-stage pipeline: **CI builds and pushes images**, then **CD pulls and deploys** them to the production host.
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
subgraph "Gitea Actions"
|
||||
CI[CI Workflow<br/>Build + Push Images]
|
||||
CD[CD Workflow<br/>Pull + Deploy]
|
||||
end
|
||||
subgraph "Gitea Container Registry"
|
||||
REGISTRY[git.allucanget.biz<br/>playout:latest<br/>chat:latest<br/>nginx:latest]
|
||||
end
|
||||
subgraph "Production Host (192.168.88.40)"
|
||||
DOCKER[Docker Engine<br/>via TCP :2375]
|
||||
PLAYOUT[linearvoid-playout]
|
||||
CHAT[linearvoid-chat]
|
||||
NGINX[linearvoid-nginx]
|
||||
REDIS[linearvoid-redis]
|
||||
DB[linearvoid-db]
|
||||
PROM[linearvoid-prometheus]
|
||||
GRAF[linearvoid-grafana]
|
||||
end
|
||||
|
||||
CI -->|push| REGISTRY
|
||||
REGISTRY -->|pull| CD
|
||||
CD -->|deploy via DOCKER_HOST| DOCKER
|
||||
DOCKER --> PLAYOUT
|
||||
DOCKER --> CHAT
|
||||
DOCKER --> NGINX
|
||||
DOCKER --> REDIS
|
||||
DOCKER --> DB
|
||||
DOCKER --> PROM
|
||||
DOCKER --> GRAF
|
||||
|
||||
classDef ci fill:#e1f5fe,stroke:#0288d1
|
||||
classDef reg fill:#fff3e0,stroke:#f57c00
|
||||
classDef prod fill:#e8f5e9,stroke:#388e3c
|
||||
class CI,CD ci
|
||||
class REGISTRY reg
|
||||
class DOCKER,PLAYOUT,CHAT,NGINX,REDIS,DB,PROM,GRAF prod
|
||||
```
|
||||
|
||||
**Pipeline Sequence:**
|
||||
|
||||
1. **CI Workflow** (`.gitea/workflows/ci.yml`):
|
||||
- Triggers on `push` to `main` or `pull_request`
|
||||
- Runs `test` job: frontend lint/build, Go validation, `docker compose build`
|
||||
- Runs `docker` job (after `test` passes, only on `main` push):
|
||||
- Builds `playout`, `chat`, `nginx` images with Buildx
|
||||
- Pushes to Gitea Container Registry with `main` and `latest` tags
|
||||
2. **CD Workflow** (`.gitea/workflows/cd.yml`):
|
||||
- Triggers on `workflow_run` when CI completes successfully, or manually via `workflow_dispatch`
|
||||
- Pulls latest images from registry
|
||||
- Generates `.env` from secrets
|
||||
- Seeds Prometheus config into named volume
|
||||
- Deploys via `docker compose -f docker-compose.prod.yml up -d` to remote host (`192.168.88.40:2375`)
|
||||
- Runs health checks with retry logic for playout initialization
|
||||
|
||||
### Infrastructure Level 1
|
||||
|
||||
**Overview Diagram**: See Mermaid in Building Block section (VPS + Cloudflare R2/Pages/CDN).
|
||||
|
||||
Reference in new issue
Block a user