Tweak usage of plugins

This commit is contained in:
Luke Murphy 2020-03-15 08:42:50 +01:00
parent 513843b395
commit aa49f2d295
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
3 changed files with 22 additions and 14 deletions

View File

@ -4,11 +4,7 @@
"repository": "https://gitlab.com/autonomic-cooperative/gitea-dokku",
"dokku": {
"plugins": [
{ "name": "proxy", "commands": ["proxy:ports-add http:80:3000"] },
{
"name": "letsencrypt",
"commands": ["letsencrypt gitea", "letsencrypt:cron-job --add"]
}
{ "name": "proxy", "commands": ["proxy:ports-add http:80:3000"] }
]
},
"scripts": {

View File

@ -5,10 +5,14 @@ set -eu -o pipefail
setup_root_user() {
set -eu
if [ ! -f "/data/gitea/conf/app.ini" ]; then
return
fi
user_count=$(sqlite3 /data/gitea/gitea.db "select count(*) from user;")
if [[ "${user_count}" == "0" ]]; then
echo "=====> Setting up root user for first run"
echo "=====> Setting up root user for initial deployment"
if gitea admin create-user --username "$ADMIN_USER" --password "$ADMIN_PASS" --email "$ADMIN_MAIL" --admin; then
echo "=====> root user added"
else
@ -18,12 +22,20 @@ setup_root_user() {
fi
}
main() {
setup_letsencrypt_certs() {
set -eu
if [ -f "/data/gitea/conf/app.ini" ]; then
setup_root_user
if [ -d "/home/dokku/gitea/letsencrypt" ]; then
echo "=====> Generating let's encrypt certificates"
dokku letsencrypt gitea
fi
}
main() {
set -eu
setup_root_user
setup_letsencrypt_certs
}
main

View File

@ -5,16 +5,16 @@ set -eu -o pipefail
setup_db() {
set -eu
echo "=====> Running database migration"
gitea migrate
if [ -f "/data/gitea/conf/app.ini" ]; then
echo "=====> Running database migration"
gitea migrate
fi
}
main() {
set -eu
if [ -f "/data/gitea/conf/app.ini" ]; then
setup_db
fi
setup_db
}
main