Skip to content

Feaure requests: unattended installation, user creation, app creation, sso, ldap integration #9210

@lukasmrtvy

Description

@lukasmrtvy

Hello,
Here is my proposal to solve:

https://github.com/go-gitea/gitea/blob/master/docker/root/etc/s6/gitea/setup

if ! gitea migration --test; 
then
  printf 'do migration' 
  gitea migrate
fi

if [ -z $GITEA_USERNAME && -z $GITEA_PASSWORD && -z $GITEA_EMAIL ]; 
   printf 'user creation initiated' 
   if ! gitea admin get-user $GITEA_USERNAME; then
     printf 'user not found, creating new one'
     gitea admin create-user -u 
   else
     printf 'user found, modificating email and password'
     gitea admin edit-user $GITEA_USERNAME -p $GITEA_PASSWORD -m $GITEA_EMAIL
   fi
fi

if [ -z $GITEA_OAUTH2_PROVIDER_ID && $GITEA_OAUTH2_PROVIDER_SECRET ];
then
   printf 'oauth app creation initiated'
   if ! gitea admin get-app $GITEA_OAUTH2_PROVIDER_ID; then
     printf 'app not found, creating new one'
     gitea admin add-app $GITEA_OAUTH2_PROVIDER_ID -p $GITEA_OAUTH2_PROVIDER_SECRET
   else
     printf 'app found , modificating secret'
     gitea admin edit-app $GITEA_OAUTH2_PROVIDER_ID -p $GITEA_OAUTH2_PROVIDER_SECRET
   fi
fi

To do this, its needed to integrate new gitea commands:

  • gitea migration --test -> test if migration is done ( no need to use postgresql-client, mariadb-client, etc to check db tables are populated/migrated )
  • gitea admin get-user -> get gitea user ( name, password, email )
  • gitea admin edit-user -> edit gitea user ( password, email )
  • gitea admin add-app -> add oauth application ( id secret )
  • gitea admin edit-app -> edit oauth application ( secret )

P.S. modification commands are not necesary, its just for fully idempotent initialization of new instance. ( new gitea instance with old gitea db ). Even gitea admin auth update-oauth and gitea admin auth update-ldap exists...

Environment variables:

  • GITEA_USERNAME
  • GITEA_PASSWORD
  • GITEA_EMAIL
  • GITEA_OAUTH2_PROVIDER_ID
  • GITEA_OAUTH2_PROVIDER_SECRET

Something similar should be used also for oauth and ldap authentication.
There are already commands for it:

  • gitea admin auth add-oauth
  • gitea admin auth add-ldap

Would be nice to have fully integrated gitea at deploy time.

Any other ideas @lunny ?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions