Retire review deploy and add live Actions
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
services:
|
||||
importarr:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: Dockerfile
|
||||
image: ${REVIEW_IMAGE:-importarr-review:local}
|
||||
env_file:
|
||||
- ${REVIEW_SERVICE_ENV_FILE:-importarr.review.env.example}
|
||||
ports:
|
||||
- "${REVIEW_BIND_ADDRESS:-127.0.0.1}:${REVIEW_PORT:-18765}:8765"
|
||||
volumes:
|
||||
- ../.review-data/config:/config
|
||||
- ../.review-data/downloads:/data/downloads/manual
|
||||
- ../.review-data/movies:/data/movies
|
||||
- ../.review-data/tv:/data/tv
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8765/health', timeout=2)"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 6
|
||||
start_period: 5s
|
||||
@@ -16,6 +16,3 @@ IMPORTARR_LOG_LEVEL=info
|
||||
IMPORTARR_BIND_HOST=0.0.0.0
|
||||
IMPORTARR_BIND_PORT=8765
|
||||
IMPORTARR_POLL_SECONDS=60
|
||||
# IMPORTARR_REPO_DIR=/path/to/importarr
|
||||
# Override only when the installed helper is not at the standard systemd path.
|
||||
# IMPORTARR_UPDATE_COMMAND=/bin/sh /opt/importarr/repo-upgrade.sh
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# Copied to importarr.review.env by deploy/review/review.sh. No secrets or
|
||||
# external services are required for review.
|
||||
REVIEW_PORT=18765
|
||||
# Keep this on loopback unless review access from a trusted network is needed.
|
||||
REVIEW_BIND_ADDRESS=127.0.0.1
|
||||
IMPORTARR_BIND_HOST=0.0.0.0
|
||||
IMPORTARR_BIND_PORT=8765
|
||||
IMPORTARR_STATE_PATH=/config/importarr.db
|
||||
IMPORTARR_DOWNLOAD_ROOT=/data/downloads/manual
|
||||
IMPORTARR_MOVIES_ROOT=/data/movies
|
||||
IMPORTARR_TV_ROOT=/data/tv
|
||||
IMPORTARR_SAB_URL=http://127.0.0.1:9
|
||||
IMPORTARR_SAB_CATEGORY=review
|
||||
IMPORTARR_POLL_SECONDS=3600
|
||||
IMPORTARR_LOG_LEVEL=info
|
||||
|
||||
# UI control operations must not control host services or update this checkout.
|
||||
IMPORTARR_START_COMMAND=/bin/true
|
||||
IMPORTARR_STOP_COMMAND=/bin/true
|
||||
IMPORTARR_RESTART_COMMAND=/bin/true
|
||||
IMPORTARR_UPDATE_COMMAND=/bin/true
|
||||
IMPORTARR_UPDATE_RELEASE_URL=http://127.0.0.1:9/releases/latest
|
||||
IMPORTARR_UPDATE_CHECK_TIMEOUT_SECONDS=1
|
||||
+10
-13
@@ -2,7 +2,7 @@
|
||||
set -eu
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Run as root: sudo sh /opt/importarr/repo-upgrade.sh vMAJOR.MINOR.PATCH" >&2
|
||||
echo "Run as root: sudo sh /opt/importarr/repo-upgrade.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -16,10 +16,8 @@ PREFIX=${IMPORTARR_PREFIX:-/opt/importarr}
|
||||
REPO_DIR=${IMPORTARR_REPO_DIR:-$PREFIX/repo}
|
||||
SERVICE=${IMPORTARR_SERVICE:-importarr.service}
|
||||
VENV=${IMPORTARR_VENV:-$PREFIX/venv}
|
||||
RELEASE_TAG=${1:-}
|
||||
|
||||
if [ -z "$RELEASE_TAG" ]; then
|
||||
echo "Usage: $0 vMAJOR.MINOR.PATCH" >&2
|
||||
if [ "$#" -ne 0 ]; then
|
||||
echo "Usage: $0" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
@@ -42,20 +40,19 @@ if [ -n "$(git status --porcelain)" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git fetch --prune --tags origin
|
||||
if ! git rev-parse --verify --quiet "refs/tags/$RELEASE_TAG" >/dev/null; then
|
||||
echo "Release tag not found: $RELEASE_TAG" >&2
|
||||
exit 1
|
||||
fi
|
||||
git checkout --detach "$RELEASE_TAG"
|
||||
test "$(git describe --tags --exact-match HEAD)" = "$RELEASE_TAG"
|
||||
git fetch --prune origin main
|
||||
git checkout -B main origin/main
|
||||
test "$(git rev-parse HEAD)" = "$(git rev-parse origin/main)"
|
||||
"$VENV/bin/pip" install --upgrade --force-reinstall --no-cache-dir "$REPO_DIR"
|
||||
if [ -f "$ENV_FILE" ]; then
|
||||
sed -i '/^[[:space:]]*IMPORTARR_UPDATE_COMMAND=/d' "$ENV_FILE"
|
||||
fi
|
||||
install -m 0644 "$REPO_DIR/deploy/importarr.service" /etc/systemd/system/importarr.service
|
||||
install -m 0755 "$REPO_DIR/deploy/repo-upgrade.sh" "$PREFIX/repo-upgrade.sh"
|
||||
systemctl daemon-reload
|
||||
GIT_SHA="$(git rev-parse --short=12 HEAD 2>/dev/null || printf development)"
|
||||
BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
VERSION="$RELEASE_TAG"
|
||||
VERSION="$(git rev-parse --short=12 HEAD)"
|
||||
BUILD_ENV_TMP="$PREFIX/build.env.tmp.$$"
|
||||
trap 'rm -f "$BUILD_ENV_TMP"' EXIT HUP INT TERM
|
||||
cat > "$BUILD_ENV_TMP" <<EOF
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
repo_dir=$(CDPATH= cd -- "$script_dir/../.." && pwd)
|
||||
compose_file="$repo_dir/deploy/docker-compose.review.yml"
|
||||
env_file="$repo_dir/deploy/importarr.review.env"
|
||||
env_example="$repo_dir/deploy/importarr.review.env.example"
|
||||
data_dir="$repo_dir/.review-data"
|
||||
repo_name=$(printf '%s' "${repo_dir##*/}" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9_-' '-')
|
||||
repo_id=$(printf '%s' "$repo_dir" | cksum | awk '{print $1}')
|
||||
project_name="importarr-review-${repo_name}-${repo_id}"
|
||||
review_image="${project_name}-importarr:review"
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 {up|update|status|logs|stop|down|reset}" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
command -v docker >/dev/null 2>&1 || {
|
||||
echo "docker is required" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if docker info >/dev/null 2>&1; then
|
||||
docker_with_sudo=false
|
||||
elif command -v sudo >/dev/null 2>&1 && sudo -n docker info >/dev/null 2>&1; then
|
||||
docker_with_sudo=true
|
||||
else
|
||||
echo "cannot access the Docker daemon with docker or sudo -n docker" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
compose() {
|
||||
selected_env_file=$env_example
|
||||
if [ -f "$env_file" ]; then
|
||||
selected_env_file=$env_file
|
||||
fi
|
||||
|
||||
if [ "$docker_with_sudo" = true ]; then
|
||||
sudo -n env REVIEW_IMAGE="$review_image" REVIEW_SERVICE_ENV_FILE="$selected_env_file" \
|
||||
docker compose --project-name "$project_name" --project-directory "$repo_dir/deploy" \
|
||||
--env-file "$selected_env_file" -f "$compose_file" "$@"
|
||||
else
|
||||
REVIEW_IMAGE="$review_image" REVIEW_SERVICE_ENV_FILE="$selected_env_file" \
|
||||
docker compose --project-name "$project_name" --project-directory "$repo_dir/deploy" \
|
||||
--env-file "$selected_env_file" -f "$compose_file" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_env_file() {
|
||||
if [ ! -f "$env_file" ]; then
|
||||
cp "$env_example" "$env_file"
|
||||
echo "Created $env_file from the safe review defaults."
|
||||
fi
|
||||
}
|
||||
|
||||
remove_data() {
|
||||
if rm -rf "$data_dir" 2>/dev/null && [ ! -e "$data_dir" ]; then
|
||||
return
|
||||
fi
|
||||
if [ "$docker_with_sudo" = true ]; then
|
||||
sudo -n rm -rf "$data_dir"
|
||||
else
|
||||
echo "cannot remove root-owned review data without passwordless sudo: $data_dir" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
up|update)
|
||||
ensure_env_file
|
||||
mkdir -p "$data_dir/config" "$data_dir/downloads" "$data_dir/movies" "$data_dir/tv"
|
||||
compose up --detach --build --wait
|
||||
;;
|
||||
status)
|
||||
compose ps
|
||||
container_id=$(compose ps --quiet importarr)
|
||||
[ -n "$container_id" ] || {
|
||||
echo "review service is not running" >&2
|
||||
exit 1
|
||||
}
|
||||
health=$(if [ "$docker_with_sudo" = true ]; then
|
||||
sudo -n docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}' "$container_id"
|
||||
else
|
||||
docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}' "$container_id"
|
||||
fi)
|
||||
[ "$health" = healthy ] || {
|
||||
echo "review service is not healthy (status: $health)" >&2
|
||||
exit 1
|
||||
}
|
||||
;;
|
||||
logs)
|
||||
compose logs --follow --tail=200
|
||||
;;
|
||||
stop)
|
||||
compose stop
|
||||
;;
|
||||
down)
|
||||
compose down --remove-orphans
|
||||
;;
|
||||
reset)
|
||||
compose down --remove-orphans
|
||||
remove_data
|
||||
echo "Removed review data: $data_dir"
|
||||
;;
|
||||
*) usage ;;
|
||||
esac
|
||||
@@ -46,4 +46,4 @@ systemctl enable importarr.service
|
||||
systemctl enable manual-media-import.timer
|
||||
systemctl restart importarr.service
|
||||
systemctl start manual-media-import.timer
|
||||
echo "Importarr installed from $REPO_DIR. Future upgrades: sudo -n sh /opt/importarr/repo-upgrade.sh vMAJOR.MINOR.PATCH"
|
||||
echo "Importarr installed from $REPO_DIR. Future upgrades: sudo -n sh /opt/importarr/repo-upgrade.sh"
|
||||
|
||||
Reference in New Issue
Block a user