53 lines
1.7 KiB
Bash
Executable file
53 lines
1.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
|
source ${ABSDIR}/../functions.sh
|
|
source ${ABSDIR}/vars.sh
|
|
|
|
ensure_pwd_is_scriptdir
|
|
ensure_not_root
|
|
|
|
ensure_pod_not_exists ${pod_name}
|
|
ensure_variables_are_defined "$envvars"
|
|
|
|
if ! podman volume exists ${dbvolume} ; then
|
|
echo "Error : DB volume ${dbvolume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
|
|
exit 1
|
|
fi
|
|
|
|
if ! podman volume exists ${datavolume} ; then
|
|
echo "Error : DATA volume ${datavolume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
|
|
exit 1
|
|
fi
|
|
|
|
cat <<EOT > .env
|
|
# vaultwarden
|
|
DATABASE_URL=postgresql://vaultwarden:${GARBAYE_VAULTWARDEN_DATABASE_PASSWORD}@database:${database_port}/vaultwarden
|
|
# PostgreSQL
|
|
POSTGRES_DB=vaultwarden
|
|
POSTGRES_PASSWORD=${GARBAYE_VAULTWARDEN_DATABASE_PASSWORD}
|
|
POSTGRES_USER=vaultwarden
|
|
EOT
|
|
|
|
export vaultwarden_image
|
|
export vaultwarden_version
|
|
export database_image
|
|
export database_version
|
|
export database_path
|
|
export container_name
|
|
export db_container_name
|
|
|
|
if ! podman image exists ${vaultwarden_image}:${vaultwarden_version}; then
|
|
podman image pull ${vaultwarden_image}:${vaultwarden_version} || exit 1
|
|
fi
|
|
if ! podman image exists ${database_image}:${database_version}; then
|
|
podman image pull ${database_image}:${database_version} || exit 1
|
|
fi
|
|
podman-compose --pod-args="--infra=true --infra-name=${project_name}_infra --share=" --podman-run-args "--requires=${project_name}_infra --env-file .env" up -d &&
|
|
echo -n "Waiting for vaultwarden to finish starting " &&
|
|
( podman logs -f ${container_name} 2>&1 & ) | grep -q 'HTTP Server listening at ' &&
|
|
echo "OK" &&
|
|
podman pod stop ${pod_name} &&
|
|
echo Pod built and stopped. &&
|
|
shred -u .env
|