feat(server): Integrate ffmpeg and warp into the server

This commit is contained in:
Wanjohi
2024-04-04 04:17:33 +03:00
parent 4897a20ed0
commit 5d3d4acde7
3 changed files with 74 additions and 25 deletions

View File

@@ -31,14 +31,63 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
build-cargo:
defaults:
run:
working-directory: moq-server
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust
id: toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
toolchain: stable
components: clippy, rustfmt
- name: Cache Rust Dependencies
uses: Swatinem/rust-cache@v2
with:
save-if: false
prefix-key: 'v0-rust-deps'
shared-key: x86_64-unknown-linux-gnu
- name: Cargo build
run: cargo build --target x86_64-unknown-linux-gnu --manifest-path ./moq-pub/Cargo.toml --release
- name: Copy and rename artifacts (Linux)
run: |
cp target/x86_64-unknown-linux-gnu/release/moq-pub ./warp
- name: Publish artifacts
uses: actions/upload-artifact@v3
with:
name: warp
path: ./moq-server/warp
if-no-files-found: error
retention-days: 5
build-docker-pr: build-docker-pr:
name: Build image on pr name: Build image on pr
needs:
- build-cargo
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name == 'pull_request' }}
steps: steps:
- -
name: Checkout repo name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
-
name: Download go binary
uses: actions/download-artifact@v3
with:
name: warp
path: ./
- -
name: Setup Docker Buildx name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -56,6 +105,8 @@ jobs:
name: Build image on merge to main name: Build image on merge to main
if: ${{github.ref == 'refs/heads/main'}} if: ${{github.ref == 'refs/heads/main'}}
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs:
- build-cargo
permissions: permissions:
contents: read contents: read
packages: write packages: write
@@ -63,6 +114,12 @@ jobs:
- -
name: Checkout repo name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
-
name: Download warp
uses: actions/download-artifact@v3
with:
name: warp
path: ./
- -
name: Log into registry ${{ env.REGISTRY }} name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3 uses: docker/login-action@v3

View File

