feat(livekit): add service

This commit is contained in:
2026-03-03 15:57:57 +03:00
committed by alex-chevski
parent e42992f982
commit ba0b4268cd
11 changed files with 266 additions and 177 deletions

View File

@@ -11,19 +11,17 @@ MYSQL_ROOT_PASSWORD="nhbnhb22"
MYSQL_DATABASE="eatvio" MYSQL_DATABASE="eatvio"
MYSQL_USER="eatvio_user" MYSQL_USER="eatvio_user"
MYSQL_PASSWORD="eatvio_pass_nhbnhb22" MYSQL_PASSWORD="eatvio_pass_nhbnhb22"
<<<<<<< HEAD
MY_APP_GIT_URL="ssh://git@10.55.5.123:222/alex_chevski/eatvio.git"
PROD_DB_USER=readonly_user
PROD_DB_PASS=baexueShosei0AiD
PROD_DB_FILE="latest-prod-db.sql"
DEV2_DB_USER=readonly_user
DEV2_DB_PASS=baexueShosei0AiD
DEV2_DB_FILE="latest-dev2-db.sql"
=======
PROD_DB_USER=some_user PROD_DB_USER=some_user
PROD_DB_PASS=strong_pass PROD_DB_PASS=strong_pass
PROD_DB_FILE="latest-prod-db.sql" PROD_DB_FILE="latest-prod-db.sql"
PROD_DB_HOST="10.nn.n.n" PROD_DB_HOST="10.nn.n.n"
PROD_DB_PORT="10nn" PROD_DB_PORT="10nn"
MY_APP_GIT_URL="ssh://git@10.55.5.123:222/eatvio/eatvio.git" MY_APP_GIT_URL="ssh://git@10.55.5.123:222/eatvio/eatvio.git"
>>>>>>> eatvio-main LIVEKIT_URL="livekit.eatv.io"
LIVEKIT_WS_URL="livekit.eatv.io"
LIVEKIT_TURN_DOMAIN="turn.eatv.io"
LIVEKIT_API_KEY=APITRajpYFYdtk9
LIVEKIT_API_SECRET=VKCfO954C3OU0IeeXxZ1fiUDx9ZmWtvNNp9fCHRfO2JH
LIVEKIT_PORT=7880
LIVEKIT_RTC_TCP_PORT=7881
LIVEKIT_TURN_UDP_PORT=3478

View File

@@ -23,6 +23,8 @@ services:
networks: networks:
- ns-eatvio - ns-eatvio
restart: always restart: always
labels:
- "traefik.enable=false"
mysql: mysql:
image: "mysql:8.0" image: "mysql:8.0"
@@ -37,6 +39,7 @@ services:
MYSQL_DATABASE: ${MYSQL_DATABASE} MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER} MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD} MYSQL_PASSWORD: ${MYSQL_PASSWORD}
TZ: "Evrope/Moscow"
ports: ports:
- "1094:3306" - "1094:3306"
labels: labels:
@@ -71,7 +74,7 @@ services:
working_dir: /application working_dir: /application
environment: environment:
- TZ=Europe/Moscow - TZ=Europe/Moscow
- CHOKIDAR_USEPOLLING=true #- CHOKIDAR_USEPOLLING=true
networks: networks:
- ns-eatvio - ns-eatvio
volumes: volumes:
@@ -119,7 +122,7 @@ services:
labels: labels:
- "traefik.docker.network=web" - "traefik.docker.network=web"
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.frontend.rule=Host:dev2.eatvio.com,socket.eatvio.com" - "traefik.frontend.rule=Host:wstesting.eatv.io,testing.eatv.io"
- "traefik.port=80" - "traefik.port=80"
- "traefik.protocol=http" - "traefik.protocol=http"
@@ -131,24 +134,80 @@ services:
- ns-eatvio - ns-eatvio
typesense: typesense:
image: typesense/typesense:29.0 build: ./phpdocker/typesense
restart: always restart: always
healthcheck: healthcheck:
test: test: ["CMD", "curl", "-f", "http://localhost:8108/health"]
- CMD
- wget
- "--no-verbose"
- "--spider"
- "http://localhost:8108/health"
networks: networks:
- ns-eatvio - ns-eatvio
volumes: volumes:
- ./typesense-data:/data - ./typesense-data:/data
command: "--data-dir /data --api-key=typesense --enable-cors" command: "--data-dir /data --api-key=typesense --enable-cors"
livekit-redis:
image: redis:7-alpine
command:
[
"redis-server",
"--appendonly",
"no",
"--maxmemory",
"500mb",
"--maxmemory-policy",
"allkeys-lru",
]
networks:
- ns-eatvio
volumes:
- livekit_redis_data:/data
restart: always
labels:
- "traefik.enable=false"
livekit:
image: livekit/livekit-server:latest
depends_on:
- livekit-redis
networks:
- ns-eatvio
- web
ports:
- "${LIVEKIT_PORT:-7880}:7880"
- "${LIVEKIT_RTC_TCP_PORT:-7881}:7881"
- "50000-50100:50000-50100/udp"
- "${LIVEKIT_TURN_UDP_PORT:-3478}:3478/udp"
environment:
LIVEKIT_CONFIG: |
port: 7880
log_level: info
rtc:
tcp_port: 7881
port_range_start: 50000
port_range_end: 50100
use_external_ip: true
redis:
address: livekit-redis:6379
keys:
${LIVEKIT_API_KEY}: ${LIVEKIT_API_SECRET}
turn:
enabled: true
domain: ${LIVEKIT_TURN_DOMAIN}
udp_port: 3478
# tls_port: 5349
restart: always
labels:
- "traefik.docker.network=web"
- "traefik.enable=true"
- "traefik.frontend.rule=Host:turn.eatv.io,livekit.eatv.io"
- "traefik.port=${LIVEKIT_PORT:-7880}"
- "traefik.protocol=http"
networks: networks:
web: web:
external: true external: true
ns-eatvio: ns-eatvio:
external: false external: false
volumes:
livekit_redis_data:

View File

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

View File

@@ -142,3 +142,4 @@ environment:

View File

@@ -14,4 +14,3 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
ENV PATH=node_modules/.bin:$PATH ENV PATH=node_modules/.bin:$PATH

View File

@@ -15,9 +15,10 @@ stdout_logfile=/application/storage/logs/worker.log
stopwaitsecs=3600 stopwaitsecs=3600
[program:php-fpm] [program:php-fpm]
command=php-fpm8.3 -F command=php-fpm8.2 -F
process_name=%(program_name)s_%(process_num)02d process_name=%(program_name)s_%(process_num)02d
stdout_logfile=/dev/stdout stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
stdderr_logfile=/dev/stderr stdderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0

View File

@@ -15,9 +15,10 @@ stdout_logfile=/application/storage/logs/worker.log
stopwaitsecs=3600 stopwaitsecs=3600
[program:php-fpm] [program:php-fpm]
command=php-fpm8.3 -F command=php-fpm8.2 -F
process_name=%(program_name)s_%(process_num)02d process_name=%(program_name)s_%(process_num)02d
stdout_logfile=/dev/stdout stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
stdderr_logfile=/dev/stderr stdderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0

View File

@@ -1,2 +1,3 @@
upload_max_filesize = 100M upload_max_filesize = 100M
post_max_size = 108M 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/*

View File

@@ -53,3 +53,4 @@ numprocs=8
redirect_stderr=true redirect_stderr=true
stdout_logfile=/application/storage/logs/scout-worker.log stdout_logfile=/application/storage/logs/scout-worker.log
stopwaitsecs=3600 stopwaitsecs=3600

View File

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