Merge pull request 'добавление в инфраструктуру livekit' (#31) from alex_chevski/eatvio-infra:feat-video-livekit-service into main

Reviewed-on: eatvio/eatvio-infra#31
Reviewed-by: Анатолий Полоз <t0ly.od@ya.ru>
This commit is contained in:
2026-03-05 09:15:17 +00:00
6 changed files with 257 additions and 167 deletions

View File

@@ -17,3 +17,11 @@ PROD_DB_FILE="latest-prod-db.sql"
PROD_DB_HOST="10.nn.n.n"
PROD_DB_PORT="10nn"
MY_APP_GIT_URL="ssh://git@10.55.5.123:222/eatvio/eatvio.git"
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

@@ -184,4 +184,3 @@ pull-services:
docker compose pull
force-rebuild-services: stop rebuild-services pull-services start

View File

@@ -23,6 +23,8 @@ services:
networks:
- ns-eatvio
restart: always
labels:
- "traefik.enable=false"
mysql:
image: "mysql:8.0"
@@ -37,6 +39,7 @@ services:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
TZ: "Evrope/Moscow"
ports:
- "1094:3306"
labels:
@@ -119,7 +122,7 @@ services:
labels:
- "traefik.docker.network=web"
- "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.protocol=http"
@@ -131,23 +134,79 @@ services:
- ns-eatvio
typesense:
image: typesense/typesense:29.0
build: ./phpdocker/typesense
restart: always
healthcheck:
test:
- CMD
- wget
- "--no-verbose"
- "--spider"
- "http://localhost:8108/health"
test: ["CMD", "curl", "-f", "http://localhost:8108/health"]
networks:
- ns-eatvio
volumes:
- ./typesense-data:/data
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:
web:
external: true
ns-eatvio:
external: false
volumes:
livekit_redis_data:

View File

@@ -1,4 +1,5 @@
<html>
<head>
<title>PHPDocker.io Readme</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
@@ -12,6 +13,7 @@
}
</style>
</head>
<body>
<div class="pure-g">
@@ -21,14 +23,18 @@
<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
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
<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,
<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>
@@ -36,16 +42,20 @@ the php.ini overrides and nginx config on <code>docker-compose.yml</code> if you
<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>
<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
<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
<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>
@@ -99,42 +109,53 @@ add your own hostname on your <code>/etc/hosts</code></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.
<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
<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
<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>
</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
<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
<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
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
<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
<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>
@@ -187,11 +208,13 @@ xdebug.start_with_request = yes
<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. *
<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>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>
@@ -205,4 +228,5 @@ docker-compose.yml</li>
}
</script>
</body>
</html>

View File

@@ -139,6 +139,3 @@ environment:
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

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/*