Tweak usage of plugins
This commit is contained in:
parent
513843b395
commit
aa49f2d295
6
app.json
6
app.json
@ -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": {
|
||||
|
@ -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
|
||||
|
@ -5,16 +5,16 @@ set -eu -o pipefail
|
||||
setup_db() {
|
||||
set -eu
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
main
|
||||
|
Reference in New Issue
Block a user