Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
NAMESPACE_DOCKER_HUB: 'oneofftech/video-service'
COMMIT_SHA: ${{github.sha}}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0
with:
fetch-depth: 1
- name: Define image version
Expand Down
38 changes: 19 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

services:
mariadb:
image: mariadb:10.6
image: mariadb:11.8.9
env:
MYSQL_DATABASE: laravel
MYSQL_USER: sail
Expand All @@ -26,43 +26,43 @@ jobs:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: true
matrix:
php: [8.1]
php: [8.4]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0
with:
fetch-depth: 1

- name: Cache PHP dependencies
uses: actions/cache@v1
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Cache JS dependencies
uses: actions/cache@v1
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1
with:
path: ~/.yarn/
key: dependencies-js-${{ hashFiles('yarn.lock') }}
path: ~/.npm/
key: dependencies-js-${{ hashFiles('package-lock.json') }}

- name: Install FFmpeg
uses: Iamshankhadeep/setup-ffmpeg@ffmpeg-5.0-20220119
with:
version: 5.0
id: setup-ffmpeg

run: |
apt-get update -yqq
DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends ffmpeg
ffprobe -version | head -n 1


- name: Install dependencies
run: |
cp .env.example .env
composer install --prefer-dist
yarn config set cache-folder ~/.yarn/
yarn install --link-duplicates
yarn build
npm ci
npm run build

- name: Run tests
run: |
Expand Down
64 changes: 26 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## 1. Builder. Collect build time dependencies and prepare the code

FROM klinktechnology/k-box-ci-pipeline-php:8.1 AS builder
FROM klinktechnology/k-box-ci-pipeline-php:8.4 AS builder

LABEL oot.builder="video-builder"

Expand All @@ -18,23 +18,22 @@ RUN \
composer install --no-dev --prefer-dist

RUN \
yarn config set cache-folder .yarn && \
yarn install --link-duplicates && \
yarn build && \
npm ci && \
npm run build && \
rm -rf node_modules
RUN \
rm -rf "docker" && \
rm -rf "storage" && \
rm -rf "resources/css" && \
rm -rf "resources/js" && \
rm -rf .env* && \
rm -rf yarn.lock && \
rm -rf package-lock.json && \
rm -rf *.js && \
rm -rf "test"

## 2. Packaging. Generate the production Docker image

FROM php:8.1.23-fpm-bullseye AS php
FROM php:8.4.25-fpm-trixie AS php

LABEL maintainer="OneOffTech <info@oneofftech.xyz>" \
org.label-schema.name="oneofftech/video-service" \
Expand All @@ -43,10 +42,10 @@ LABEL maintainer="OneOffTech <info@oneofftech.xyz>" \
org.label-schema.vcs-url="https://github.com/OneOffTech/video-service/"

## Default environment variables
ENV PHP_MAX_EXECUTION_TIME 120
ENV PHP_MAX_INPUT_TIME 120
ENV PHP_MEMORY_LIMIT 2048M
ENV APP_CODE_DIR /var/www/html
ENV PHP_MAX_EXECUTION_TIME=120
ENV PHP_MAX_INPUT_TIME=120
ENV PHP_MEMORY_LIMIT=2048M
ENV APP_CODE_DIR=/var/www/html

## Install libraries, envsubst, supervisor and php modules
RUN apt-get update -yqq && \
Expand Down Expand Up @@ -85,53 +84,42 @@ RUN locale-gen "en_US.UTF-8" \
&& /usr/sbin/update-locale LANG="C.UTF-8"

## FFmpeg installation
## Install the current release as available on https://johnvansickle.com/ffmpeg/
ENV FFMPEG_BINARIES /usr/local/bin/ffmpeg
ENV FFPROBE_BINARIES /usr/local/bin/ffprobe

