diff --git a/apps/flipt/2.14.1/docker-compose.yml b/apps/flipt/2.14.1/docker-compose.yml index 984c84897..be1b3b113 100644 --- a/apps/flipt/2.14.1/docker-compose.yml +++ b/apps/flipt/2.14.1/docker-compose.yml @@ -1,6 +1,6 @@ services: flipt: - image: "docker.flipt.io/flipt/flipt:v2.14.2" + image: "docker.flipt.io/flipt/flipt:v2.14.1" container_name: ${CONTAINER_NAME} restart: unless-stopped networks: diff --git a/apps/flipt/2.14.2/.env.sample b/apps/flipt/2.14.2/.env.sample new file mode 100644 index 000000000..884b74a5f --- /dev/null +++ b/apps/flipt/2.14.2/.env.sample @@ -0,0 +1,4 @@ +PANEL_APP_PORT_HTTP=8080 +PANEL_APP_PORT_GRPC=9000 +APP_DATA_DIR=./data +CONTAINER_NAME=flipt diff --git a/apps/flipt/2.14.2/data.yml b/apps/flipt/2.14.2/data.yml new file mode 100644 index 000000000..52ac09321 --- /dev/null +++ b/apps/flipt/2.14.2/data.yml @@ -0,0 +1,52 @@ +additionalProperties: + formFields: + - default: 8080 + 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: 9000 + edit: true + envKey: PANEL_APP_PORT_GRPC + labelEn: gRPC Port + labelZh: gRPC 端口 + label: + en: gRPC Port + zh: gRPC 端口 + zh-Hant: gRPC 連接埠 + ja: gRPC ポート + ko: gRPC 포트 + ru: Порт gRPC + ms: Port gRPC + pt-br: Porta gRPC + 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: Diretório de dados + required: true + type: text diff --git a/apps/flipt/2.14.2/docker-compose.yml b/apps/flipt/2.14.2/docker-compose.yml new file mode 100644 index 000000000..984c84897 --- /dev/null +++ b/apps/flipt/2.14.2/docker-compose.yml @@ -0,0 +1,30 @@ +services: + flipt: + image: "docker.flipt.io/flipt/flipt:v2.14.2" + container_name: ${CONTAINER_NAME} + restart: unless-stopped + networks: + - 1panel-network + ports: + - "${PANEL_APP_PORT_HTTP}:8080" + - "${PANEL_APP_PORT_GRPC}:9000" + environment: + - FLIPT_STORAGE_DEFAULT_BACKEND_TYPE=local + - FLIPT_STORAGE_DEFAULT_BACKEND_PATH=/var/opt/flipt/storage + - FLIPT_META_STATE_DIRECTORY=/var/opt/flipt/state + - FLIPT_META_CHECK_FOR_UPDATES=false + - FLIPT_META_TELEMETRY_ENABLED=false + volumes: + - "${APP_DATA_DIR}:/var/opt/flipt" + healthcheck: + test: ["CMD-SHELL", "wget --spider -q http://127.0.0.1:8080/health || exit 1"] + interval: 10s + timeout: 5s + start_period: 20s + retries: 10 + labels: + createdBy: "Apps" + +networks: + 1panel-network: + external: true diff --git a/apps/flipt/2.14.2/scripts/init.sh b/apps/flipt/2.14.2/scripts/init.sh new file mode 100755 index 000000000..a85557e48 --- /dev/null +++ b/apps/flipt/2.14.2/scripts/init.sh @@ -0,0 +1,86 @@ +#!/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 +} + +strip_matching_quotes() { + local value="$1" + + if [[ ${#value} -ge 2 ]]; then + if [[ "${value:0:1}" == '"' && "${value: -1}" == '"' ]]; then + value="${value:1:${#value}-2}" + elif [[ "${value:0:1}" == "'" && "${value: -1}" == "'" ]]; then + value="${value:1:${#value}-2}" + fi + fi + printf '%s\n' "$value" +} + +read_env_value() { + local key="$1" + local value="" + + if [[ -f "$ENV_FILE" ]]; then + value="$(grep -E "^${key}=" "$ENV_FILE" | tail -n 1 | cut -d '=' -f 2- || true)" + fi + strip_matching_quotes "$value" +} + +path_is_dotenv_safe() { + local value="$1" + + case "$value" in + *$'\n'* | *$'\r'* | *\\* | *'$'* | *'#'* | *'"'* | *"'"*) return 1 ;; + *) return 0 ;; + esac +} + +[[ -f "$ENV_FILE" ]] || fail "$ENV_FILE not found" +[[ ! -L "$ENV_FILE" ]] || fail "$ENV_FILE must not be a symbolic link" + +if [[ ${APP_DATA_DIR+x} ]]; then + APP_DATA_DIR_RAW="$APP_DATA_DIR" +else + APP_DATA_DIR_RAW="$(read_env_value APP_DATA_DIR)" +fi +APP_DATA_DIR_RAW="$(strip_matching_quotes "${APP_DATA_DIR_RAW:-./data}")" + +[[ -n "$APP_DATA_DIR_RAW" ]] || fail "APP_DATA_DIR must not be empty" +path_is_dotenv_safe "$APP_DATA_DIR_RAW" || fail "APP_DATA_DIR contains unsupported dotenv characters" + +case "$APP_DATA_DIR_RAW" in + /*) + APP_DATA_DIR_ABS="$(realpath -m -- "$APP_DATA_DIR_RAW")" + ;; + *) + APP_DATA_DIR_ABS="$(realpath -m -- "${ROOT_DIR}/${APP_DATA_DIR_RAW#./}")" + case "$APP_DATA_DIR_ABS" in + "${ROOT_DIR}" | "${ROOT_DIR}"/*) ;; + *) fail "Relative APP_DATA_DIR must stay inside the application directory" ;; + esac + ;; +esac + +[[ "$APP_DATA_DIR_ABS" != "/" ]] || fail "APP_DATA_DIR must not be the filesystem root" +[[ ! -L "$APP_DATA_DIR_ABS" ]] || fail "APP_DATA_DIR must not be a symbolic link" +if [[ -e "$APP_DATA_DIR_ABS" && ! -d "$APP_DATA_DIR_ABS" ]]; then + fail "APP_DATA_DIR must be a directory" +fi +mkdir -p -- "$APP_DATA_DIR_ABS" + +for directory in storage state; do + target="${APP_DATA_DIR_ABS}/${directory}" + [[ ! -L "$target" ]] || fail "$target must not be a symbolic link" + if [[ -e "$target" && ! -d "$target" ]]; then + fail "$target must be a directory" + fi + mkdir -p -- "$target" + chown 100:1000 -- "$target" + chmod 700 -- "$target" +done diff --git a/apps/flipt/2.14.2/scripts/uninstall.sh b/apps/flipt/2.14.2/scripts/uninstall.sh new file mode 100755 index 000000000..5a3f6bd6b --- /dev/null +++ b/apps/flipt/2.14.2/scripts/uninstall.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail + +if command -v docker-compose >/dev/null 2>&1; then + docker-compose down --volumes --remove-orphans +else + docker compose down --volumes --remove-orphans +fi diff --git a/apps/flipt/2.14.2/scripts/upgrade.sh b/apps/flipt/2.14.2/scripts/upgrade.sh new file mode 100755 index 000000000..593b31667 --- /dev/null +++ b/apps/flipt/2.14.2/scripts/upgrade.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" +exec bash "${SCRIPT_DIR}/init.sh"