Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lukasmrtvy opened this issue Nov 29, 2019 · 4 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@lukasmrtvy
Copy link

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

@lunny lunny added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Nov 30, 2019
@lunny
Copy link
Member

lunny commented Nov 30, 2019

It's interesting. We need some new commands.

@kapsh
Copy link

kapsh commented Jul 14, 2021

+1 for this feature, dockerised setup really could use default admin account.

@techknowlogick
Copy link
Member

In 1.14.x this is a lot more straightforward, see https://discourse.gitea.io/t/unattended-gitea-installation-from-the-cli/3373/14 for details.

@kapsh
Copy link

kapsh commented Jul 17, 2021

@techknowlogick this works, thanks for the hint.

@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

4 participants