diff --git a/resources/gitlab b/resources/gitlab index 8d3dd9cc..eafb9bab 100755 --- a/resources/gitlab +++ b/resources/gitlab @@ -125,11 +125,16 @@ chown -R git:git /home/git/.ssh cd /home/git/gitlab/ +db_initialize () { + echo "Initializing database..." + sudo -u git -H force=yes bundle exec rake gitlab:setup RAILS_ENV=production +} + gitlab_start () { echo "Starting gitlab server..." # reset the database if the --db-init switch was given. if [ "$DB_INIT" == "yes" ]; then - sudo -u git -H force=yes bundle exec rake gitlab:setup RAILS_ENV=production + db_initialize fi # start the gitlab application @@ -150,6 +155,7 @@ gitlab_start () { gitlab_help () { echo "Available options:" echo " start - Starts the gitlab server (default)" + echo " initialize - Initialize the database." echo " help - Displays the help" } @@ -157,6 +163,9 @@ case "$1" in start) gitlab_start ;; + initialize) + db_initialize + ;; help|*) gitlab_help ;;