Thank you for bringing this painless self-hosted Git service to us!
In an effort to make it even more painless i’m having a shot at making it in to a module for a centos based server. It’s has on a stock old configuration layer called e-smith; in short it configures apps with {bash, perl, python} scripts.
So far gitea is packed in a nice rpm/sprm, and it works like a charm authenticating against openLdap or samba AD, now i’m stuck at provisioning/install/init gitea from the command line.
Two main questions to start with:
just cannot figure out how to update the security tokensgitea generate secret SECRET_KEY does not do the job for me, what is my wrong doing?
How to setup the ldap bits and pieces from the command line?
Just a heads up of my finding and maybe it is usefull for others…
This is my bad: i’m working from the stable 1.4.x branch, sould have mentioned that. The “generate” feature is implemented in the 1.5.x branch.
After encountering this too (initialization of database) :
Settled for PAM with a workaround i promised myself never to do again.
prerequisite: i am using mysql, or to be accurate mariadb. And complied gitea with pam
make a dump of the db structure/tables of a running gitea instance to gitea-sample-mysql.sql (in my case mysqldump --defaults-file=/root/.my.cnf -d gitea > mysql-sample.sql)
on a new install create a empty mysql database for gitea
and load the tables ( in my case mysql --defaults-file=/root/.my.cnf gitea < mysql-sample.sql)
write a record in the data base for PAM authentication
NOTE: you need to build gitea with pam enabled, by default it is omitted (for good reasons)
However (with or without PAM) if you included your mysql credentials in your app.ini you can add local (admin) user(s) before running gitea for the first time.
(running user is gitea; is installed in /bin/gitea; working_dir is /var/lib/gitea; app.ini lives in /etc/gitea)
In conclusion:
A functionality like gitea --init , which initializes databases and security tokens would be appreciated very much!
Meanwhile it would be a nice gesture to include de db-schema’s in the source. You can omit the first step of making a dump of a running instance. (maybe it is there and did not find it )
The reason why this isn’t included is because it is generated via code, you can find the DB migrations here: gitea/models/migrations at main · go-gitea/gitea · GitHub this allows Gitea to support multiple DBs such as MySQL/MariaDB, Postgresql, MSSQL, and even sqlite.
I’ve just created a PR to allow adding (oauth, so PAM would still need to be added) login sources via cli so you don’t need to insert directly into the DB.
Several of Gitea’s cli commands (such as web) will automatically generate the DB for you as long as it has a config file that has DB information in it