Skip to content

Commit

Permalink
preparations for queue-rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
geek-at committed Oct 15, 2023
1 parent cea501d commit 5c3ee9e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM alpine:3.18

RUN apk add --no-cache bash socat wget curl nginx file ffmpeg unzip zlib \
RUN apk add --no-cache bash socat wget curl nginx file ffmpeg unzip zlib redis \
php82-fileinfo \
php82-session \
php \
Expand Down Expand Up @@ -29,7 +29,8 @@ RUN apk add --no-cache bash socat wget curl nginx file ffmpeg unzip zlib \
php82-simplexml \
php82-session \
php82-fileinfo \
php82-pcntl
php82-pcntl \
php82-pecl-redis

RUN ln -s /usr/bin/php82 /usr/bin/php

Expand Down
3 changes: 3 additions & 0 deletions inc/example.config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
/**
* All settings that are uncommented are mandatory
* Others optional
*
* For all possible config options, check https://github.com/HaschekSolutions/pictshare/blob/master/rtfm/CONFIG.md
* or /rtfm/CONFIG.md in your installation
*/

//Use a specific domain for links presented to the user
Expand Down
9 changes: 9 additions & 0 deletions rtfm/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ In this file you can set the following options. For a simple working example con
| ALLOWED_SUBNET | IPv4 or IPv6 CIDR | If set, will limit uploads to IPs that match this CIDR |
| ALWAYS_WEBP | bool | If set to `true`, JPGs will always be served as WebP, if the client supports it (if `image/webp` is in header `HTTP_ACCEPT`) |
| UPLOAD_CODE | string | If set, all uploads require this code via GET or POST variable "uploadcode" to succeed |
| REDIS_SERVER (NOT IMPLEMENTED) | IP | If you define a REDIS server IP here, it will enable you to use the FFMPEG Worker |
| UPLOAD_QUOTA (NOT IMPLEMENTED) | int | Size in MB. If set, will only allow uploads if combined size of uploads on Server is smaller than this value. Does not account for ALT_FOLDER data and resized versions of original uploads won't be added to calculation |
| MAX_RESIZED_IMAGES (NOT IMPLEMENTED | string | If set, limits count of resized images/videos per file on server |

Expand Down Expand Up @@ -85,3 +86,11 @@ This probably requires the php-ftp package but on some platforms it's included i
|FTP_PASS | string | FTP Password |
|FTP_BASEDIR | string | Base path where files will be stored. Must end with / eg `/web/pictshare/` |
|FTP_PASSIVEMODE | bool | Wether to use passive mode or not. If you have troubles with uploading, switch this setting maybe |

# FFMPEG Worker

For faster video en/transcoding there is a php script called `/tools/ffmpeg_worker.php` which is a CLI application looping every second, checking the REDIS Queue for encoding tasks.

This way the rendering queue is detached from php-fpm since PHP can't have threaded workloads and it will make sure a encoding task like resizing of a video won't block the rest of the site from functioning.

For the FFMPEG Worker to be enabled, the config option `REDIS_SERVER` must be set to the IP Address of a redis server.
2 changes: 2 additions & 0 deletions tools/ffmpeg_worker.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php

0 comments on commit 5c3ee9e

Please sign in to comment.