@@ -4,7 +4,7 @@ on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: 0 0 * * * # At the end of everyday - cron: 0 0 * * * # At the end of everyday
pull_request: pull_request: #TODO: run only on dependabot updates
release: release:
types: [published] types: [published]
@@ -59,7 +59,7 @@ jobs:
id: toolchain id: toolchain
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
targets: ${{ matrix.settings.target }} targets: x86_64-unknown-linux-gnu
toolchain: stable toolchain: stable
components: clippy, rustfmt components: clippy, rustfmt
@@ -68,25 +68,25 @@ jobs:
with: with:
save-if: false save-if: false
prefix-key: 'v0-rust-deps' prefix-key: 'v0-rust-deps'
shared-key: ${{ matrix.settings.target }} shared-key: x86_64-unknown-linux-gnu
- name: Cargo build - name: Cargo build
run: cargo build --target ${{ matrix.settings.target }} --manifest-path ./moq-pub/Cargo.toml --release run: cargo build --target x86_64-unknown-linux-gnu --manifest-path ./moq-pub/Cargo.toml --release
- name: Copy and rename artifacts (Linux) - name: Copy and rename artifacts (Linux)
if: ${{ matrix.settings.host == 'ubuntu-20.04' }} if: ${{ matrix.settings.host == 'ubuntu-20.04' }}
run: | run: |
cp target/${{ matrix.settings.target }}/release/moq-pub ./warp cp target/x86_64-unknown-linux-gnu/release/moq-pub ./warp
- name: Copy and rename artifacts (Windows) - name: Copy and rename artifacts (Windows)
if: ${{ matrix.settings.host == 'windows-latest' }} if: ${{ matrix.settings.host == 'windows-latest' }}
run: | run: |
cp "target/${{ matrix.settings.target }}/release/moq-pub.exe" ./warp.exe cp "target/x86_64-unknown-linux-gnu/release/moq-pub.exe" ./warp.exe
- name: Copy and rename artifacts (macOS) - name: Copy and rename artifacts (macOS)
if: ${{ matrix.settings.host == 'macos-latest' }} if: ${{ matrix.settings.host == 'macos-latest' }}
run: | run: |
cp target/${{ matrix.settings.target }}/release/moq-pub ./warp cp target/x86_64-unknown-linux-gnu/release/moq-pub ./warp
- name: Publish release for (${{ matrix.settings.host }}) - name: Publish release for (${{ matrix.settings.host }})
if: ${{ matrix.settings.host == 'windows-latest' }} if: ${{ matrix.settings.host == 'windows-latest' }}
@@ -112,16 +112,7 @@ jobs:
defaults: defaults:
run: run:
working-directory: moq-server working-directory: moq-server
strategy: runs-on: ubuntu-20.04
fail-fast: false
matrix:
settings:
- host: ubuntu-20.04
target: x86_64-unknown-linux-gnu
bundles: appimage
asset_name: warp-ubuntu-amd64
runs-on: ${{ matrix.settings.host }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -132,7 +123,7 @@ jobs:
id: toolchain id: toolchain
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
targets: ${{ matrix.settings.target }} targets: x86_64-unknown-linux-gnu
toolchain: stable toolchain: stable
components: clippy, rustfmt components: clippy, rustfmt
@@ -141,19 +132,19 @@ jobs:
with: with:
save-if: false save-if: false
prefix-key: 'v0-rust-deps' prefix-key: 'v0-rust-deps'
shared-key: ${{ matrix.settings.target }} shared-key: x86_64-unknown-linux-gnu
- name: Cargo build - name: Cargo build
run: cargo build --target ${{ matrix.settings.target }} --manifest-path ./moq-pub/Cargo.toml --release run: cargo build --target x86_64-unknown-linux-gnu --manifest-path ./moq-pub/Cargo.toml --release
- name: Copy and rename artifacts (Linux) - name: Copy and rename artifacts (Linux)
run: | run: |
cp target/${{ matrix.settings.target }}/release/moq-pub ./warp cp target/x86_64-unknown-linux-gnu/release/moq-pub ./warp
- name: Publish artifacts (${{ matrix.settings.host }}) - name: Publish artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ matrix.settings.asset_name }} name: warp-ubuntu-amd64
path: ./moq-server/warp path: ./moq-server/warp
if-no-files-found: error if-no-files-found: error
retention-days: 5 retention-days: 5

View File

@@ -2,7 +2,7 @@
#NOTE: KEEP THIS IMAGE AS LEAN AS POSSIBLE. #NOTE: KEEP THIS IMAGE AS LEAN AS POSSIBLE.
FROM ghcr.io/wanjohiryan/netris/recorder:nightly as recorder FROM ghcr.io/wanjohiryan/netris/recorder:nightly as recorder
FROM ubuntu:23.10 FROM ghcr.io/wanjohiryan/netris/ffmpeg:nightly
ENV DEBIAN_FRONTEND=noninteractive \ ENV DEBIAN_FRONTEND=noninteractive \
TIMEZONE=Africa/Nairobi TIMEZONE=Africa/Nairobi
@@ -118,8 +118,9 @@ RUN apt-get update -y \
&& echo "load-module module-native-protocol-tcp auth-anonymous=1" >> /etc/pulse/default.pa && echo "load-module module-native-protocol-tcp auth-anonymous=1" >> /etc/pulse/default.pa
COPY .scripts/ /usr/bin/netris/ COPY .scripts/ /usr/bin/netris/
COPY warp /usr/bin/netris/
RUN ls -la /usr/bin/netris \ RUN ls -la /usr/bin/netris \
&& chmod +x /usr/bin/netris/proton /usr/bin/netris/entrypoint.sh && chmod +x /usr/bin/netris/proton /usr/bin/netris/entrypoint.sh /usr/bin/netris/warp
#Install proton #Install proton
RUN /usr/bin/netris/proton -i RUN /usr/bin/netris/proton -i