feat(livekit): add service

This commit is contained in:
2026-03-03 15:57:57 +03:00
commit 6f7094cc41
16 changed files with 992 additions and 0 deletions

208
phpdocker/README.html Executable file
View File

@@ -0,0 +1,208 @@
<html>
<head>
<title>PHPDocker.io Readme</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
<style>
code {
background-color : #ddd;
padding : 2px 5px;
font-family : monospace;
font-size : 16px;
}
</style>
</head>
<body>
<div class="pure-g">
<div class="pure-u-1-24"></div>
<div class="pure-u-22-24">
<h1>PHPDocker.io generated environment</h1>
<h1>Add to your project</h1>
<p>Simply, unzip the file into your project, this will create <code>docker-compose.yml</code> on the root of your project and a folder
named <code>phpdocker</code> containing nginx and php-fpm config for it.</p>
<p>Ensure the webserver config on <code>phpdocker/nginx/nginx.conf</code> is correct for your project. PHPDocker.io will have
customised this file according to the front controller location relative to the docker-compose file you chose on the
generator (by default <code>public/index.php</code>).</p>
<p>Note: you may place the files elsewhere in your project. Make sure you modify the locations for the php-fpm dockerfile,
the php.ini overrides and nginx config on <code>docker-compose.yml</code> if you do so.</p>
<h1>How to run</h1>
<p>Dependencies:</p>
<ul>
<li>docker. See <a href="https://docs.docker.com/engine/installation">https://docs.docker.com/engine/installation</a></li>
<li>docker-compose. See <a href="https://docs.docker.com/compose/install/">docs.docker.com/compose/install</a></li>
</ul>
<p>Once you're done, simply <code>cd</code> to your project and run <code>docker-compose up -d</code>. This will initialise and start all the
containers, then leave them running in the background.</p>
<h2>Services exposed outside your environment</h2>
<p>You can access your application via <strong><code>localhost</code></strong>. Mailhog and nginx both respond to any hostname, in case you want to
add your own hostname on your <code>/etc/hosts</code></p>
<table>
<thead>
<tr>
<th>Service</th>
<th>Address outside containers</th>
</tr>
</thead>
<tbody>
<tr>
<td>Webserver</td>
<td><a href="http://localhost:1092">localhost:1092</a></td>
</tr>
<tr>
<td>MySQL</td>
<td><strong>host:</strong> <code>localhost</code>; <strong>port:</strong> <code>1094</code></td>
</tr>
</tbody>
</table>
<h2>Hosts within your environment</h2>
<p>You'll need to configure your application to use any services you enabled:</p>
<table>
<thead>
<tr>
<th>Service</th>
<th>Hostname</th>
<th>Port number</th>
</tr>
</thead>
<tbody>
<tr>
<td>php-fpm</td>
<td>php-fpm</td>
<td>9000</td>
</tr>
<tr>
<td>MySQL</td>
<td>mysql</td>
<td>3306 (default)</td>
</tr>
</tbody>
</table>
<h1>Docker compose cheatsheet</h1>
<p><strong>Note:</strong> you need to cd first to where your docker-compose.yml file lives.</p>
<ul>
<li>Start containers in the background: <code>docker-compose up -d</code></li>
<li>Start containers on the foreground: <code>docker-compose up</code>. You will see a stream of logs for every container running.
ctrl+c stops containers.</li>
<li>Stop containers: <code>docker-compose stop</code></li>
<li>Kill containers: <code>docker-compose kill</code></li>
<li>View container logs: <code>docker-compose logs</code> for all containers or <code>docker-compose logs SERVICE_NAME</code> for the logs of
all containers in <code>SERVICE_NAME</code>.</li>
<li>Execute command inside of container: <code>docker-compose exec SERVICE_NAME COMMAND</code> where <code>COMMAND</code> is whatever you want
to run. Examples:
<ul>
<li>Shell into the PHP container, <code>docker-compose exec php-fpm bash</code></li>
<li>Run symfony console, <code>docker-compose exec php-fpm bin/console</code></li>
<li>Open a mysql shell, <code>docker-compose exec mysql mysql -uroot -pCHOSEN_ROOT_PASSWORD</code></li>
</ul></li>
</ul>
<h1>Application file permissions</h1>
<p>As in all server environments, your application needs the correct file permissions to work properly. You can change the
files throughout the container, so you won't care if the user exists or has the same ID on your host.</p>
<p><code>docker-compose exec php-fpm chown -R www-data:www-data /application/public</code></p>
<h1>Recommendations</h1>
<p>It's hard to avoid file permission issues when fiddling about with containers due to the fact that, from your OS point
of view, any files created within the container are owned by the process that runs the docker engine (this is usually
root). Different OS will also have different problems, for instance you can run stuff in containers
using <code>docker exec -it -u $(id -u):$(id -g) CONTAINER_NAME COMMAND</code> to force your current user ID into the process, but
this will only work if your host OS is Linux, not mac. Follow a couple of simple rules and save yourself a world of
hurt.</p>
<ul>
<li>Run composer outside of the php container, as doing so would install all your dependencies owned by <code>root</code> within your
vendor folder.</li>
<li>Run commands (ie Symfony's console, or Laravel's artisan) straight inside of your container. You can easily open a
shell as described above and do your thing from there.</li>
</ul>
<h1>Simple basic Xdebug configuration with integration to PHPStorm</h1>
<h2>Xdebug 2</h2>
<p>To configure <strong>Xdebug 2</strong> you need add these lines in php-fpm/php-ini-overrides.ini:</p>
<h3>For linux:</h3>
<pre><code>xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_autostart = 1
</code></pre>
<h3>For macOS and Windows:</h3>
<pre><code>xdebug.remote_enable = 1
xdebug.remote_host = host.docker.internal
xdebug.remote_autostart = 1
</code></pre>
<h2>Xdebug 3</h2>
<p>To configure <strong>Xdebug 3</strong> you need add these lines in php-fpm/php-ini-overrides.ini:</p>
<h3>For linux:</h3>
<pre><code>xdebug.mode = debug
xdebug.remote_connect_back = true
xdebug.start_with_request = yes
</code></pre>
<h3>For macOS and Windows:</h3>
<pre><code>xdebug.mode = debug
xdebug.remote_host = host.docker.internal
xdebug.start_with_request = yes
</code></pre>
<h2>Add the section “environment” to the php-fpm service in docker-compose.yml:</h2>
<pre><code>environment:
PHP_IDE_CONFIG: "serverName=Docker"
</code></pre>
<h3>Create a server configuration in PHPStorm:</h3>
<ul>
<li>In PHPStorm open Preferences | Languages &amp; Frameworks | PHP | Servers</li>
<li>Add new server</li>
<li>The “Name” field should be the same as the parameter “serverName” value in “environment” in docker-compose.yml (i.e. *
Docker* in the example above)</li>
<li>A value of the "port" field should be the same as first port(before a colon) in "webserver" service in
docker-compose.yml</li>
<li>Select "Use path mappings" and set mappings between a path to your project on a host system and the Docker container.</li>
<li>Finally, add “Xdebug helper” extension in your browser, set breakpoints and start debugging</li>
</ul>
</div>
<div class="pure-u-1-24"></div>
</div>
<script>
var tables = document.getElementsByTagName('table')
for (var i = 0; i < tables.length; i++) {
tables[i].className = 'pure-table'
}
</script>
</body>
</html>

