chore(appstore): add Yamtrack Redis digest version

This commit is contained in:
okxlin
2026-10-19 10:25:32 +08:00
parent 289d5d0691
commit a4d01fe563
7 changed files with 272 additions and 0 deletions
@@ -0,0 +1,7 @@
CONTAINER_NAME=yamtrack
PANEL_APP_BIND_ADDRESS=127.0.0.1
PANEL_APP_PORT_HTTP=8000
APP_DATA_DIR=./data
YAMTRACK_SECRET=generate
YAMTRACK_TIMEZONE=UTC
YAMTRACK_REGISTRATION=True
@@ -0,0 +1,104 @@
additionalProperties:
formFields:
- default: 127.0.0.1
edit: true
envKey: PANEL_APP_BIND_ADDRESS
labelEn: Bind Address
labelZh: 绑定地址
label:
en: Bind Address
zh: 绑定地址
zh-Hant: 綁定位址
ja: バインドアドレス
ko: 바인드 주소
ru: Адрес привязки
ms: Alamat ikatan
pt-br: Endereco de vinculacao
required: true
type: text
- default: 8000
edit: true
envKey: PANEL_APP_PORT_HTTP
labelEn: HTTP Port
labelZh: HTTP 端口
label:
en: HTTP Port
zh: HTTP 端口
zh-Hant: HTTP 埠
ja: HTTP ポート
ko: HTTP 포트
ru: HTTP-порт
ms: Port HTTP
pt-br: Porta HTTP
required: true
rule: paramPort
type: number
- default: ./data
edit: true
envKey: APP_DATA_DIR
labelEn: Data Directory
labelZh: 数据目录
label:
en: Data Directory
zh: 数据目录
zh-Hant: 資料目錄
ja: データディレクトリ
ko: 데이터 디렉터리
ru: Каталог данных
ms: Direktori data
pt-br: Diretorio de dados
required: true
type: text
- default: generate
edit: true
envKey: YAMTRACK_SECRET
labelEn: Application Secret
labelZh: 应用密钥
label:
en: Application Secret
zh: 应用密钥
zh-Hant: 應用程式金鑰
ja: アプリケーションシークレット
ko: 애플리케이션 비밀 키
ru: Секрет приложения
ms: Rahsia aplikasi
pt-br: Segredo do aplicativo
required: true
type: password
- default: UTC
edit: true
envKey: YAMTRACK_TIMEZONE
labelEn: Timezone
labelZh: 时区
label:
en: Timezone
zh: 时区
zh-Hant: 時區
ja: タイムゾーン
ko: 시간대
ru: Часовой пояс
ms: Zon waktu
pt-br: Fuso horario
required: true
type: text
- default: "True"
edit: true
envKey: YAMTRACK_REGISTRATION
labelEn: Allow Registration
labelZh: 允许用户注册
label:
en: Allow Registration
zh: 允许用户注册
zh-Hant: 允許使用者註冊
ja: ユーザー登録を許可
ko: 사용자 등록 허용
ru: Разрешить регистрацию
ms: Benarkan pendaftaran
pt-br: Permitir cadastro
required: true
type: select
values:
- label: "True"
value: "True"
- label: "False"
value: "False"
@@ -0,0 +1,59 @@
services:
yamtrack:
image: "ghcr.io/fuzzygrim/yamtrack:0.26.3@sha256:78497b454b2b52d3b1062f6fd238351d714cff0895db4369e49ace36f4622e75"
container_name: ${CONTAINER_NAME}
restart: unless-stopped
depends_on:
yamtrack-redis:
condition: service_healthy
networks:
- 1panel-network
- yamtrack-internal
ports:
- "${PANEL_APP_BIND_ADDRESS}:${PANEL_APP_PORT_HTTP}:8000"
environment:
- TZ=${YAMTRACK_TIMEZONE}
- SECRET=${YAMTRACK_SECRET}
- REDIS_URL=redis://yamtrack-redis:6379
- REGISTRATION=${YAMTRACK_REGISTRATION}
- PUID=1000
- PGID=1000
- SOCIAL_PROVIDERS=
- SOCIALACCOUNT_ONLY=False
volumes:
- "${APP_DATA_DIR}/yamtrack:/yamtrack/db"
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:8000/health/ || exit 1"]
interval: 10s
timeout: 10s
retries: 5
start_period: 60s
security_opt:
- no-new-privileges:true
labels:
createdBy: "Apps"
yamtrack-redis:
image: "redis:8-alpine@sha256:3811787313eba226a2ef38658c6ccb91cd5e110edc89c37767de373120a0e5a0"
container_name: ${CONTAINER_NAME}-redis
restart: unless-stopped
networks:
- yamtrack-internal
volumes:
- "${APP_DATA_DIR}/redis:/data"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
security_opt:
- no-new-privileges:true
labels:
createdBy: "Apps"
networks:
1panel-network:
external: true
yamtrack-internal:
internal: true
+93
View File
@@ -0,0 +1,93 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
ENV_FILE="${ENV_FILE:-${ROOT_DIR}/.env}"
fail() {
printf '%s\n' "$1" >&2
exit 1
}
read_env_value() {
local key="$1"
local value=""
value="$(sed -n "s/^${key}=//p" "$ENV_FILE" | tail -n 1)"
case "$value" in
\"*\") value="${value#\"}"; value="${value%\"}" ;;
\'*\') value="${value#\'}"; value="${value%\'}" ;;
esac
printf '%s\n' "$value"
}
set_env_value() {
local key="$1"
local value="$2"
local temp_file
temp_file="$(mktemp "${ROOT_DIR}/.yamtrack-env.tmp.XXXXXX")"
awk -v key="$key" -v value="$value" '
BEGIN { written = 0 }
$0 ~ "^" key "=" {
if (!written) {
print key "=" value
written = 1
}
next
}
{ print }
END {
if (!written) print key "=" value
}
' "$ENV_FILE" > "$temp_file"
chmod 600 "$temp_file"
mv -f -- "$temp_file" "$ENV_FILE"
}
[[ -f "$ENV_FILE" ]] || fail "$ENV_FILE not found"
[[ ! -L "$ENV_FILE" ]] || fail "$ENV_FILE must not be a symbolic link"
data_dir_raw="$(read_env_value APP_DATA_DIR)"
[[ -n "$data_dir_raw" ]] || data_dir_raw="./data"
case "$data_dir_raw" in
/*) fail "APP_DATA_DIR must be relative to the application version directory" ;;
*$'\n'* | *$'\r'* | *\\* | *'$'* | *'#'* | *'"'* | *"'") fail "APP_DATA_DIR contains unsupported characters" ;;
esac
data_dir_abs="$(realpath -m -- "${ROOT_DIR}/${data_dir_raw#./}")"
case "$data_dir_abs" in
"${ROOT_DIR}"/*) ;;
*) fail "APP_DATA_DIR must stay inside the application version directory" ;;
esac
[[ "$data_dir_abs" != "/" ]] || fail "APP_DATA_DIR must not be the filesystem root"
[[ ! -e "$data_dir_abs" || -d "$data_dir_abs" ]] || fail "APP_DATA_DIR must be a directory"
timezone="$(read_env_value YAMTRACK_TIMEZONE)"
[[ "$timezone" =~ ^[A-Za-z0-9_+/-]+$ ]] || fail "YAMTRACK_TIMEZONE is invalid"
registration="$(read_env_value YAMTRACK_REGISTRATION)"
[[ "$registration" == "True" || "$registration" == "False" ]] || fail "YAMTRACK_REGISTRATION must be True or False"
secret="$(read_env_value YAMTRACK_SECRET)"
if [[ -z "$secret" || "$secret" == "generate" ]]; then
command -v openssl >/dev/null 2>&1 || fail "openssl is required to generate YAMTRACK_SECRET"
secret="$(openssl rand -hex 32)"
fi
[[ ${#secret} -ge 50 ]] || fail "YAMTRACK_SECRET must contain at least 50 characters"
[[ "$secret" =~ ^[A-Za-z0-9._~!@%+=:,/-]+$ ]] || fail "YAMTRACK_SECRET contains unsupported dotenv characters"
install -d -m 0750 -- "$data_dir_abs" "$data_dir_abs/yamtrack" "$data_dir_abs/redis"
resolved_data_dir="$(realpath -e -- "$data_dir_abs")"
case "$resolved_data_dir" in
"${ROOT_DIR}"/*) ;;
*) fail "APP_DATA_DIR resolves outside the application version directory" ;;
esac
if [[ "$(id -u)" -eq 0 ]]; then
chown 1000:1000 "$data_dir_abs/yamtrack"
chown 999:1000 "$data_dir_abs/redis"
else
[[ "$(stat -c '%u:%g' "$data_dir_abs/yamtrack")" == "1000:1000" ]] || fail "Yamtrack init must run as root to prepare the data directory"
[[ "$(stat -c '%u:%g' "$data_dir_abs/redis")" == "999:1000" ]] || fail "Yamtrack init must run as root to prepare the Redis directory"
fi
chmod 750 "$data_dir_abs/yamtrack" "$data_dir_abs/redis"
set_env_value YAMTRACK_SECRET "$secret"
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
docker-compose down
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
exec "${SCRIPT_DIR}/init.sh"