Compare commits

...

5 Commits

6 changed files with 37 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
IPTV_ENV=prod
IPTV_ENV=dev
KEYDB_UID=1000
KEYDB_GID=1000

3
.gitignore vendored
View File

@@ -1,7 +1,10 @@
/.idea/
/.vscode/
/docker/keydb/data/*
/log/**/*
/iptvc/
/web/
/docs/
/playlists/
/tools/
/.profile/

View File

@@ -416,7 +416,7 @@ dir /data
# SUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBLISH, PUBSUB,
# COMMAND, POST, HOST: and LATENCY.
#
replica-serve-stale-data yes
replica-serve-stale-data no
# You can configure a replica instance to accept writes or not. Writing against
# a replica instance may be useful to store some ephemeral data (because data
@@ -432,7 +432,7 @@ replica-serve-stale-data yes
# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
# security of read only replicas using 'rename-command' to shadow all the
# administrative / dangerous commands.
replica-read-only yes
replica-read-only no
# Replication SYNC strategy: disk or socket.
#
@@ -505,7 +505,7 @@ repl-diskless-load disabled
# change this interval with the repl_ping_replica_period option. The default
# value is 10 seconds.
#
# repl-ping-replica-period 10
# repl-ping-replica-period 0
# The following option sets the replication timeout for:
#
@@ -517,7 +517,7 @@ repl-diskless-load disabled
# specified for repl-ping-replica-period otherwise a timeout will be detected
# every time there is low traffic between the master and the replica.
#
# repl-timeout 60
# repl-timeout 0
# Disable TCP_NODELAY on the replica socket after SYNC?
#

View File

@@ -16,7 +16,7 @@ RUN apt update && \
RUN pecl channel-update pecl.php.net && \
pecl install redis-6.1.0
RUN docker-php-ext-enable xdebug redis && \
RUN docker-php-ext-enable redis && \
docker-php-ext-configure gd --with-jpeg && \
docker-php-ext-install gd

1
docs

Submodule docs deleted from 3a2eca9e15

38
iptv
View File

@@ -338,6 +338,7 @@ docker.build_base_images() {
# done
subtitle "Построение образов"
docker.compose build
[ ! -d web/cache/views ] && mkdir -p web/cache/views
success "Базовые образы построены"
}
@@ -432,7 +433,7 @@ find_services_compose() {
[ "$*" ] && for svc in "$@"; do
grep_match "$svc" "^--?.*" && continue
svc="$(find_service_compose "$svc")"
svc="$(find_service_compose "${svc/iptv-/}")"
services="$services $svc"
done
@@ -494,12 +495,11 @@ up() {
process_help_arg
subtitle "Создание и запуск контейнеров"
argl profiles 0 profiles
local services=''
[ "$*" ] && services="$(find_services_compose "$@")"
COMPOSE_PROFILES="$profiles" docker.compose up "$services" --build --detach --remove-orphans && \
[ ! -d web/cache/views ] && mkdir -p web/cache/views
docker.compose up "$services" --build --detach --remove-orphans && \
success 'Среда запущена успешно'
}
@@ -522,13 +522,10 @@ down() {
process_help_arg
subtitle "Остановка и удаление контейнеров"
argl profiles 0 profiles
[[ -z "$profiles" ]] && profiles="full"
local services=''
[ "$*" ] && services="$(find_services_compose "$@")"
COMPOSE_PROFILES="$profiles" docker.compose down "$services" --remove-orphans && \
docker.compose down "$services" --remove-orphans && \
success 'Среда остановлена успешно'
}
@@ -554,7 +551,7 @@ rebuild() {
is_full=$(arg full 1)
[ "$is_full" = 0 ] && is_full=$(argl full 1)
[ -n "$*" ] && down "$@"
[ -n "$*" ] && down "$@" || down
[ "$is_full" = 1 ] && docker.build_base_images
up "$@"
@@ -579,6 +576,27 @@ purge() {
success 'Образы удалены успешно'
}
# Выполняет команду в контейнере
exec() {
process_help_arg
as_root=0
svc="$1"
regex_match "$svc" "--?r(oot)?" && { as_root=1; shift; svc="$1"; }
svc_correct="iptv-$(find_service_compose "$svc")"
command=("${@:2}")
regex_match "${command[0]}" "--?r(oot)?" && { as_root=1; unset "command[0]"; }
[[ -z "${command[*]}" ]] && die "не указана команда для выполнения в контейнере"
#TODO многострочные команды прокидываются корректно, но выполняется только первая строка?
if [[ "$as_root" == 1 ]]; then
docker.exec "$svc_correct" "${command[*]}"
else
docker.exec_www "$svc_correct" "${command[*]}"
fi
}
# Выводит логи сервиса
logs() {
process_help_arg
@@ -602,7 +620,6 @@ stats() {
docker.compose stats "$@"
}
########################################################
# Команды справки
########################################################
@@ -827,6 +844,7 @@ case "$COMMAND" in
stop ) stop "$@" ;;
r|rebuild ) rebuild "$@" ;;
restart ) restart "$@" ;;
exec ) exec "$@" ;;
purge ) purge ;;
logs ) logs "$@" ;;
stats ) stats "$@" ;;