services-garbaye/podman-hedgedoc/10_install.sh

86 lines
2.7 KiB
Bash
Raw Normal View History

2022-11-19 13:19:37 +00:00
#!/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
2022-11-19 17:57:17 +00:00
#if ! podman volume exists ${uploadsvolume} ; then
# echo "Error : UPLOADS volume ${uploasvolume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
# exit 1
#fi
2022-11-19 13:19:37 +00:00
cat <<EOT >> .env
# HedgeDoc https://docs.hedgedoc.org/configuration/
## Node.JS
NODE_ENV=production
DEBUG=false
## HedgeDoc basics
2022-11-19 13:53:24 +00:00
#CMD_CONFIG_FILE=/data/config.json
2022-11-19 14:01:16 +00:00
#CMD_DB_URL=sqlite:///data/sqlite.db
CMD_DB_URL=CMD_DB_URL=postgres://hedgedoc:${GARBAYE_HEDGEDOC_DATABASE_PASSWORD}@database:5432/hedgedoc
2022-11-19 13:19:37 +00:00
#CMD_DB_URL=CMD_DB_URL=mysql://hedgedoc:${GARBAYE_HEDGEDOC_DATABASE_PASSWORD}@database:3306/hedgedoc
CMD_IMAGE_UPLOAD_TYPE=filesystem
## HedgeDoc Location
CMD_DOMAIN=localhost
CMD_URL_ADDPORT=true
CMD_ALLOW_ORIGIN=['localhost','${GARBAYE_HEDGEDOC_DOMAIN}']
## Web security aspects
CMD_CSP_ALLOW_FRAMING=false
CMD_CSP_ALLOW_PDF_EMBED=false
CMD_COOKIE_POLICY=strict
## Privacy and External Requests
CMD_ALLOW_GRAVATAR=false
## Users and Privileges
CMD_ALLOW_ANONYMOUS=false
## Login methods
CMD_ALLOW_EMAIL_REGISTER=false
# PostgreSQL
POSTGRES_DB=hedgedoc
POSTGRES_PASSWORD=${GARBAYE_HEDGEDOC_DATABASE_PASSWORD}
POSTGRES_USER=hedgedoc
# MySQL
MYSQL_USER=hedgedoc
MYSQL_PASSWORD=${GARBAYE_HEDGEDOC_DATABASE_PASSWORD}
MYSQL_DATABASE=hedgedoc
EOT
2022-11-19 18:37:02 +00:00
cat .env
2022-11-19 13:19:37 +00:00
export hedgedoc_image
export hedgedoc_version
export database_image
export database_version
2022-11-19 18:16:17 +00:00
export container_name
export db_container_name
2022-11-19 13:19:37 +00:00
if ! podman image exists ${hedgedoc_image}:${hedgedoc_version}; then
podman image pull ${hedgedoc_image}:${hedgedoc_version} || exit 1
fi
if ! podman image exists ${database_image}:${database_version}; then
2022-11-19 18:37:02 +00:00
podman image pull ${database_image}:${database_version} || exit 1
2022-11-19 13:19:37 +00:00
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 hedgedoc to finish starting " &&
2022-11-19 18:12:56 +00:00
podman logs -f ${container_name}
#( 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