Compare commits
No commits in common. "1fc9b08ce9e08072075334031e342fa21c762824" and "f875372f0d25ae9ae4e633b6877658db95a6c51a" have entirely different histories.
1fc9b08ce9
...
f875372f0d
4 changed files with 21 additions and 28 deletions
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
RPH_UID=${RPH_UID:-${UID}}
|
RPH_UID=${RPH_UID:-${UID}}
|
||||||
|
|
||||||
[ "${SUDO}" == "sudo" ] || SUDO=
|
|
||||||
|
|
||||||
# Identify source path (even if symlinked)
|
# Identify source path (even if symlinked)
|
||||||
SOURCE=${BASH_SOURCE[0]}
|
SOURCE=${BASH_SOURCE[0]}
|
||||||
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||||
|
@ -52,7 +50,7 @@ dls() {
|
||||||
local base='{{.Status}}\t{{.ID}}\t{{.Names}}\t{{.Image}}' #'\t{{.Networks}}\t{{.Ports}}\t{{.Mounts}}'
|
local base='{{.Status}}\t{{.ID}}\t{{.Names}}\t{{.Image}}' #'\t{{.Networks}}\t{{.Ports}}\t{{.Mounts}}'
|
||||||
local compose='{{.Label "com.docker.compose.project"}}\t{{.Label "com.docker.compose.service"}}'
|
local compose='{{.Label "com.docker.compose.project"}}\t{{.Label "com.docker.compose.service"}}'
|
||||||
local format="table $compose\t$base"
|
local format="table $compose\t$base"
|
||||||
${SUDO} docker container ls --all --format "$format" | (sed -u '1s/.*/\U&/; q'; sort-tipi)
|
docker container ls --all --format "$format" | (sed -u '1s/.*/\U&/; q'; sort-tipi)
|
||||||
}
|
}
|
||||||
|
|
||||||
get-docker-list() {
|
get-docker-list() {
|
||||||
|
@ -61,7 +59,7 @@ get-docker-list() {
|
||||||
local PP2='s/ ix-/\nix-/g; s/(^|\n)ix-/\1/g;'
|
local PP2='s/ ix-/\nix-/g; s/(^|\n)ix-/\1/g;'
|
||||||
local PP3=''
|
local PP3=''
|
||||||
local PP_SORT='| sort-tipi'
|
local PP_SORT='| sort-tipi'
|
||||||
local SRC="" SRC_DOCKER="${SUDO} docker ps -a --format '{{.Label \"com.docker.compose.project\"}}@{{.Names}}' | sed -Ee 's/^@/<_no-compose-project_>:/;'"
|
local SRC="" SRC_DOCKER="docker ps -a --format '{{.Label \"com.docker.compose.project\"}}@{{.Names}}' | sed -Ee 's/^@/<_no-compose-project_>:/;'"
|
||||||
local FILTER=""
|
local FILTER=""
|
||||||
local LIST=''
|
local LIST=''
|
||||||
local MK_SEARCH_LIST="| xargs -r | sed 's/@//g; s/^/^(/; s/ *$/)@/; s/ /|/g;'"
|
local MK_SEARCH_LIST="| xargs -r | sed 's/@//g; s/^/^(/; s/ *$/)@/; s/ /|/g;'"
|
||||||
|
@ -100,10 +98,10 @@ get-docker-list() {
|
||||||
PP2=''
|
PP2=''
|
||||||
;;
|
;;
|
||||||
ix|truenas)
|
ix|truenas)
|
||||||
LIST="${SUDO} find /mnt/.ix-apps/app_configs/* -maxdepth 0 -printf 'ix-%f@ '"
|
LIST="find /mnt/.ix-apps/app_configs/* -maxdepth 0 -printf 'ix-%f@ '"
|
||||||
;;
|
;;
|
||||||
tp|runtipi)
|
tp|runtipi)
|
||||||
LIST="${SUDO} find apps/* -maxdepth 0 -printf '%f@ ' ; echo runtipi"
|
LIST="find apps/* -maxdepth 0 -printf '%f@ ' ; echo runtipi"
|
||||||
;;
|
;;
|
||||||
other)
|
other)
|
||||||
FILTER="grep -vE \""$(get-docker-list ix -G)"\" | grep -vE \""$(get-docker-list tp -G)"\""
|
FILTER="grep -vE \""$(get-docker-list ix -G)"\" | grep -vE \""$(get-docker-list tp -G)"\""
|
||||||
|
@ -171,7 +169,7 @@ runtipi-app-docker-compose() {
|
||||||
fi
|
fi
|
||||||
local APP="${1:-Must supply app name}"
|
local APP="${1:-Must supply app name}"
|
||||||
|
|
||||||
${SUDO} docker compose \
|
docker compose \
|
||||||
$(append_file_param --env-file user-config/.env.local) \
|
$(append_file_param --env-file user-config/.env.local) \
|
||||||
$(append_file_param --env-file app-data/${APP}/app.env) \
|
$(append_file_param --env-file app-data/${APP}/app.env) \
|
||||||
$(append_file_param --env-file user-config/${APP}/app.env) \
|
$(append_file_param --env-file user-config/${APP}/app.env) \
|
||||||
|
@ -196,18 +194,18 @@ ix-app-docker-compose() {
|
||||||
local APP="${1:-Must supply app name}"
|
local APP="${1:-Must supply app name}"
|
||||||
|
|
||||||
DCSRC="$(
|
DCSRC="$(
|
||||||
${SUDO} find /mnt/.ix-apps/app_configs/ -type f \
|
find /mnt/.ix-apps/app_configs/ -type f \
|
||||||
-path "*/${APP}/*/rendered/docker-compose.yaml" -printf '%T@ %p\n' \
|
-path "*/${APP}/*/rendered/docker-compose.yaml" -printf '%T@ %p\n' \
|
||||||
| sort -n | cut -d' ' -f2- | head -1
|
| sort -n | cut -d' ' -f2- | head -1
|
||||||
)"
|
)"
|
||||||
set -x
|
set -x
|
||||||
${SUDO} docker compose "--file=${DCSRC}" "--project-name=ix-${APP}" ${2:-ps -a} ${3:+"${@:3}"}
|
docker compose "--file=${DCSRC}" "--project-name=ix-${APP}" ${2:-ps -a} ${3:+"${@:3}"}
|
||||||
}
|
}
|
||||||
|
|
||||||
link-exists() {
|
link-exists() {
|
||||||
local EXIT_CODE=0
|
local EXIT_CODE=0
|
||||||
printf 'Current status:\n link: '
|
printf 'Current status:\n link: '
|
||||||
${SUDO} ip -br -c link show "${1:?Must supply device name}" 2>&1 || return 1
|
ip -br -c link show "${1:?Must supply device name}" 2>&1 || return 1
|
||||||
}
|
}
|
||||||
manage-ipvlan() {
|
manage-ipvlan() {
|
||||||
|
|
||||||
|
@ -221,19 +219,19 @@ manage-ipvlan() {
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
rm)
|
rm)
|
||||||
manage-ipvlan status "${IPVLAN_IF}" && ( \
|
manage-ipvlan status "${IPVLAN_IF}" && ( \
|
||||||
${SUDO} ip link delete "${IPVLAN_IF}" \
|
ip link delete "${IPVLAN_IF}" \
|
||||||
&& printf '%s\n' "${IPVLAN_IF} removed"
|
&& printf '%s\n' "${IPVLAN_IF} removed"
|
||||||
) || return 1
|
) || return 1
|
||||||
;;
|
;;
|
||||||
add)
|
add)
|
||||||
link-exists "${IPVLAN_IF}" > /dev/null 2>&1 \
|
link-exists "${IPVLAN_IF}" > /dev/null 2>&1 \
|
||||||
&& link-exists "${IPVLAN_IF}" || ( \
|
&& link-exists "${IPVLAN_IF}" || ( \
|
||||||
${SUDO} ip link add "${IPVLAN_IF}" link "${NET_IF}" type ipvlan mode l2 \
|
ip link add "${IPVLAN_IF}" link "${NET_IF}" type ipvlan mode l2 \
|
||||||
&& ${SUDO} ip addr add ${NET_IP} dev "${IPVLAN_IF}" \
|
&& ip addr add ${NET_IP} dev "${IPVLAN_IF}" \
|
||||||
&& ${SUDO} ip link set "${IPVLAN_IF}" up \
|
&& ip link set "${IPVLAN_IF}" up \
|
||||||
&& printf '%s\n' "${IPVLAN_IF} created"\
|
&& printf '%s\n' "${IPVLAN_IF} created"\
|
||||||
&& link-exists "${IPVLAN_IF}" \
|
&& link-exists "${IPVLAN_IF}" \
|
||||||
|| ${SUDO} ip link delete "${IPVLAN_IF}"
|
|| ip link delete "${IPVLAN_IF}"
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
route)
|
route)
|
||||||
|
@ -243,9 +241,9 @@ manage-ipvlan() {
|
||||||
&& for IP in "${@:3}"; do
|
&& for IP in "${@:3}"; do
|
||||||
# Only add route if it does not already exists
|
# Only add route if it does not already exists
|
||||||
printf 'Adding route for %-15s ' "$IP"
|
printf 'Adding route for %-15s ' "$IP"
|
||||||
${SUDO} ip route get "$IP" 2> /dev/null | grep -q "dev ${IPVLAN_IF} src ${NET_IP//\./\\.}" \
|
ip route get "$IP" 2> /dev/null | grep -q "dev ${IPVLAN_IF} src ${NET_IP//\./\\.}" \
|
||||||
&& printf 'Skipping, already exists.' \
|
&& printf 'Skipping, already exists.' \
|
||||||
|| ${SUDO} ip route add "$IP" dev "${IPVLAN_IF}" \
|
|| ip route add "$IP" dev "${IPVLAN_IF}" \
|
||||||
&& printf '\n' \
|
&& printf '\n' \
|
||||||
|| (printf 'Could NOT add %s\n' "$IP" >&2; return 1)
|
|| (printf 'Could NOT add %s\n' "$IP" >&2; return 1)
|
||||||
done
|
done
|
||||||
|
@ -260,7 +258,7 @@ manage-ipvlan() {
|
||||||
"$(manage-ipvlan status)" "" ""\
|
"$(manage-ipvlan status)" "" ""\
|
||||||
"" "" ""\
|
"" "" ""\
|
||||||
"Usage:" "" ""\
|
"Usage:" "" ""\
|
||||||
" [SUDO=sudo] ${BASE_NAME} ipvlan <command>" "" ""\
|
" ${BASE_NAME} ipvlan <command>" "" ""\
|
||||||
"" "" "" \
|
"" "" "" \
|
||||||
"Available commands:" "" ""\
|
"Available commands:" "" ""\
|
||||||
"" "" "" \
|
"" "" "" \
|
||||||
|
@ -273,7 +271,7 @@ manage-ipvlan() {
|
||||||
|
|
||||||
( printf 'addr: ' && ip -4 -br -c addr show "${IPVLAN_IF}" \
|
( printf 'addr: ' && ip -4 -br -c addr show "${IPVLAN_IF}" \
|
||||||
&& printf 'Routes:\n' \
|
&& printf 'Routes:\n' \
|
||||||
&& ${SUDO} ip -c route show dev "${IPVLAN_IF}" \
|
&& ip -c route show dev "${IPVLAN_IF}" \
|
||||||
| awk '{print} END{if (NR==0) print "<none found>"}'
|
| awk '{print} END{if (NR==0) print "<none found>"}'
|
||||||
) 2>&1 | sed -e '/[^:]$/s/^/ /' \
|
) 2>&1 | sed -e '/[^:]$/s/^/ /' \
|
||||||
|| return 1
|
|| return 1
|
||||||
|
@ -322,14 +320,11 @@ case "${1}" in
|
||||||
edit)
|
edit)
|
||||||
${VISUAL:-${EDITOR:-vi}} $0
|
${VISUAL:-${EDITOR:-vi}} $0
|
||||||
;;
|
;;
|
||||||
_load)
|
|
||||||
echo "alias ${BASE_NAME}cd='cd \"$SCRIPT_DIR/..\"'"
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
printf '%s %-12s %s\n' \
|
printf '%s %-12s %s\n' \
|
||||||
"" "" ""\
|
"" "" ""\
|
||||||
"Usage:" "" ""\
|
"Usage:" "" ""\
|
||||||
" [SUDO=sudo] ${BASE_NAME} <command> [args...]" "" ""\
|
" ${BASE_NAME} <command> [args...]" "" ""\
|
||||||
"" "" "" \
|
"" "" "" \
|
||||||
"Available commands:" "" ""\
|
"Available commands:" "" ""\
|
||||||
"" "" "" \
|
"" "" "" \
|
||||||
|
|
|
@ -7,8 +7,8 @@ http:
|
||||||
entrypoints:
|
entrypoints:
|
||||||
- websecure
|
- websecure
|
||||||
# # If the rule matches, applies the middleware
|
# # If the rule matches, applies the middleware
|
||||||
# middlewares:
|
# middlewares:
|
||||||
# - trustedHeaders
|
# - test-user
|
||||||
# If the rule matches, forward to the whoami service (declared below)
|
# If the rule matches, forward to the whoami service (declared below)
|
||||||
service: home-assistant
|
service: home-assistant
|
||||||
tls:
|
tls:
|
||||||
|
@ -21,4 +21,3 @@ http:
|
||||||
servers:
|
servers:
|
||||||
- url: "http://ha.lan:8123"
|
- url: "http://ha.lan:8123"
|
||||||
#- address: "ha.lan:8123"
|
#- address: "ha.lan:8123"
|
||||||
|
|
|
@ -5,5 +5,4 @@ http:
|
||||||
ipWhiteList:
|
ipWhiteList:
|
||||||
sourceRange:
|
sourceRange:
|
||||||
- "127.0.0.1/32"
|
- "127.0.0.1/32"
|
||||||
- "192.168.0.0/16"
|
- "192.168.0.0/16"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue