mirror of
https://gitlab.com/Snogard/kaido.git
synced 2025-06-25 02:13:00 +02:00
Compare commits
8 Commits
ff37a3b884
...
cffb158f0f
Author | SHA1 | Date | |
---|---|---|---|
cffb158f0f | |||
1be3d1fb30 | |||
70477b23f5 | |||
2e248de8cb | |||
6c3c8fd3eb | |||
2806a8b2ed | |||
7422fbb918 | |||
6ea8188250 |
@ -2,7 +2,7 @@
|
|||||||
source /opt/kaido/src/libs/bash/lib.sh
|
source /opt/kaido/src/libs/bash/lib.sh
|
||||||
|
|
||||||
# setup
|
# setup
|
||||||
imageName=docker.io/gitea/gitea:1.22.1-rootless
|
imageName=docker.io/gitea/gitea:1.23.5-rootless
|
||||||
containerName=gitea
|
containerName=gitea
|
||||||
|
|
||||||
dstDataPath="$KAIDO_CONTAINER_FOLDER/$containerName/data"
|
dstDataPath="$KAIDO_CONTAINER_FOLDER/$containerName/data"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
source /opt/kaido/src/libs/bash/lib.sh
|
source /opt/kaido/src/libs/bash/lib.sh
|
||||||
|
|
||||||
# setup
|
# setup
|
||||||
imageName=docker.io/gotson/komga:1.11.2
|
imageName=docker.io/gotson/komga:1.21.0
|
||||||
containerName=komga
|
containerName=komga
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ source /opt/kaido/src/libs/bash/lib.sh
|
|||||||
# docs https://hub.docker.com/r/pihole/pihole
|
# docs https://hub.docker.com/r/pihole/pihole
|
||||||
|
|
||||||
# setup
|
# setup
|
||||||
imageName=docker.io/pihole/pihole:2024.07.0
|
imageName=docker.io/pihole/pihole:2025.03.0
|
||||||
containerName=pihole
|
containerName=pihole
|
||||||
|
|
||||||
baseConfigPath="$KAIDO_CONTAINER_FOLDER/$containerName/config"
|
baseConfigPath="$KAIDO_CONTAINER_FOLDER/$containerName/config"
|
||||||
|
@ -143,4 +143,8 @@ echo -e "Configurations Updated\n"
|
|||||||
|
|
||||||
echo "Update complete"
|
echo "Update complete"
|
||||||
|
|
||||||
|
echo "WARNING: the update process is being split into two commands.
|
||||||
|
kaido update: to download the latest container defitions and kaido versions
|
||||||
|
kaido upgrade: to donwload the lastest user configs and to actually upgrade your containers to the latest definitions"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
135
src/commands/upgrade.sh
Normal file
135
src/commands/upgrade.sh
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source /opt/kaido/src/libs/bash/lib.sh
|
||||||
|
|
||||||
|
|
||||||
|
# init
|
||||||
|
root=/opt/kaido
|
||||||
|
configDir=$KAIDO_CONFIG_FOLDER
|
||||||
|
workDir=$HOME/.cache/kaido/update
|
||||||
|
|
||||||
|
updateConfig="$configDir/update.conf"
|
||||||
|
previousCommitFile_kaido="$workDir/previousCommit_kaido.txt"
|
||||||
|
previousCommitFIle_config="$workDir/previousCOmmit_config.txt"
|
||||||
|
|
||||||
|
|
||||||
|
skipContainerUpdate=0
|
||||||
|
updateSuccess=0
|
||||||
|
# ------------
|
||||||
|
|
||||||
|
|
||||||
|
# check file and folders
|
||||||
|
ensure_folder "${configDir}"
|
||||||
|
ensure_folder "${workDir}"
|
||||||
|
|
||||||
|
if [ ! -f "${updateConfig}" ]; then
|
||||||
|
echo "WARNING: container updates will be skipped"
|
||||||
|
skipContainerUpdate=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# get commit hashes
|
||||||
|
cd "$root"
|
||||||
|
|
||||||
|
currentCommit_kaido=$(git rev-parse --verify HEAD)
|
||||||
|
previousCommit_kaido="origin/master"
|
||||||
|
if [ -f "${previousCommitFile_kaido}" ]; then
|
||||||
|
previousCommit_kaido=$(head -n 1 "${previousCommitFile_kaido}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
cd "$configDir"
|
||||||
|
|
||||||
|
git reset --hard
|
||||||
|
git pull
|
||||||
|
|
||||||
|
currentCommit_config=$(git rev-parse --verify HEAD)
|
||||||
|
previusCommit_config=origin/master
|
||||||
|
|
||||||
|
if [ -f "${previousCommitFIle_config}" ]; then
|
||||||
|
previusCommit_config=$(head -n 1 ${previousCommitFIle_config})
|
||||||
|
fi
|
||||||
|
# ------------
|
||||||
|
|
||||||
|
|
||||||
|
# read config files
|
||||||
|
installList=$(cat ${updateConfig} | grep -i install-)
|
||||||
|
configureList=$(cat ${updateConfig} | grep -i configure-)
|
||||||
|
buildList=$(cat ${updateConfig} | grep -i build-)
|
||||||
|
# -----------------------
|
||||||
|
|
||||||
|
|
||||||
|
# Actual update
|
||||||
|
if [[ $skipContainerUpdate -eq 1 ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "Starting installation and configs auto update\n"
|
||||||
|
|
||||||
|
echo "Kaido: "
|
||||||
|
echo "previous commit: ${previousCommit_kaido}"
|
||||||
|
echo "current commit: ${currentCommit_kaido}"
|
||||||
|
echo "Config:"
|
||||||
|
echo "previous commit: ${previousCommit_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}
|
||||||
|
# if git diff --name-only $previusCommit $currentCommit build | grep -qi $name ; then
|
||||||
|
# echo -e "Building latest $name version\n"
|
||||||
|
# $buildScript $name
|
||||||
|
# fi
|
||||||
|
# done
|
||||||
|
# ---------------------------
|
||||||
|
|
||||||
|
|
||||||
|
# auto update containers
|
||||||
|
echo -e "Checking if containers need to be updated\n"
|
||||||
|
for val in $installList; do
|
||||||
|
name=${val:8}
|
||||||
|
# TODO support parameters
|
||||||
|
if $(git -C "$root" diff --name-only $previousCommit_kaido $currentCommit_kaido src/commands/install | grep -qi $name) || \
|
||||||
|
( [ -f "$configDir/containers/$name/envs.sh" ] && $(git -C "$configDir" diff --name-only $previousCommit_config $currentCommit_config "$configDir/containers/$name/envs.sh" | grep -qi "envs\.sh" ) ) ;
|
||||||
|
then
|
||||||
|
echo -e "Updating ${name} installation\n"
|
||||||
|
kaido install $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
|
||||||
|
echo -e "Checking if container configs need to be updated\n"
|
||||||
|
for val in $configureList; do
|
||||||
|
name=${val:6}
|
||||||
|
if $(git -C "$configDIr" diff --name-only $previousCommit_config $currentCommit_config "$configDIr/containers/$name/config" | grep -qi $name) ; then
|
||||||
|
echo -e "Updating ${name} configuration\n"
|
||||||
|
kaido config $name
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo -e "Configurations Updated\n"
|
||||||
|
# ---------------------------
|
||||||
|
|
||||||
|
#TODO do an actual check
|
||||||
|
updateSuccess=1
|
||||||
|
|
||||||
|
|
||||||
|
# end
|
||||||
|
if [[ $updateSuccess -eq 1 ]]; then
|
||||||
|
echo $previousCommit_kaido | tee "${previousCommitFile_kaido}"
|
||||||
|
echo $previousCOmmit_config | tee "${previousCommitFIle_config}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo "Upgrade complete"
|
||||||
|
|
||||||
|
exit 0
|
@ -1,3 +1,4 @@
|
|||||||
|
# TODO: rename to Create folder for container
|
||||||
function create_folder()
|
function create_folder()
|
||||||
{
|
{
|
||||||
local path=$1
|
local path=$1
|
||||||
@ -20,6 +21,19 @@ function symlink_folder()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ensure_folder(){
|
||||||
|
local dst=$1
|
||||||
|
|
||||||
|
if [ ! -d "${}" ]; then
|
||||||
|
echo "Creating folder at path $(dst)"
|
||||||
|
mkdir -p "${dst}"
|
||||||
|
if [ ! $? -eq 0 ]; then
|
||||||
|
echo "Could not create folder, make sure you have the right permissions"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function ensure_file()
|
function ensure_file()
|
||||||
{
|
{
|
||||||
local src=$1
|
local src=$1
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
source /opt/kaido/src/libs/bash/envs.sh
|
source /opt/kaido/src/libs/bash/envs.sh
|
||||||
source /opt/kaido/src/libs/bash/functions-common.sh
|
source /opt/kaido/src/libs/bash/functions-common.sh
|
||||||
source /opt/kaido/src/libs/bash/functions-commands.sh
|
source /opt/kaido/src/libs/bash/functions-commands.sh
|
||||||
source /opt/kaido/src/libs/bash/functions-containers.sh
|
source /opt/kaido/src/libs/bash/functions-containers.sh
|
||||||
|
|
||||||
|
function kaido() {
|
||||||
|
/opt/kaido/kaido.sh $@
|
||||||
|
}
|
@ -5,6 +5,8 @@ source /opt/kaido/src/libs/bash/lib.sh
|
|||||||
imageName=docker.io/
|
imageName=docker.io/
|
||||||
containerName=
|
containerName=
|
||||||
|
|
||||||
|
envFile="$KAIDO_CONFIG_FOLDER/containers/$podName/$containerName.env"
|
||||||
|
|
||||||
dstBasePath="$KAIDO_CONTAINER_FOLDER/$containerName"
|
dstBasePath="$KAIDO_CONTAINER_FOLDER/$containerName"
|
||||||
|
|
||||||
# envs
|
# envs
|
||||||
@ -14,6 +16,10 @@ if [ -f "$KAIDO_CONFIG_FOLDER/containers/$containerName/envs.sh" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -f "$envFile" ]; then
|
||||||
|
envFile="$KAIDO_EMPTY_ENV_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
# pre install
|
# pre install
|
||||||
create_folder "$dstBasePath"
|
create_folder "$dstBasePath"
|
||||||
stop_and_remove_container $containerName
|
stop_and_remove_container $containerName
|
||||||
@ -24,6 +30,7 @@ echo "Creating new container"
|
|||||||
podman create \
|
podman create \
|
||||||
--name $containerName \
|
--name $containerName \
|
||||||
-v $dstBasePath:/path/to/folder \
|
-v $dstBasePath:/path/to/folder \
|
||||||
|
--env-file="$envFile" \
|
||||||
$imageName
|
$imageName
|
||||||
|
|
||||||
|
|
50
src/templates/install/install-pod.sh
Normal file
50
src/templates/install/install-pod.sh
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source /opt/kaido/src/libs/bash/lib.sh
|
||||||
|
|
||||||
|
# setup
|
||||||
|
imageName_web=docker.io/
|
||||||
|
imageName_db=docker.io/
|
||||||
|
|
||||||
|
podName=
|
||||||
|
|
||||||
|
containerName_web=${podName}_web
|
||||||
|
containerName_db=${podName}_db
|
||||||
|
|
||||||
|
dstBasePath="$KAIDO_CONTAINER_FOLDER/$podName"
|
||||||
|
|
||||||
|
# envs
|
||||||
|
|
||||||
|
if [ -f "$KAIDO_CONFIG_FOLDER/containers/$podName/envs.sh" ]; then
|
||||||
|
source "$KAIDO_CONFIG_FOLDER/containers/$podName/envs.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# pre install
|
||||||
|
create_folder "$dstBasePath"
|
||||||
|
stop_and_remove_pod $podName
|
||||||
|
|
||||||
|
|
||||||
|
#install
|
||||||
|
echo "Creating new $podName pod"
|
||||||
|
podman pod create \
|
||||||
|
--name $podName \
|
||||||
|
-p 80:80/tcp \
|
||||||
|
|
||||||
|
echo "Creating new $containerName_db container"
|
||||||
|
podman create \
|
||||||
|
--pod $podName \
|
||||||
|
--name $containerName_db \
|
||||||
|
-v $dstBasePath:/path/to/folder \
|
||||||
|
$imageName_db
|
||||||
|
|
||||||
|
echo "Creating new $containerName_web container"
|
||||||
|
podman create \
|
||||||
|
--pod $podName \
|
||||||
|
--name $containerName_web \
|
||||||
|
--requires $containerName_db \
|
||||||
|
-v $dstBasePath:/path/to/folder \
|
||||||
|
$imageName_web
|
||||||
|
|
||||||
|
# systemd
|
||||||
|
create_systemd_services $podName
|
||||||
|
systemctl --user enable --now $podName
|
37
src/wip/install-kopia.sh
Normal file
37
src/wip/install-kopia.sh
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source /opt/kaido/src/libs/bash/lib.sh
|
||||||
|
|
||||||
|
# setup
|
||||||
|
imageName=docker.io/
|
||||||
|
containerName=kopia
|
||||||
|
|
||||||
|
dstBasePath="$KAIDO_CONTAINER_FOLDER/$containerName"
|
||||||
|
|
||||||
|
# envs
|
||||||
|
|
||||||
|
nextauth_url=http://$containerName_db:3000/api/v1/auth
|
||||||
|
|
||||||
|
secret_nextauth_secret=$containerName_db-nextauth_secret
|
||||||
|
secret_postgress_password=$containerName_web-postgress_password
|
||||||
|
|
||||||
|
if [ -f "$KAIDO_CONFIG_FOLDER/containers/$containerName/envs.sh" ]; then
|
||||||
|
source "$KAIDO_CONFIG_FOLDER/containers/$containerName/envs.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# pre install
|
||||||
|
create_folder "$dstBasePath"
|
||||||
|
stop_and_remove_container $containerName
|
||||||
|
|
||||||
|
|
||||||
|
# install
|
||||||
|
echo "Creating new container"
|
||||||
|
podman create \
|
||||||
|
--name $containerName \
|
||||||
|
-v $dstBasePath:/path/to/folder \
|
||||||
|
$imageName
|
||||||
|
|
||||||
|
|
||||||
|
# systemd
|
||||||
|
create_systemd_services $containerName
|
||||||
|
systemctl --user enable --now $containerName
|
50
src/wip/install-linkwarden.sh
Normal file
50
src/wip/install-linkwarden.sh
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source /opt/kaido/src/libs/bash/lib.sh
|
||||||
|
|
||||||
|
# setup
|
||||||
|
imageName_web=ghcr.io/linkwarden/linkwarden:v2.6.2
|
||||||
|
imageName_db=docker.io/library/postgres:16.3-alpine3.20
|
||||||
|
|
||||||
|
podName=linkwarden
|
||||||
|
|
||||||
|
containerName_web=${podName}_web
|
||||||
|
containerName_db=${podName}_db
|
||||||
|
|
||||||
|
dstBasePath="$KAIDO_CONTAINER_FOLDER/$podName"
|
||||||
|
|
||||||
|
# envs
|
||||||
|
|
||||||
|
if [ -f "$KAIDO_CONFIG_FOLDER/containers/$podName/envs.sh" ]; then
|
||||||
|
source "$KAIDO_CONFIG_FOLDER/containers/$podName/envs.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# pre install
|
||||||
|
create_folder "$dstBasePath"
|
||||||
|
stop_and_remove_pod $podName
|
||||||
|
|
||||||
|
|
||||||
|
#install
|
||||||
|
echo "Creating new $podName pod"
|
||||||
|
podman pod create \
|
||||||
|
--name $podName \
|
||||||
|
-p 80:80/tcp \
|
||||||
|
|
||||||
|
echo "Creating new $containerName_db container"
|
||||||
|
podman create \
|
||||||
|
--pod $podName \
|
||||||
|
--name $containerName_db \
|
||||||
|
-v $dstBasePath:/path/to/folder \
|
||||||
|
$imageName_db
|
||||||
|
|
||||||
|
echo "Creating new $containerName_web container"
|
||||||
|
podman create \
|
||||||
|
--pod $podName \
|
||||||
|
--name $containerName_web \
|
||||||
|
--requires $containerName_db \
|
||||||
|
-v $dstBasePath:/path/to/folder \
|
||||||
|
$imageName_web
|
||||||
|
|
||||||
|
# systemd
|
||||||
|
create_systemd_services $containerName
|
||||||
|
systemctl --user enable --now $containerName
|
@ -2,9 +2,6 @@
|
|||||||
source /opt/kaido/src/libs/bash/lib.sh
|
source /opt/kaido/src/libs/bash/lib.sh
|
||||||
# docs https://github.com/nextcloud/docker
|
# docs https://github.com/nextcloud/docker
|
||||||
|
|
||||||
echo "This is still experimental"
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
# setup
|
# setup
|
||||||
podName=nextcloud
|
podName=nextcloud
|
||||||
|
|
34
src/wip/install-vaultwarden-rc1.sh
Executable file
34
src/wip/install-vaultwarden-rc1.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source /opt/kaido/src/libs/bash/lib.sh
|
||||||
|
|
||||||
|
# setup
|
||||||
|
imageName=docker.io/vaultwarden/server:1.31.0-alpine
|
||||||
|
containerName=vaultwarden
|
||||||
|
|
||||||
|
dstBasePath="$KAIDO_CONTAINER_FOLDER/$containerName"
|
||||||
|
dstDataPath="$dstBasePath/data"
|
||||||
|
|
||||||
|
# envs
|
||||||
|
|
||||||
|
if [ -f "$KAIDO_CONFIG_FOLDER/containers/$containerName/envs.sh" ]; then
|
||||||
|
source "$KAIDO_CONFIG_FOLDER/containers/$containerName/envs.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# pre install
|
||||||
|
create_folder "$dstDataPath"
|
||||||
|
stop_and_remove_container $containerName
|
||||||
|
|
||||||
|
|
||||||
|
# install
|
||||||
|
echo "Creating new container"
|
||||||
|
podman create \
|
||||||
|
--name $containerName \
|
||||||
|
-p 10114:80 \
|
||||||
|
-v $dstDataPath:/data \
|
||||||
|
$imageName
|
||||||
|
|
||||||
|
|
||||||
|
# systemd
|
||||||
|
create_systemd_services $containerName
|
||||||
|
systemctl --user enable --now $containerName
|
74
src/wip/install-vaultwarden-rc2.sh
Executable file
74
src/wip/install-vaultwarden-rc2.sh
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source /opt/kaido/src/libs/bash/lib.sh
|
||||||
|
|
||||||
|
# setup
|
||||||
|
imageName_web=docker.io/vaultwarden/server:1.31.0-alpine
|
||||||
|
imageName_db=docker.io/library/mariadb:11.4.2
|
||||||
|
|
||||||
|
podName=vaultwarden
|
||||||
|
|
||||||
|
containerName_web=${podName}_web
|
||||||
|
containerName_db=${podName}_db
|
||||||
|
|
||||||
|
dstBasePath="$KAIDO_CONTAINER_FOLDER/$podName"
|
||||||
|
dstDBPath="$dstBasePath/db"
|
||||||
|
dstDataPath="$dstBasePath/data"
|
||||||
|
|
||||||
|
# envs
|
||||||
|
|
||||||
|
if [ -f "$KAIDO_CONFIG_FOLDER/containers/$podName/envs.sh" ]; then
|
||||||
|
source "$KAIDO_CONFIG_FOLDER/containers/$podName/envs.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$KAIDO_CONFIG_FOLDER/containers/$podName/$containerName_db.env" ]; then
|
||||||
|
echo "Error: missing $containerName_db.env file in the container configuration folder;
|
||||||
|
Add the following variables to the file:
|
||||||
|
MARIADB_ROOT_PASSWORD=<your root password>
|
||||||
|
MARIADB_PASSWORD=<your db_password>
|
||||||
|
MARIADB_USER=<your db_user>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$KAIDO_CONFIG_FOLDER/containers/$podName/$containerName_web.env" ]; then
|
||||||
|
echo "Error: missing $containerName_web.env file in the container configuration folder;
|
||||||
|
Add the following variables to the file:
|
||||||
|
DATABASE_URL=mysql://<db_user>:<db_pw>@$containerName_db/vaultwarden
|
||||||
|
ADMIN_TOKEN=<your token>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# pre install
|
||||||
|
create_folder "$dstBasePath"
|
||||||
|
stop_and_remove_pod $podName
|
||||||
|
|
||||||
|
|
||||||
|
#install
|
||||||
|
echo "Creating new $podName pod"
|
||||||
|
podman pod create \
|
||||||
|
--name $podName \
|
||||||
|
-p 10114:80/tcp \
|
||||||
|
|
||||||
|
echo "Creating new $containerName_db container"
|
||||||
|
podman create \
|
||||||
|
--pod $podName \
|
||||||
|
--name $containerName_db \
|
||||||
|
-v $dstDBPath:/var/lib/mysql \
|
||||||
|
-v /etc/localtime:/etc/localtime:ro \
|
||||||
|
-e "MARIADB_DATABASE=vaultwarden" \
|
||||||
|
--env-file="$KAIDO_CONFIG_FOLDER/containers/$podName/$containerName_db.env" \
|
||||||
|
$imageName_db
|
||||||
|
|
||||||
|
echo "Creating new $containerName_web container"
|
||||||
|
podman create \
|
||||||
|
--pod $podName \
|
||||||
|
--name $containerName_web \
|
||||||
|
--requires $containerName_db \
|
||||||
|
-v $dstDataPath:/data \
|
||||||
|
-e "RUST_BACKTRACE=1" \
|
||||||
|
--env-file="$KAIDO_CONFIG_FOLDER/containers/$podName/$containerName_web.env" \
|
||||||
|
$imageName_web
|
||||||
|
|
||||||
|
# systemd
|
||||||
|
create_systemd_services $containerName
|
||||||
|
systemctl --user enable --now $containerName
|
104
src/wip/install-vaultwarden-rc3.sh
Executable file
104
src/wip/install-vaultwarden-rc3.sh
Executable file
@ -0,0 +1,104 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source /opt/kaido/src/libs/bash/lib.sh
|
||||||
|
|
||||||
|
# setup
|
||||||
|
imageName_web=docker.io/vaultwarden/server:1.31.0-alpine
|
||||||
|
imageName_db=docker.io/library/mariadb:11.4.2
|
||||||
|
|
||||||
|
podName=vaultwarden
|
||||||
|
|
||||||
|
containerName_web=${podName}_web
|
||||||
|
containerName_db=${podName}_db
|
||||||
|
|
||||||
|
envFile_db="$KAIDO_CONFIG_FOLDER/containers/$podName/$containerName_db.env"
|
||||||
|
envFile_web="$KAIDO_CONFIG_FOLDER/containers/$podName/$containerName_web.env"
|
||||||
|
|
||||||
|
dstBasePath="$KAIDO_CONTAINER_FOLDER/$podName"
|
||||||
|
dstDBPath="$dstBasePath/db"
|
||||||
|
dstDataPath="$dstBasePath/data"
|
||||||
|
|
||||||
|
# envs
|
||||||
|
external_port=10114
|
||||||
|
rust_backtrace=1
|
||||||
|
db_name=vaultwarden
|
||||||
|
|
||||||
|
secret_db_root_password=$containerName_db-mariadb_root_password
|
||||||
|
secret_db_user=$containerName_db-mariadb_user
|
||||||
|
secret_db_password=$containerName_db-mariadb_password
|
||||||
|
|
||||||
|
secret_db_url=$containerName_web-database_url
|
||||||
|
secret_token=$containerName_web-admin_token
|
||||||
|
|
||||||
|
if [ -f "$KAIDO_CONFIG_FOLDER/containers/$podName/envs.sh" ]; then
|
||||||
|
source "$KAIDO_CONFIG_FOLDER/containers/$podName/envs.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -f "$envFile_db" ]; then
|
||||||
|
envFile_db=$KAIDO_EMPTY_ENV_FILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$envFile_web" ]; then
|
||||||
|
envFile_web=$KAIDO_EMPTY_ENV_FILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# pre install
|
||||||
|
create_folder "$dstDBPath"
|
||||||
|
create_folder "$dstDataPath"
|
||||||
|
stop_and_remove_pod $podName
|
||||||
|
|
||||||
|
res=0
|
||||||
|
secret_check $secret_db_root_password
|
||||||
|
res=$(($?+$res))
|
||||||
|
secret_check $secret_db_password
|
||||||
|
res=$(($?+$res))
|
||||||
|
secret_check $secret_db_user
|
||||||
|
res=$(($?+$res))
|
||||||
|
secret_check $secret_db_url
|
||||||
|
res=$(($?+$res))
|
||||||
|
# secret_check $secret_token
|
||||||
|
# res=$(($?+$res))
|
||||||
|
|
||||||
|
if [[ $res -gt 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#install
|
||||||
|
echo "Creating new $podName pod"
|
||||||
|
podman pod create \
|
||||||
|
--name $podName \
|
||||||
|
-p $external_port:80/tcp
|
||||||
|
|
||||||
|
echo "Creating new $containerName_db container"
|
||||||
|
podman create \
|
||||||
|
--pod $podName \
|
||||||
|
--name $containerName_db \
|
||||||
|
-v $dstDBPath:/var/lib/mysql \
|
||||||
|
-v /etc/localtime:/etc/localtime:ro \
|
||||||
|
--secret $secret_db_root_password,type=env,target=MARIADB_ROOT_PASSWORD \
|
||||||
|
--secret $secret_db_password,type=env,target=MARIADB_PASSWORD \
|
||||||
|
--secret $secret_db_user,type=env,target=MARIADB_USER \
|
||||||
|
-e MARIADB_DATABASE=$db_name \
|
||||||
|
--env-file="$envFile_db" \
|
||||||
|
$imageName_db
|
||||||
|
|
||||||
|
echo "Creating new $containerName_web container"
|
||||||
|
podman create \
|
||||||
|
--pod $podName \
|
||||||
|
--name $containerName_web \
|
||||||
|
--requires $containerName_db \
|
||||||
|
-v $dstDataPath:/data \
|
||||||
|
--secret $secret_db_url,type=env,target=DATABASE_URL \
|
||||||
|
-e RUST_BACKTRACE=$rust_backtrace \
|
||||||
|
--env-file="$envFile_web" \
|
||||||
|
$imageName_web
|
||||||
|
|
||||||
|
# --secret $secret_token,type=env,target=ADMIN_TOKEN \
|
||||||
|
# systemd
|
||||||
|
create_systemd_services $podName
|
||||||
|
systemctl --user enable --now $podName
|
||||||
|
|
||||||
|
|
||||||
|
#TODO add smtp server/relay
|
Loading…
x
Reference in New Issue
Block a user