RUN set -e; \
linux_url='https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz'; \
linux_temp_archive='/tmp/ffmpeg-release-amd64-static.tar.xz'; \
linux_name='ffmpeg-linux-x64'; \
linux_temp="/usr/local/bin/"; \
cd /tmp/ \
&& echo "Downloading FFmpeg release to $linux_temp_archive" \
&& curl -sSLf https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz -o $linux_temp_archive \
&& echo "Downloading FFmpeg checksum to ${linux_temp_archive}.md5" \
&& curl -sSLf https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz.md5 -o "${linux_temp_archive}.md5" \
&& md5sum -c "${linux_temp_archive}.md5" \
&& tar -xf $linux_temp_archive --wildcards -O '**/ffmpeg' > "$linux_temp/ffmpeg" \
&& tar -xf $linux_temp_archive --wildcards -O '**/ffprobe' > "$linux_temp/ffprobe" \
&& tar -xf $linux_temp_archive --wildcards -O '**/GPLv3.txt' > "$linux_temp/FFMPEG-LICENSE" \
&& tar -xf $linux_temp_archive --wildcards -O '**/readme.txt' > "$linux_temp/FFMPEG-README.txt" \
&& chmod +x "$linux_temp/ffmpeg" \
&& chmod +x "$linux_temp/ffprobe" \
&& rm -rf /tmp/*
## Use the Debian package, the johnvansickle.com static builds segfault on Debian trixie
## when ffprobe opens HLS playlists (their bundled glibc loads the host iconv modules)
ENV FFMPEG_BINARIES=/usr/bin/ffmpeg
ENV FFPROBE_BINARIES=/usr/bin/ffprobe

RUN apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends ffmpeg \
&& apt-get clean \
&& rm -rf /var/cache/apt/ /var/lib/apt/lists/*

## NGINX installation
### The installation procedure is heavily inspired from https://github.com/nginxinc/docker-nginx
ENV NGINX_VERSION "1.24.0-1~bullseye"
ENV NGINX_VERSION="1.30.6-1~trixie"

RUN set -ex \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates \
&& \
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
NGINX_GPGKEYS="573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 8540A6F18833A80E9C1653A42FD21310B49F6B46 9E9BE90EACBCDE69FE9B204CBCDCD8A38D88A2B3"; \
NGINX_GPGKEY_PATH=/usr/share/keyrings/nginx-archive-keyring.gpg; \
export GNUPGHOME="$(mktemp -d)"; \
for NGINX_GPGKEY in $NGINX_GPGKEYS; do \
found=''; \
for server in \
hkp://keyserver.ubuntu.com:80 \
pgp.mit.edu \
; do \
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
gpg1 --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
gpg1 --batch --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
done; \
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
gpg1 --export "$NGINX_GPGKEY" > "$NGINX_GPGKEY_PATH" ; \
done; \
gpg1 --batch --export $NGINX_GPGKEYS > "$NGINX_GPGKEY_PATH" ; \
rm -rf "$GNUPGHOME"; \
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
&& echo "deb [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
&& echo "deb [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/debian/ trixie nginx" >> /etc/apt/sources.list.d/nginx.list \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y nginx=${NGINX_VERSION} \
&& apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list
Expand Down Expand Up @@ -177,7 +165,7 @@ COPY \
/var/www/html/public/ \
/var/www/html/public/

ENV STORAGE_PATH "/var/www/html/storage"
ENV STORAGE_PATH="/var/www/html/storage"

WORKDIR /var/www/html

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ the UI styling. Video elaboration stands on the shoulders of the great

Given the selected stack OVS requires:

- [PHP 8.1](https://www.php.net/) or above
- [PHP 8.3](https://www.php.net/) or above (8.4 recommended)
- [Composer 2](https://getcomposer.org/)
- [NodeJS](https://nodejs.org/en/) version 16 or above with
[Yarn](https://classic.yarnpkg.com/en/docs/install) (v1.x) package manager
- [NodeJS](https://nodejs.org/en/) version 20 or above with the bundled npm package manager
- [MariaDB](https://mariadb.org/) version 10.6 or above
- [Docker](https://www.docker.com/)
- [FFmpeg](https://ffmpeg.org/download.html) binaries available. You will need both `ffmpeg` and `ffprobe` binaries.
Expand Down
5 changes: 0 additions & 5 deletions app/Enums/BlobRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

namespace App\Enums;

use Dyrynda\Database\Casts\EfficientUuid;
use Illuminate\Database\Eloquent\Model;
use Dyrynda\Database\Support\GeneratesUuid;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;

enum BlobRoles: int
{
Expand Down
6 changes: 1 addition & 5 deletions app/Enums/ConversionTargets.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

namespace App\Enums;

use Dyrynda\Database\Casts\EfficientUuid;
use Illuminate\Database\Eloquent\Model;
use Dyrynda\Database\Support\GeneratesUuid;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;


enum ConversionTargets: int
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/OembedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function show(Request $request)

// Get the document id from the given URL
// TODO: maybe there will be additional routes as currently we refer to the authenticated route to show a video
$base_url = route('videos.show', '').'/';
$base_url = route('videos.index').'/';

// if the url don't start with this application URL, or
// contains query parameters => abort
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestForgery as Middleware;

class VerifyCsrfToken extends Middleware
{
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Blob.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Enums\BlobRoles;
use App\Enums\ConversionTargets;
use Dyrynda\Database\Casts\EfficientUuid;
use Dyrynda\Database\Support\Casts\EfficientUuid;
use Illuminate\Database\Eloquent\Model;
use Dyrynda\Database\Support\GeneratesUuid;
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Dyrynda\Database\Casts\EfficientUuid;
use Dyrynda\Database\Support\Casts\EfficientUuid;
use Dyrynda\Database\Support\BindsOnUuid;
use Dyrynda\Database\Support\GeneratesUuid;
use Illuminate\Database\Eloquent\Factories\HasFactory;
Expand Down
30 changes: 15 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
"keywords": ["video", "player", "video-management", "ffmpeg", "pseudo-streaming", "hls"],
"license": "MIT",
"require": {
"php": "^8.1",
"dyrynda/laravel-efficient-uuid": "^5.0",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"pbmedia/laravel-ffmpeg": "^8.3"
"php": "^8.3",
"dyrynda/laravel-model-uuid": "^8.3",
"guzzlehttp/guzzle": "^7.8",
"laravel/framework": "^13.0",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^3.0",
"pbmedia/laravel-ffmpeg": "^8.9"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/breeze": "^1.8",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^2.0"
"fakerphp/faker": "^1.23",
"laravel/breeze": "^2.4",
"laravel/pint": "^1.24",
"laravel/sail": "^1.41",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"phpunit/phpunit": "^12.0",
"spatie/laravel-ignition": "^2.9"
},
"autoload": {
"psr-4": {
Expand Down
Loading
Loading