mirror of
https://gitlab.com/Snogard/kaido.git
synced 2025-06-25 02:13:00 +02:00
added aria-rpc install and config
This commit is contained in:
parent
3fd2ae7eaa
commit
e03a15d752
16
src/commands/config/config-aria-rpc.sh
Executable file
16
src/commands/config/config-aria-rpc.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
# docs https://gist.github.com/rudylacrete/dcd9779175fe18731852
|
||||
|
||||
containerName=aria-rpc
|
||||
|
||||
srcConfigPath=/etc/kaido/containers/$containerName/config
|
||||
dstConfigPath=/mnt/storage/containers/$containerName/config
|
||||
|
||||
systemctl stop --user $containerName
|
||||
|
||||
# TODO make user id configurable
|
||||
echo "Copy ${srcConfigPath} contents to ${dstConfigPath}"
|
||||
sudo cp -r $srcConfigPath/. $dstConfigPath/
|
||||
sudo chown -R 165533:165533 $dstConfigPath
|
||||
|
||||
systemctl start --user $containerName
|
57
src/commands/install/install-aria-rpc.sh
Executable file
57
src/commands/install/install-aria-rpc.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
source /opt/kaido/src/libs/bash/lib.sh
|
||||
#docs https://github.com/P3TERX/Aria2-Pro-Docker
|
||||
|
||||
# setup
|
||||
imageName=docker.io/p3terx/aria2-pro:202209060423
|
||||
containerName=aria-rpc
|
||||
|
||||
dstConfigPath=/mnt/storage/containers/$containerName/config
|
||||
dstDownloadPath=/mnt/storage/containers/$containerName/downloads
|
||||
|
||||
|
||||
# envs
|
||||
umask_set=111
|
||||
timezone=Europe/Rome
|
||||
logopt=1m
|
||||
external_port=10102
|
||||
internal_port=6800
|
||||
secret_rpc_secret="$containerName-rpc_secret"
|
||||
|
||||
if [ -f "/etc/kaido/containers/$containerName/envs.sh" ]; then
|
||||
source /etc/kaido/containers/$containerName/envs.sh
|
||||
fi
|
||||
|
||||
|
||||
# secrets
|
||||
secret_check $secret_rpc_secret
|
||||
res=$?
|
||||
if [[ $res -gt 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# pre install
|
||||
create_folder "$dstConfigPath"
|
||||
create_folder "$dstDownloadPath"
|
||||
stop_and_remove_container "$containerName"
|
||||
|
||||
|
||||
# install
|
||||
echo "Creating new container"
|
||||
podman create \
|
||||
--name $containerName \
|
||||
--log-opt max-size=$logopt \
|
||||
-p $external_port:$internal_port/tcp \
|
||||
-v $dstConfigPath:/config \
|
||||
-v $dstDownloadPath:/downloads \
|
||||
-e RPC_PORT=$internal_port \
|
||||
-e TZ=$timezone \
|
||||
-e UMASK_SET=$umask_set \
|
||||
--secret $secret_rpc_secret,type=env,target=RPC_SECRET \
|
||||
$imageName
|
||||
|
||||
|
||||
# systemd
|
||||
create_systemd_services $containerName
|
||||
systemctl --user enable --now $containerName
|
@ -83,13 +83,12 @@ echo "current commit: ${currentCommit}"
|
||||
echo "Config:"
|
||||
echo "previus commit: ${previusCommit_config}"
|
||||
echo "current commit: ${currentCommit_config}"
|
||||
echo ""
|
||||
|
||||
|
||||
|
||||
|
||||
# TODO auto secret updates?
|
||||
|
||||
# auto update builds
|
||||
|
||||
# echo -e "Checking if custom images need to be built\n"
|
||||
# for val in $buildList; do
|
||||
# name=${val:5}
|
||||
@ -106,13 +105,14 @@ for val in $installList; do
|
||||
name=${val:8}
|
||||
# TODO support parameters
|
||||
if $(git -C "$root" diff --name-only $previusCommit $currentCommit src/commands/install | grep -qi $name) || \
|
||||
( [ -f "$confdir/containers/$name/envs.sh" ] && $(git -C "$confdir" diff --name-only $previusCommit_config $currentCommit_config "$confdir/containers/$name/envs.sh" | grep -qi "envs\.sh" ) ) || \
|
||||
( [ -d "$confdir/containers/$name/secrets" ] && [ ! $(git -C "$confdir" diff --name-only $previusCommit_config $currentCommit_config "$confdir/containers/$name/secrets") -z ] ) ; then
|
||||
( [ -f "$confdir/containers/$name/envs.sh" ] && $(git -C "$confdir" diff --name-only $previusCommit_config $currentCommit_config "$confdir/containers/$name/envs.sh" | grep -qi "envs\.sh" ) ) ;
|
||||
then
|
||||
echo -e "Updating ${name} installation\n"
|
||||
$installScript $name
|
||||
fi
|
||||
done
|
||||
echo -e "Installations updated\n"
|
||||
# ( [ -d "$confdir/containers/$name/secrets" ] && [ ! $(git -C "$confdir" diff --name-only $previusCommit_config $currentCommit_config "$confdir/containers/$name/secrets") -z ] ) ;
|
||||
# ---------------------------
|
||||
|
||||
# auto update configs
|
||||
|
@ -82,4 +82,20 @@ function open_port()
|
||||
local port=$1
|
||||
#TODO: check if port is already open
|
||||
sudo ufw allow $port
|
||||
}
|
||||
|
||||
function secret_check()
|
||||
{
|
||||
local secret_name=$1
|
||||
|
||||
if ! $(podman secret ls | grep -q $secret_name) ; then
|
||||
echo "Error secret '$secret_name' not found."
|
||||
echo "To create the secret type:"
|
||||
echo "podman secret create $secret_name /path/to/file"
|
||||
echo "or"
|
||||
echo "echo \"secret_data\" | podman secret create $secret_name -"
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user