144
phpdocker/README.md Executable file
View File

@@ -0,0 +1,144 @@
PHPDocker.io generated environment
==================================
# Add to your project #
Simply, unzip the file into your project, this will create `docker-compose.yml` on the root of your project and a folder
named `phpdocker` containing nginx and php-fpm config for it.
Ensure the webserver config on `phpdocker/nginx/nginx.conf` is correct for your project. PHPDocker.io will have
customised this file according to the front controller location relative to the docker-compose file you chose on the
generator (by default `public/index.php`).
Note: you may place the files elsewhere in your project. Make sure you modify the locations for the php-fpm dockerfile,
the php.ini overrides and nginx config on `docker-compose.yml` if you do so.
# How to run #
Dependencies:
* docker. See [https://docs.docker.com/engine/installation](https://docs.docker.com/engine/installation)
* docker-compose. See [docs.docker.com/compose/install](https://docs.docker.com/compose/install/)
Once you're done, simply `cd` to your project and run `docker-compose up -d`. This will initialise and start all the
containers, then leave them running in the background.
## Services exposed outside your environment ##
You can access your application via **`localhost`**. Mailhog and nginx both respond to any hostname, in case you want to
add your own hostname on your `/etc/hosts`
Service|Address outside containers
-------|--------------------------
Webserver|[localhost:1092](http://localhost:1092)
MySQL|**host:** `localhost`; **port:** `1094`
## Hosts within your environment ##
You'll need to configure your application to use any services you enabled:
Service|Hostname|Port number
------|---------|-----------
php-fpm|php-fpm|9000
MySQL|mysql|3306 (default)
# Docker compose cheatsheet #
**Note:** you need to cd first to where your docker-compose.yml file lives.
* Start containers in the background: `docker-compose up -d`
* Start containers on the foreground: `docker-compose up`. You will see a stream of logs for every container running.
ctrl+c stops containers.
* Stop containers: `docker-compose stop`
* Kill containers: `docker-compose kill`
* View container logs: `docker-compose logs` for all containers or `docker-compose logs SERVICE_NAME` for the logs of
all containers in `SERVICE_NAME`.
* Execute command inside of container: `docker-compose exec SERVICE_NAME COMMAND` where `COMMAND` is whatever you want
to run. Examples:
* Shell into the PHP container, `docker-compose exec php-fpm bash`
* Run symfony console, `docker-compose exec php-fpm bin/console`
* Open a mysql shell, `docker-compose exec mysql mysql -uroot -pCHOSEN_ROOT_PASSWORD`
# Application file permissions #
As in all server environments, your application needs the correct file permissions to work properly. You can change the
files throughout the container, so you won't care if the user exists or has the same ID on your host.
`docker-compose exec php-fpm chown -R www-data:www-data /application/public`
# Recommendations #
It's hard to avoid file permission issues when fiddling about with containers due to the fact that, from your OS point
of view, any files created within the container are owned by the process that runs the docker engine (this is usually
root). Different OS will also have different problems, for instance you can run stuff in containers
using `docker exec -it -u $(id -u):$(id -g) CONTAINER_NAME COMMAND` to force your current user ID into the process, but
this will only work if your host OS is Linux, not mac. Follow a couple of simple rules and save yourself a world of
hurt.
* Run composer outside of the php container, as doing so would install all your dependencies owned by `root` within your
vendor folder.
* Run commands (ie Symfony's console, or Laravel's artisan) straight inside of your container. You can easily open a
shell as described above and do your thing from there.
# Simple basic Xdebug configuration with integration to PHPStorm
## Xdebug 2
To configure **Xdebug 2** you need add these lines in php-fpm/php-ini-overrides.ini:
### For linux:
```
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_autostart = 1
```
### For macOS and Windows:
```
xdebug.remote_enable = 1
xdebug.remote_host = host.docker.internal
xdebug.remote_autostart = 1
```
## Xdebug 3
To configure **Xdebug 3** you need add these lines in php-fpm/php-ini-overrides.ini:
### For linux:
```
xdebug.mode = debug
xdebug.remote_connect_back = true
xdebug.start_with_request = yes
```
### For macOS and Windows:
```
xdebug.mode = debug
xdebug.remote_host = host.docker.internal
xdebug.start_with_request = yes
```
## Add the section “environment” to the php-fpm service in docker-compose.yml:
```
environment:
PHP_IDE_CONFIG: "serverName=Docker"
```
### Create a server configuration in PHPStorm:
* In PHPStorm open Preferences | Languages & Frameworks | PHP | Servers
* Add new server
* The “Name” field should be the same as the parameter “serverName” value in “environment” in docker-compose.yml (i.e. *
Docker* in the example above)
* A value of the "port" field should be the same as first port(before a colon) in "webserver" service in
docker-compose.yml
* Select "Use path mappings" and set mappings between a path to your project on a host system and the Docker container.
* Finally, add “Xdebug helper” extension in your browser, set breakpoints and start debugging

16
phpdocker/front-end/Dockerfile Executable file
View File

@@ -0,0 +1,16 @@
FROM phpdockerio/php:8.4-fpm
WORKDIR "/application"
RUN curl -sL https://deb.nodesource.com/setup_24.x | bash -
RUN apt-get update && \
apt-get -y --no-install-recommends install \
git \
php8.4-gd \
php8.4-mysql \
php8.4-sqlite3 \
php8.4-pgsql \
nodejs && npm install -g npm@latest \
apt-get clean; \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
ENV PATH=node_modules/.bin:$PATH

View File

@@ -0,0 +1,23 @@
[supervisord]
nodaemon=true
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /application/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/application/storage/logs/worker.log
stopwaitsecs=3600
[program:php-fpm]
command=php-fpm8.2 -F
process_name=%(program_name)s_%(process_num)02d
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stdderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

View File

@@ -0,0 +1,2 @@
upload_max_filesize = 100M
post_max_size = 108M

83
phpdocker/nginx/nginx.conf Executable file
View File

@@ -0,0 +1,83 @@
upstream phpupstream {
server php-fpm:9000 fail_timeout=5s max_fails=5;
}
resolver 127.0.0.11 ipv6=off;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# 1. Основной сайт (Laravel) - делаем его default_server
server {
listen 80 default_server; # Добавили default_server
server_name testing.eatv.io;
client_max_body_size 108M;
rewrite_log on;
access_log /dev/stdout;
error_log /dev/stdout info;
root /application/public;
index index.php;
# # Vite HMR
# location /_vite {
# proxy_pass http://frontend:5173;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_connect_timeout 7d;
# proxy_send_timeout 7d;
# proxy_read_timeout 7d;
# }
#
# location /build {
# try_files $uri $uri/ =404;
# expires 1y;
# add_header Cache-Control "public, immutable";
# }
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass phpupstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE "error_log=/var/log/nginx/application_php_errors.log";
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
include fastcgi_params;
}
}
# 2. Soketi - меняем server_name на тот, что в traefik labels (wstesting.eatv.io)
server {
listen 80;
server_name wstesting.eatv.io; # ВАЖНО: Используем поддомен для сокетов
location / {
proxy_pass http://soketi:6001;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
error_log /dev/stdout info;
access_log /dev/stdout;
}

21
phpdocker/php-fpm/Dockerfile Executable file
View File

@@ -0,0 +1,21 @@
FROM phpdockerio/php:8.4-fpm
WORKDIR "/application"
RUN curl -sL https://deb.nodesource.com/setup_24.x | bash -
RUN apt-get update && \
apt-get -y --no-install-recommends install \
git \
imagemagick php8.4-imagick \
php8.4-gd \
php8.4-mysql \
php8.4-sqlite3 \
php8.4-intl \
php8.4-memcached \
php8.4-pgsql \
php8.4-xdebug \
python3-pkg-resources supervisor ffmpeg jpegoptim \
nodejs && npm install -g npm@latest \
apt-get clean; \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
ENV PATH=node_modules/.bin:$PATH

View File

@@ -0,0 +1,23 @@
[supervisord]
nodaemon=true
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /application/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/application/storage/logs/worker.log
stopwaitsecs=3600
[program:php-fpm]
command=php-fpm8.2 -F
process_name=%(program_name)s_%(process_num)02d
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stdderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

View File

@@ -0,0 +1,2 @@
upload_max_filesize = 100M
post_max_size = 108M

3
phpdocker/typesense/Dockerfile Executable file
View File

@@ -0,0 +1,3 @@
FROM typesense/typesense:29.0
USER root
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*

12
phpdocker/worker/Dockerfile Executable file
View File

@@ -0,0 +1,12 @@
FROM phpdockerio/php:8.4-fpm
WORKDIR "/application"
RUN apt-get update && \
apt-get -y --no-install-recommends install git \
php8.4-gd php8.4-mysql php8.4-sqlite3 php8.4-pgsql ffmpeg jpegoptim \
php8.4-intl \
php8.4-memcached \
imagemagick php8.4-imagick \
python3-pkg-resources supervisor && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

View File

@@ -0,0 +1,55 @@
[supervisord]
nodaemon=true
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /application/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/application/storage/logs/worker.log
stopwaitsecs=3600
[program:laravel-schedule]
process_name=%(program_name)s_%(process_num)02d
command=php /application/artisan schedule:work
directory=/application
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/application/storage/logs/schedule.log
stopwaitsecs=3600
[program:laravel-feed-generation-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /application/artisan queue:work --queue=feed-generation --sleep=1 --tries=3 --timeout=1800 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=8
redirect_stderr=true
stdout_logfile=/application/storage/logs/feed-generation-worker.log
stopwaitsecs=3600
[program:laravel-scout-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /application/artisan queue:work --queue=scout --sleep=1 --tries=3 --timeout=300 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=8
redirect_stderr=true
stdout_logfile=/application/storage/logs/scout-worker.log
stopwaitsecs=3600

View File

@@ -0,0 +1,2 @@
upload_max_filesize = 100M
post_max_size = 108M