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

77 lines
4.4 KiB
Bash
Raw Normal View History

2022-05-26 19:00:27 +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
cat <<EOT >> .env
APP_NAME=${GARBAYE_GITEA_APPNAME}
GITEA__database__DB_TYPE=postgres
GITEA__database__HOST=db:5432
GITEA__database__NAME=gitea
GITEA__database__PASSWD=${GARBAYE_GITEA_POSTGRES_PASSWORD}
GITEA__database__USER=gitea
GITEA__mailer__ENABLED=true
GITEA__mailer__FROM=${GARBAYE_GITEA_SMTP_FROM}
2023-02-19 13:45:07 +00:00
GITEA__mailer__SMTP_ADDR=${GARBAYE_GITEA_SMTP_ADDR}
GITEA__mailer__SMTP_PORT=25
2022-05-26 19:00:27 +00:00
GITEA__security__INSTALL_LOCK=true
GITEA__server__DOMAIN=${GARBAYE_GITEA_DOMAIN}
GITEA__server__SSH_DOMAIN=${GARBAYE_GITEA_DOMAIN}
GITEA__server__ROOT_URL="https://${GARBAYE_GITEA_DOMAIN}"
GITEA__server__SSH_PORT=${sshlisten_port}
GITEA__service__DISABLE_REGISTRATION=true
POSTGRES_DB=gitea
POSTGRES_PASSWORD=${GARBAYE_GITEA_POSTGRES_PASSWORD}
POSTGRES_USER=gitea
EOT
export gitea_image
export gitea_version
export postgres_image
export postgres_version
export weblisten_if
export weblisten_port
export sshlisten_if
export sshlisten_port
2022-11-13 13:06:42 +00:00
if ! podman image exists ${gitea_image}:${gitea_version}; then
podman image pull ${gitea_image}:${gitea_version} || exit 1
fi
2022-05-26 19:00:27 +00:00
podman pull ${postgres_image}:${postgres_version} &&
2022-06-09 20:50:46 +00:00
# force refresh of app.ini
podman unshare rm -f `get_podman_volume_path ${datavolume}`/gitea/conf/app.ini
2022-11-05 17:56:11 +00:00
podman-compose --pod-args="--infra=true --infra-name=${project_name}_infra --share=" --podman-run-args "--requires=${project_name}_infra --env-file .env" up -d &&
2022-05-26 19:00:27 +00:00
echo -n "Waiting for gitea to finish starting " &&
( podman logs -f ${container_name} 2>&1 & ) | grep -q 'NewServer()' &&
echo "OK" &&
2022-06-09 20:36:00 +00:00
podman exec --user 1000:1000 gitea gitea embedded extract --overwrite --destination /data/gitea/ 'templates/home.tmpl'
2023-02-19 13:45:07 +00:00
podman unshare sed -i '/{{.locale.Tr \"startpage.app_desc\"}}/,${s//Plateforme collaborative de projets libres./;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.locale.Tr \"startpage.install\"}}/,${s//Qui peut avoir un compte ?/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.locale.Tr \"startpage.install_desc\" | Str2html}}/,${s//Tous ceux qui partagent de près ou de loin nos idées ou notre vision./;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.locale.Tr \"startpage.lightweight\"}}/,${s//Comment créer un compte ?/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.locale.Tr \"startpage.lightweight_desc\" | Str2html}}/,${s//Pour des raisons de capacité et de gestion, l\x27enregistrement de compte en ligne est désactivé. Si vous souhaitez avoir un compte, <a href="https:\/\/garbaye.fr\/contact\/">contactez nous<\/a> pour nous parler de vos projets et besoins./;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.locale.Tr \"startpage.platform\"}}/,${s//Quels contenus sont acceptés ?/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.locale.Tr \"startpage.platform_desc\" | Str2html}}/,${s//La forge accueille tout type de contenu tel que code source, documentation, artistique, littéraire, etc. Un usage raisonnable en espace disque est attendu de nos utilisateurs./;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.locale.Tr \"startpage.license\"}}/,${s//Licences libres/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{.locale.Tr \"startpage.license_desc\" | Str2html}}/,${s//Tous les projets présents sur cette forge sont publiés sous licences libres, <a href="https:\/\/www.gnu.org\/licenses\/license-list.fr.html">au sens de la Free Software Foundation<\/a>./;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
2022-05-26 19:00:27 +00:00
podman pod stop ${pod_name} &&
echo Pod built and stopped. &&
shred -u .env