Update app version [skip ci]

This commit is contained in:
github-action update-app-version
2026-11-20 16:32:31 +00:00
parent b61672969f
commit ebcb8595fb
7 changed files with 354 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
services:
databunker:
image: "securitybunker/databunker:0.8.39"
image: "securitybunker/databunker:0.8.38"
container_name: ${CONTAINER_NAME}
restart: unless-stopped
entrypoint:
+11
View File
@@ -0,0 +1,11 @@
CONTAINER_NAME=databunker-compose-check
PANEL_DB_TYPE=mysql
PANEL_DB_HOST=mysql
PANEL_DB_PORT=3306
PANEL_DB_NAME=databunker
PANEL_DB_USER=databunker
PANEL_DB_USER_PASSWORD=replace-with-a-strong-database-password
DATABUNKER_MASTER_KEY=replace-with-48-hex-characters
DATABUNKER_ROOTTOKEN=replace-with-a-uuid
PANEL_APP_PORT_HTTP=3000
APP_DATA_DIR=./data
+174
View File
@@ -0,0 +1,174 @@
additionalProperties:
formFields:
- default: mysql
edit: true
envKey: PANEL_DB_TYPE
labelEn: Database Service
labelZh: 数据库服务
label:
en: Database Service
zh: 数据库服务
zh-Hant: 資料庫服務
ja: データベースサービス
ko: 데이터베이스 서비스
ru: Сервис базы данных
ms: Perkhidmatan Pangkalan Data
pt-br: Servico de banco de dados
required: true
type: apps
values:
- label: MySQL
value: mysql
child:
default: ""
envKey: PANEL_DB_HOST
labelEn: MySQL Service
labelZh: MySQL 服务
label:
en: MySQL Service
zh: MySQL 服务
zh-Hant: MySQL 服務
ja: MySQL サービス
ko: MySQL 서비스
ru: Сервис MySQL
ms: Perkhidmatan MySQL
pt-br: Servico MySQL
required: true
type: service
- default: 3306
edit: true
envKey: PANEL_DB_PORT
labelEn: Database Port
labelZh: 数据库端口
label:
en: Database Port
zh: 数据库端口
zh-Hant: 資料庫連接埠
ja: データベースポート
ko: 데이터베이스 포트
ru: Порт базы данных
ms: Port Pangkalan Data
pt-br: Porta do banco de dados
required: true
type: number
- default: databunker
edit: true
envKey: PANEL_DB_NAME
labelEn: Database Name
labelZh: 数据库名
label:
en: Database Name
zh: 数据库名
zh-Hant: 資料庫名稱
ja: データベース名
ko: 데이터베이스 이름
ru: Имя базы данных
ms: Nama Pangkalan Data
pt-br: Nome do banco de dados
random: true
required: true
rule: paramCommon
type: text
- default: databunker
edit: true
envKey: PANEL_DB_USER
labelEn: Database User
labelZh: 数据库用户
label:
en: Database User
zh: 数据库用户
zh-Hant: 資料庫使用者
ja: データベースユーザー
ko: 데이터베이스 사용자
ru: Пользователь базы данных
ms: Pengguna Pangkalan Data
pt-br: Usuario do banco de dados
random: true
required: true
rule: paramCommon
type: text
- default: ""
edit: true
envKey: PANEL_DB_USER_PASSWORD
labelEn: Database Password
labelZh: 数据库密码
label:
en: Database Password
zh: 数据库密码
zh-Hant: 資料庫密碼
ja: データベースパスワード
ko: 데이터베이스 비밀번호
ru: Пароль базы данных
ms: Kata Laluan Pangkalan Data
pt-br: Senha do banco de dados
random: true
required: true
rule: paramComplexity
type: password
- default: ""
edit: true
envKey: DATABUNKER_MASTER_KEY
labelEn: Encryption Master Key
labelZh: 加密主密钥
label:
en: Encryption Master Key
zh: 加密主密钥
zh-Hant: 加密主金鑰
ja: 暗号化マスターキー
ko: 암호화 마스터 키
ru: Главный ключ шифрования
ms: Kunci Induk Penyulitan
pt-br: Chave mestra de criptografia
random: true
required: true
type: password
- default: ""
edit: true
envKey: DATABUNKER_ROOTTOKEN
labelEn: Root API Token
labelZh: 根 API 令牌
label:
en: Root API Token
zh: 根 API 令牌
zh-Hant: 根 API 權杖
ja: ルート API トークン
ko: 루트 API 토큰
ru: Корневой токен API
ms: Token API Akar
pt-br: Token raiz da API
random: true
required: true
type: password
- default: 3000
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
+33
View File
@@ -0,0 +1,33 @@
services:
databunker:
image: "securitybunker/databunker:0.8.39"
container_name: ${CONTAINER_NAME}
restart: unless-stopped
entrypoint:
- /bin/busybox
- sh
- -ec
command:
- |
/databunker/bin/databunker -init -db "$${PANEL_DB_NAME}" -conf /databunker/conf/databunker.yaml
exec /databunker/bin/databunker -start -db "$${PANEL_DB_NAME}" -conf /databunker/conf/databunker.yaml
environment:
- DATABUNKER_MASTERKEY=${DATABUNKER_MASTER_KEY}
- DATABUNKER_ROOTTOKEN=${DATABUNKER_ROOTTOKEN}
- MYSQL_USER_NAME=${PANEL_DB_USER}
- MYSQL_USER_PASS=${PANEL_DB_USER_PASSWORD}
- MYSQL_HOST=${PANEL_DB_HOST}
- MYSQL_PORT=${PANEL_DB_PORT}
- PANEL_DB_NAME=${PANEL_DB_NAME}
ports:
- "${PANEL_APP_PORT_HTTP}:3000"
volumes:
- "${APP_DATA_DIR}/runtime:/databunker/data"
networks:
- 1panel-network
labels:
createdBy: "Apps"
networks:
1panel-network:
external: true
+125
View File
@@ -0,0 +1,125 @@
#!/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" value
value="$(awk -v key="${key}" 'index($0, key "=") == 1 { value = substr($0, length(key) + 2) } END { print value }' "${ENV_FILE}")"
if [[ ${#value} -ge 2 && "${value:0:1}" == "${value: -1}" && "${value:0:1}" =~ [\"\'] ]]; then
value="${value:1:${#value}-2}"
fi
printf '%s\n' "${value}"
}
write_env_value() {
local key="$1" value="$2" temp_file
temp_file="$(mktemp "${ENV_FILE}.tmp.XXXXXX")"
awk -v key="${key}" -v value="${value}" '
BEGIN { written = 0 }
index($0, key "=") == 1 {
if (!written) { print key "=" value; written = 1 }
next
}
{ print }
END { if (!written) print key "=" value }
' "${ENV_FILE}" >"${temp_file}"
chmod --reference="${ENV_FILE}" "${temp_file}"
mv -f -- "${temp_file}" "${ENV_FILE}"
}
generate_master_key() {
od -An -N24 -tx1 /dev/urandom | tr -d ' \n'
}
generate_root_token() {
[[ -r /proc/sys/kernel/random/uuid ]] || fail "The host UUID generator is unavailable"
tr 'A-F' 'a-f' </proc/sys/kernel/random/uuid
}
write_secret_file() {
local path="$1" value="$2" temp_file
temp_file="$(mktemp "${path}.tmp.XXXXXX")"
chmod 0600 "${temp_file}"
printf '%s\n' "${value}" >"${temp_file}"
mv -f -- "${temp_file}" "${path}"
}
[[ -f "${ENV_FILE}" && ! -L "${ENV_FILE}" ]] || fail "${ENV_FILE} must be a regular file"
chmod 0600 -- "${ENV_FILE}"
command -v realpath >/dev/null 2>&1 || fail "realpath is required"
command -v od >/dev/null 2>&1 || fail "od is required"
data_raw="$(read_env_value APP_DATA_DIR)"
data_raw="${data_raw:-./data}"
case "${data_raw}" in
*$'\n'* | *$'\r'* | *\$\(* | *\`*) fail "APP_DATA_DIR contains unsupported characters" ;;
esac
case "${data_raw}" in
/*) data_dir="$(realpath -m -- "${data_raw}")" ;;
*)
data_dir="$(realpath -m -- "${ROOT_DIR}/${data_raw#./}")"
[[ "${data_dir}" == "${ROOT_DIR}/"* ]] || fail "Relative APP_DATA_DIR must stay inside the application directory"
;;
esac
[[ "${data_dir}" != / && "${data_dir}" != "${ROOT_DIR}" ]] || fail "APP_DATA_DIR must not be a filesystem or application root"
[[ ! -L "${data_dir}" ]] || fail "APP_DATA_DIR must not be a symbolic link"
credentials_dir="${data_dir}/credentials"
runtime_dir="${data_dir}/runtime"
for path in "${credentials_dir}" "${runtime_dir}"; do
[[ ! -L "${path}" ]] || fail "${path} must not be a symbolic link"
done
umask 077
mkdir -p -- "${credentials_dir}" "${runtime_dir}"
chmod 0700 "${credentials_dir}"
chmod 0750 "${runtime_dir}"
chown 100:101 "${runtime_dir}"
master_file="${credentials_dir}/master-key"
root_file="${credentials_dir}/root-token"
master_key=""
root_token=""
if [[ -e "${master_file}" || -L "${master_file}" ]]; then
[[ -f "${master_file}" && ! -L "${master_file}" ]] || fail "${master_file} must be a regular file"
master_key="$(<"${master_file}")"
[[ "${master_key}" =~ ^[0-9A-Fa-f]{48}$ ]] || fail "${master_file} contains an invalid DataBunker master key"
fi
if [[ -z "${master_key}" ]]; then
master_key="$(read_env_value DATABUNKER_MASTER_KEY)"
[[ "${master_key}" =~ ^[0-9A-Fa-f]{48}$ ]] || master_key="$(generate_master_key)"
fi
[[ "${master_key}" =~ ^[0-9a-f]{48}$ ]] || master_key="$(printf '%s' "${master_key}" | tr 'A-F' 'a-f')"
[[ "${master_key}" =~ ^[0-9a-f]{48}$ ]] || fail "Could not create a valid DataBunker master key"
if [[ -e "${root_file}" || -L "${root_file}" ]]; then
[[ -f "${root_file}" && ! -L "${root_file}" ]] || fail "${root_file} must be a regular file"
root_token="$(<"${root_file}")"
[[ "${root_token}" =~ ^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[1-5][0-9A-Fa-f]{3}-[89AaBb][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$ ]] || fail "${root_file} contains an invalid DataBunker root token"
fi
if [[ -z "${root_token}" ]]; then
root_token="$(read_env_value DATABUNKER_ROOTTOKEN)"
if [[ ! "${root_token}" =~ ^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[1-5][0-9A-Fa-f]{3}-[89AaBb][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$ ]]; then
root_token="$(generate_root_token)"
fi
fi
root_token="$(printf '%s' "${root_token}" | tr 'A-F' 'a-f')"
[[ "${root_token}" =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ ]] || fail "Could not create a valid DataBunker root token"
write_secret_file "${master_file}" "${master_key}"
write_secret_file "${root_file}" "${root_token}"
write_env_value DATABUNKER_MASTER_KEY "${master_key}"
write_env_value DATABUNKER_ROOTTOKEN "${root_token}"
printf '%s\n' "DataBunker credentials are stored in the configured data directory."
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
# 1Panel owns container and linked-database removal. Preserve user data by default.
exit 0
+5
View File
@@ -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"